当前位置: 首页>>代码示例>>C++>>正文


C++ Searchable::check方法代码示例

本文整理汇总了C++中Searchable::check方法的典型用法代码示例。如果您正苦于以下问题:C++ Searchable::check方法的具体用法?C++ Searchable::check怎么用?C++ Searchable::check使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Searchable的用法示例。


在下文中一共展示了Searchable::check方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: open

bool HapticDeviceWrapper::open(Searchable &config)
{
    portStemName=config.check("name",
                              Value(HAPTICDEVICE_WRAPPER_DEFAULT_NAME)).asString().c_str();
    verbosity=config.check("verbosity",Value(0)).asInt();
    int period=config.check("period",
                            Value(HAPTICDEVICE_WRAPPER_DEFAULT_PERIOD)).asInt();
    setRate(period);

    if (config.check("subdevice"))
    {
        Property p(config.toString().c_str());
        p.setMonitor(config.getMonitor(),"subdevice");
        p.unput("device");
        p.put("device",config.find("subdevice").asString());

        if (driver.open(p))
        {
            IHapticDevice *d;
            driver.view(d);
            attach(d);
        }
        else
        {
            yError("*** Haptic Device Wrapper: failed to open the driver!");
            return false;
        }
    }

    if (verbosity>0)
        yInfo("*** Haptic Device Wrapper: opened");

    return true;
}
开发者ID:robotology,项目名称:haptic-devices,代码行数:34,代码来源:hapticdeviceWrapper.cpp

示例2: yError

bool realsense2Driver::open(Searchable& config)
{
    std::vector<RGBDSensorParamParser::RGBDParam*> params;
    for (auto& p:params_map)
    {
        params.push_back(&(p.second));
    }

    m_verbose = config.check("verbose");
    if (config.check("stereoMode")) {
        m_stereoMode = config.find("stereoMode").asBool();
    }

    if (!m_paramParser->parseParam(config, params))
    {
        yError()<<"realsense2Driver: failed to parse the parameters";
        return false;
    }

    if (!initializeRealsenseDevice())
    {
        yError()<<"realsense2Driver: failed to initialize the realsense device";
        return false;
    }

    // setting Parameters
    if (!setParams())
    {
        return false;
    }

    return true;
}
开发者ID:robotology,项目名称:yarp,代码行数:33,代码来源:realsense2Driver.cpp

示例3: open

bool fakeMotorDeviceClient::open(Searchable &config)
{
    printf("Opening Fake Motor Device Client ...\n");

    string remote=config.check("remote",Value("/fakeyServer")).asString().c_str();
    string local=config.check("local",Value("/fakeyClient")).asString().c_str();

    statePort.open((local+"/state:i").c_str());
    cmdPort.open((local+"/cmd:o").c_str());
    rpcPort.open((local+"/rpc").c_str());
    
    bool ok=true;
    ok&=Network::connect((remote+"/state:o").c_str(),statePort.getName().c_str(),"udp");
    ok&=Network::connect(cmdPort.getName().c_str(),(remote+"/cmd:i").c_str(),"udp");
    ok&=Network::connect(rpcPort.getName().c_str(),(remote+"/rpc").c_str(),"tcp");

    if (ok)
    {
        configured=true;

        printf("Fake Motor Device Client successfully open\n");
        return true;
    }
    else
    {
        statePort.close();
        cmdPort.close();
        rpcPort.close();

        printf("Fake Motor Device Client failed to open\n");
        return false;
    }
}
开发者ID:towardthesea,项目名称:icub-tutorials,代码行数:33,代码来源:fakeMotorDeviceClient.cpp

示例4: open

bool ServerSerial::open(Searchable& prop)
{
    verb = (prop.check("verbose",Value(0),"Specifies if the device is in verbose mode (0/1).").asInt())>0;
    if (verb)
        printf("running with verbose output\n");

    Value *name;
    if (prop.check("subdevice",name,"name of specific control device to wrap")) {
        printf("Subdevice %s\n", name->toString().c_str());
        if (name->isString()) {
            // maybe user isn't doing nested configuration
            Property p;
            p.setMonitor(prop.getMonitor(),
                            "subdevice"); // pass on any monitoring
            p.fromString(prop.toString());
            p.put("device",name->toString());
            poly.open(p);
        } else {
            Bottle subdevice = prop.findGroup("subdevice").tail();
            poly.open(subdevice);
        }
        if (!poly.isValid()) {
            printf("cannot make <%s>\n", name->toString().c_str());
        }
    } else {
        printf("\"--subdevice <name>\" not set for server_serial\n");
        return false;
    }

    if (!poly.isValid()) {
        return false;
    }

    ConstString rootName =
        prop.check("name",Value("/serial"),
                    "prefix for port names").asString().c_str();

    command_buffer.attach(toDevice);
    reply_buffer.attach(fromDevice);

    command_buffer.useCallback(callback_impl);

    toDevice.open((rootName+"/in").c_str());
    fromDevice.open((rootName+"/out").c_str());



    if (poly.isValid())
        poly.view(serial);

    if(serial != NULL) {
        start();
        return true;
    }

    printf("subdevice <%s> doesn't look like a serial port (no appropriate interfaces were acquired)\n",
                    name->toString().c_str());

    return false;
}
开发者ID:Karma-Revolution,项目名称:yarp,代码行数:60,代码来源:ServerSerial.cpp

示例5: open

    bool open(Searchable& p) {
        bool dev = true;
        if (p.check("nodevice")) {
            dev = false;
        }
        if (dev) {
            poly.open(p);
            if (!poly.isValid()) {
                printf("cannot open driver\n");
                return false;
            }
            
            if (!p.check("mute")) {
                // Make sure we can write sound
                poly.view(put);
                if (put==NULL) {
                    printf("cannot open interface\n");
                    return false;
                }
            }
        }
            
        port.setStrict(true);
        if (!port.open(p.check("name",Value("/yarphear")).asString())) {
            printf("Communication problem\n");
            return false;
        }
        
        if (p.check("remote")) {
            Network::connect(p.check("remote",Value("/remote")).asString(),
                             port.getName());
        }

        return true;
    }
开发者ID:andreadelprete,项目名称:yarp,代码行数:35,代码来源:yarphear.cpp

示例6: byConfig

Contact Contact::byConfig(Searchable& config) {
    Contact result;
    result.port = config.check("port_number",Value(-1)).asInt();
    result.hostName = config.check("ip",Value("")).asString().c_str();
    result.regName = config.check("name",Value("")).asString().c_str();
    result.carrier = config.check("carrier",Value("tcp")).asString().c_str();
    return result;
}
开发者ID:BRKMYR,项目名称:yarp,代码行数:8,代码来源:Contact.cpp

示例7: fromConfig

Contact Contact::fromConfig(const Searchable& config)
{
    Contact result;
    result.mPriv->port = config.check("port_number",Value(-1)).asInt();
    result.mPriv->hostname = config.check("ip",Value("")).asString().c_str();
    result.mPriv->regName = config.check("name",Value("")).asString().c_str();
    result.mPriv->carrier = config.check("carrier",Value("tcp")).asString().c_str();
    return result;
}
开发者ID:barbalberto,项目名称:yarp,代码行数:9,代码来源:Contact.cpp

示例8: open

bool TextureInput::open(Searchable& config) {
    textureIndex = config.check("textureIndex",Value(-1),
                                "texture index").asInt();

    string texturePort = config.check("port",Value("/texture"),"local port name").asString();

    string portStr = this->moduleName + texturePort.c_str();
    port.open( portStr.c_str() );

    return true;
}
开发者ID:robotology,项目名称:icub-main,代码行数:11,代码来源:VideoTexture.cpp

示例9: configure_search

void configure_search(RosTypeSearch& env, Searchable& p) {
    if (p.check("out")) {
        env.setTargetDirectory(p.find("out").toString().c_str());
    }
    if (p.check("web",Value(0)).asInt()!=0 || p.findGroup("web").size()==1) {
        env.allowWeb();
    }
    if (p.check("soft",Value(0)).asInt()!=0 || p.findGroup("soft").size()==1) {
        env.softFail();
    }
    env.lookForService(p.check("service"));
}
开发者ID:Karma-Revolution,项目名称:yarp,代码行数:12,代码来源:main.cpp

示例10: GetValueFromConfig

Value ReachManager::GetValueFromConfig(Searchable& config, string valueName)
{
    if(!config.check(valueName.c_str()))
    {
        cout << "ERROR with config file : couldn't find value : \"" << valueName << "\"." << endl;
        return false;
    }
    return config.find(valueName.c_str());
}
开发者ID:xufango,项目名称:contrib_bk,代码行数:9,代码来源:reachManager.cpp

示例11: open

bool HapticDeviceClient::open(Searchable &config)
{
    if (!config.check("remote"))
    {
        yError("*** Haptic Device Client: \"remote\" option missing, failed to open!");
        return false;
    }

    if (!config.check("local"))
    {
        yError("*** Haptic Device Client: \"local\" option missing, failed to open!");
        return false;
    }

    string remote=config.find("remote").asString().c_str();
    string local=config.find("local").asString().c_str();
    verbosity=config.check("verbosity",Value(0)).asInt();

    statePort.open((local+"/state:i").c_str());
    feedbackPort.open((local+"/feedback:o").c_str());
    rpcPort.open((local+"/rpc").c_str());
    statePort.setClient(this);

    bool ok=true;
    ok&=Network::connect((remote+"/state:o").c_str(),statePort.getName().c_str(),"udp");
    ok&=Network::connect(feedbackPort.getName().c_str(),(remote+"/feedback:i").c_str(),"tcp");
    ok&=Network::connect(rpcPort.getName().c_str(),(remote+"/rpc").c_str(),"tcp");

    if (!ok)
    {
        statePort.close();
        feedbackPort.close();
        rpcPort.close();

        yError("*** Haptic Device Client: unable to connect to Haptic Device Wrapper, failed to open!");
        return false;
    }

    if (verbosity>0)
        yInfo("*** Haptic Device Client: opened");

    return true;
}
开发者ID:robotology,项目名称:haptic-devices,代码行数:43,代码来源:hapticdeviceClient.cpp

示例12: open

    virtual bool open(Searchable& config)
    {
        int i; 
        char portname[10];
        if (config.check("help","if present, display usage message")) {
            printf("Call with --name </portprefix> --file <configfile.ini>\n");
            return false;
        }

        cols  = config.check("width", 640, "Number of image columns").asInt();
        lines = config.check("height", 480, "Number of image lines").asInt();
        levels = config.check("levels", 4, "Number of scales in the scale space").asInt();

        scales = new double[levels];
        Bottle &xtmp = config.findGroup("scales");
	    if(xtmp.size() != levels+1)
            for (i = 0; i < levels; i++) 
                scales[i] = pow(2.0,i+1);
            
        for (i = 1; i < xtmp.size(); i++) 
            scales[i-1] = xtmp.get(i).asDouble();

        ss.AllocateResources(lines, cols, levels, scales);
        infloat = cvCreateImage(cvSize(cols,lines), IPL_DEPTH_32F, 1);
        ingray = cvCreateImage(cvSize(cols,lines), IPL_DEPTH_8U, 1);
        outgray = cvCreateImage(cvSize(cols,lines), IPL_DEPTH_8U, 1);
        outfloat = cvCreateImageHeader(cvSize(cols,lines), IPL_DEPTH_32F, 1);
                
        portIn.open(getName("in"));

        portOut = new BufferedPort<ImageOf<PixelMono> >[levels];
        for( i = 1; i <= levels; i++ )
        {
            sprintf(portname, "out:%d", i);
            portOut[i-1].open(getName(portname));
        }
        return true;
    };
开发者ID:xufango,项目名称:contrib_bk,代码行数:38,代码来源:scalespace.cpp

示例13: open

bool fakeMotorDeviceServer::open(Searchable &config)
{
    printf("Opening Fake Motor Device Server ...\n");

    string local=config.check("local",Value("/fakeyServer")).asString().c_str();
    int Ts=config.check("Ts",Value(10)).asInt();

    statePort.open((local+"/state:o").c_str());
    cmdPort.open((local+"/cmd:i").c_str());
    rpcPort.open((local+"/rpc").c_str());
    rpcPort.setReader(*this);
 
    // the part is composed of three rotational joints
    // whose bounds are given in degrees just below
    Matrix lim(3,2);
    lim(0,0)=-180.0; lim(0,1)=180.0;    // joint 0
    lim(1,0)=-90.0;  lim(1,1)=90.0;     // joint 1
    lim(2,0)=-45.0;  lim(2,1)=45.0;     // joint 2

    Vector q0;
    for (int i=0; i<lim.rows(); i++)
        q0.push_back((lim(i,0)+lim(i,1))/2.0);

    // the motors themselves are represented
    // by pure integrators that give back joints
    // positions when fed with joints velocities
    motors=new Integrator(0.001*Ts,q0,lim);
    vel.resize(motors->get().length(),0.0);        

    setRate(Ts);
    start();

    configured=true;

    printf("Fake Motor Device Server successfully open\n");
    return true;
}
开发者ID:towardthesea,项目名称:icub-tutorials,代码行数:37,代码来源:fakeMotorDeviceServer.cpp

示例14: open

bool AcousticMap::open(Searchable& config) {

    bool ok = true;

    if(!config.check("name")) {
        std::cout << "AuditoryMap: Error, module base name not found in configuration. Start the module with the --name option.." << std::endl;
        return false;
    }

    // module base name
    std::string strModuleName = std::string(config.find("name").asString().c_str());

    // look for group EGO_SPHERE_ACOUSTIC_MAP
    Bottle botConfigAcoustic(config.toString().c_str());
    botConfigAcoustic.setMonitor(config.getMonitor());
    if (!config.findGroup("EGO_SPHERE_ACOUSTIC_MAP").isNull()) {
        botConfigAcoustic.clear();
        botConfigAcoustic.fromString(config.findGroup("EGO_SPHERE_ACOUSTIC_MAP", "Loading visual map configuration  from group EGO_SPHERE_ACOUSTIC_MAP.").toString());
    }

    _salienceDecayRate = botConfigAcoustic.check("decayAcoustic",
                         Value(0.95),
                         "Decay for the acoustic saliency map (double).").asDouble();
    _resXAcoustic = botConfigAcoustic.check("resXAcoustic",
                                            Value(80),
                                            "Width of internal acoustic map (int)").asInt();
    _resYAcoustic = botConfigAcoustic.check("resYAcoustic",
                                            Value(60),
                                            "Height of internal acoustic map (int)").asInt();
    _imgCart.resize(_resXAcoustic,_resYAcoustic);
    _imgRemapX.resize(_resXAcoustic,_resYAcoustic);
    _imgRemapY.resize(_resXAcoustic,_resYAcoustic);
    _imgSpher.resize(_resXAcoustic,_resYAcoustic);
    _imgMapResA.resize(_resXAcoustic,_resYAcoustic);

    ok = ok && _prtVctSound.open(std::string(strModuleName + std::string("/mapAuditory/vct_in")).c_str());

    return ok;
}
开发者ID:xufango,项目名称:contrib_bk,代码行数:39,代码来源:AcousticMap.cpp

示例15: open

bool ClientCartesianController::open(Searchable &config)
{
    ConstString remote, local, carrier;

    if (config.check("remote"))
        remote=config.find("remote").asString();
    else
        return false;

    if (config.check("local"))
        local=config.find("local").asString();
    else
        return false;
    
    carrier=config.check("carrier",Value("udp")).asString();

    if (config.check("timeout"))
        timeout=config.find("timeout").asDouble();

    portCmd.open((local+"/command:o").c_str());
    portState.open((local+"/state:i").c_str());
    portEvents.open((local+"/events:i").c_str());
    portRpc.open((local+"/rpc:o").c_str());

    bool ok=true;
    ok&=Network::connect(portRpc.getName().c_str(),(remote+"/rpc:i").c_str());
    if (ok)
    {
        Bottle info;
        getInfoHelper(info);
        if (info.check("server_version"))
        {
            double server_version=info.find("server_version").asDouble();
            if (server_version!=CARTCTRL_CLIENT_VER)
            {
                yError("version mismatch => server(%g) != client(%g); please update accordingly",
                       server_version,CARTCTRL_CLIENT_VER);
                return false;
            }
        }
        else
            yWarning("unable to retrieve server version; please update the server");
    }
    else
    {
        yError("unable to connect to the server rpc port!");
        return false;
    }

    ok&=Network::connect(portCmd.getName().c_str(),(remote+"/command:i").c_str(),carrier.c_str());
    ok&=Network::connect((remote+"/state:o").c_str(),portState.getName().c_str(),carrier.c_str());
    ok&=Network::connect((remote+"/events:o").c_str(),portEvents.getName().c_str(),carrier.c_str());    

    // check whether the solver is alive and connected
    if (ok)
    {
        Bottle command, reply;
    
        command.addVocab(IKINCARTCTRL_VOCAB_CMD_GET);
        command.addVocab(IKINCARTCTRL_VOCAB_OPT_ISSOLVERON);
    
        if (!portRpc.write(command,reply))
        {
            yError("unable to get reply from server!");
            close();

            return false;
        }

        if (reply.get(0).asVocab()==IKINCARTCTRL_VOCAB_REP_ACK)
            if (reply.size()>1)
                if (reply.get(1).asVocab()==IKINCARTCTRL_VOCAB_VAL_TRUE)
                    return connected=true;

        yError("unable to connect to solver!");
        close();

        return false;
    }
    else
    {
        yError("unable to connect to server!");
        close();

        return false;
    }
}
开发者ID:francesco-romano,项目名称:icub-main,代码行数:87,代码来源:ClientCartesianController.cpp


注:本文中的Searchable::check方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。