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


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

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


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

示例1: configureFromProperty

bool PortMonitor::configureFromProperty(yarp::os::Property& options) {
    if(binder) delete binder;
    binder = nullptr;

    std::string script = options.check("type", Value("lua")).asString();
    std::string filename = options.check("file", Value("modifier")).asString();
    std::string constraint = options.check("constraint", Value("")).asString();
    // context is used to find the script files
    std::string context = options.check("context", Value("")).asString();

    // check which monitor should be used
    if((binder = MonitorBinding::create(script.c_str())) == nullptr)
    {
         yError(R"(Currently only 'lua' script and 'dll' object is supported by portmonitor)");
         return false;
    }

    // set the acceptance constraint
    binder->setAcceptConstraint(constraint.c_str());

    std::string strFile = filename;

    if(script != "dll")
    {
        yarp::os::ResourceFinder rf;
        rf.setDefaultContext(context.c_str());
        rf.configure(0, nullptr);
        strFile = rf.findFile(filename);
        if(strFile == "")
            strFile = rf.findFile(filename+".lua");
    }
开发者ID:robotology,项目名称:yarp,代码行数:31,代码来源:PortMonitor.cpp

示例2: setup

bool CameraTest::setup(yarp::os::Property& property) {

    if(property.check("name"))
        setName(property.find("name").asString());

    // updating parameters
    RTF_ASSERT_ERROR_IF(property.check("portname"),
                        "The portname must be given as the test paramter!");
    cameraPortName = property.find("portname").asString();
    measure_time = property.check("measure_time") ? property.find("measure_time").asInt() : TIMES;
    expected_frequency = property.check("expected_frequency") ? property.find("expected_frequency").asInt() : FREQUENCY;
    tolerance = property.check("tolerance") ? property.find("tolerance").asInt() : TOLERANCE;

    // opening port
    RTF_ASSERT_ERROR_IF(port.open("/CameraTest/image:i"),
                        "opening port, is YARP network available?");

    RTF_TEST_REPORT(Asserter::format("Listening to camera for %d seconds",
                                       measure_time));

    // connecting
    RTF_TEST_REPORT(Asserter::format("connecting from %s to %s",
                                       port.getName().c_str(), cameraPortName.c_str()));
    RTF_ASSERT_ERROR_IF(Network::connect(cameraPortName, port.getName()),
                     "could not connect to remote port, camera unavailable");
    return true;
}
开发者ID:nunoguedelha,项目名称:icub-tests,代码行数:27,代码来源:CameraTest.cpp

示例3: setup

bool OpenLoopConsistency::setup(yarp::os::Property& property) {

    // updating parameters
    RTF_ASSERT_ERROR_IF(property.check("robot"), "The robot name must be given as the test parameter!");
    RTF_ASSERT_ERROR_IF(property.check("part"), "The part name must be given as the test parameter!");
    RTF_ASSERT_ERROR_IF(property.check("joints"), "The joints list must be given as the test parameter!");
    RTF_ASSERT_ERROR_IF(property.check("zero"),    "The zero position must be given as the test parameter!");

    robotName = property.find("robot").asString();
    partName = property.find("part").asString();

    zero = property.find("zero").asDouble();

    Bottle* jointsBottle = property.find("joints").asList();
    RTF_ASSERT_ERROR_IF(jointsBottle!=0,"unable to parse joints parameter");
    n_cmd_joints = jointsBottle->size();
    RTF_ASSERT_ERROR_IF(n_cmd_joints>0,"invalid number of joints, it must be >0");

    Property options;
    options.put("device", "remote_controlboard");
    options.put("remote", "/"+robotName+"/"+partName);
    options.put("local", "/OpenLoopConsistencyTest/"+robotName+"/"+partName);

    dd = new PolyDriver(options);
    RTF_ASSERT_ERROR_IF(dd->isValid(),"Unable to open device driver");
    RTF_ASSERT_ERROR_IF(dd->view(iopl),"Unable to open openloop interface");
    RTF_ASSERT_ERROR_IF(dd->view(ienc),"Unable to open encoders interface");
    RTF_ASSERT_ERROR_IF(dd->view(iamp),"Unable to open ampliefier interface");
    RTF_ASSERT_ERROR_IF(dd->view(ipos),"Unable to open position interface");
    RTF_ASSERT_ERROR_IF(dd->view(icmd),"Unable to open control mode interface");
    RTF_ASSERT_ERROR_IF(dd->view(iimd),"Unable to open interaction mode interface");

    if (!ienc->getAxes(&n_part_joints))
    {
        RTF_ASSERT_ERROR("unable to get the number of joints of the part");
    }

    if      (n_part_joints<=0)
        RTF_ASSERT_ERROR("Error this part has in invalid (<=0) number of jonits");
    else if (jointsBottle->size() == 1)
        cmd_mode=single_joint;
    else if (jointsBottle->size() < n_part_joints)
        cmd_mode=some_joints;
    else if (jointsBottle->size() == n_part_joints)
        cmd_mode=all_joints;
    else
        RTF_ASSERT_ERROR("invalid joint selection?");

    cmd_tot = new double[n_part_joints];
    pos_tot=new double[n_part_joints];
    jointsList=new int[n_cmd_joints];
    cmd_some=new double[n_cmd_joints];
    prevcurr_tot=new double[n_part_joints];
    prevcurr_some=new double[n_cmd_joints];
    for (int i=0; i <n_cmd_joints; i++) jointsList[i]=jointsBottle->get(i).asInt();

    return true;
}
开发者ID:Karma-Revolutions,项目名称:icub-tests,代码行数:58,代码来源:OpenloopConsistency.cpp

示例4: setup

bool ExampleTest::setup(yarp::os::Property &property) {

    // initialization goes here ...
    //updating the test name
    if(property.check("name"))
        setName(property.find("name").asString());

    string example = property.check("example", Value("default value")).asString();

    RTF_TEST_REPORT(Asserter::format("Use '%s' for the example param!",
                                       example.c_str()));
    return true;
}
开发者ID:Karma-Revolutions,项目名称:icub-tests,代码行数:13,代码来源:ExampleTest.cpp

示例5: configureFromProperty

bool PortMonitor::configureFromProperty(yarp::os::Property& options) {
    if(binder) delete binder;
    binder = NULL;

    ConstString script = options.check("type", Value("lua")).asString();
    ConstString filename = options.check("file", Value("modifier")).asString();
    ConstString constraint = options.check("constraint", Value("")).asString();
    // context is used to find the script files
    ConstString context = options.check("context", Value("")).asString();

    // check which monitor should be used
    if((binder = MonitorBinding::create(script.c_str())) == NULL)
    {
         yError("Currently only \'lua\' script and \'dll\' object is supported by portmonitor");
         return false;
    }

    // set the acceptance constraint
    binder->setAcceptConstraint(constraint.c_str());

    ConstString strFile = filename;

    if(script != "dll")
    {
        yarp::os::ResourceFinder rf;
        rf.setDefaultContext(context.c_str());
        rf.configure(0, NULL);
        strFile = rf.findFile(filename.c_str());
        if(strFile == "")
            strFile = rf.findFile(filename+".lua");
    }

    // provide some useful information for the monitor object
    // which can be accessed in the create() callback.
    Property info;
    info.clear();
    info.put("filename", strFile);
    info.put("type", script);
    info.put("source", options.find("source").asString());
    info.put("destination", options.find("destination").asString());
    info.put("sender_side",  options.find("sender_side").asInt());
    info.put("receiver_side",options.find("receiver_side").asInt());
    info.put("carrier", options.find("carrier").asString());

    PortMonitor::lock();
    bReady =  binder->load(info);
    PortMonitor::unlock();
    return bReady;
    return false;
}
开发者ID:silasxue,项目名称:yarp,代码行数:50,代码来源:PortMonitor.cpp

示例6: setJointSensorsType

bool GazeboYarpJointSensorsDriver::setJointSensorsType(yarp::os::Property & pluginParameters)  //WORKS
{
    std::cout << ".ini file found, using joint names in ini file" << std::endl;
    
    std::string parameter_name = "gazeboJointSensorsType";
    
    if(!pluginParameters.check(parameter_name.c_str())) {
        std::cout << "GazeboYarpJointSensorsDriver::setJointSensorsType() error: cannot find " << parameter_name << " parameter." << std::endl;
        return false;
    }
    
    std::string sensors_type = pluginParameters.find(parameter_name.c_str()).asString().c_str();
    
    if( sensors_type == "position" ) {
        jointsensors_type = Position;
    } else if ( sensors_type == "speed" ) {
        jointsensors_type = Speed;
    } else if ( sensors_type == "torque" ) {
        jointsensors_type = Torque;
    } else {
        std::cerr << "GazeboYarpJointSensorsDriver::setJointSensorsType() error: sensor type " << sensors_type << " not recognized." << std::endl
                  << "\t\tThe available types are position, speed and torque." << std::endl;
        return false;
    }
    
    return true;
}
开发者ID:hu-yue,项目名称:gazebo-yarp-plugins,代码行数:27,代码来源:JointSensorsDriver.cpp

示例7: initOutport

void SkinGroup::initOutport(yarp::os::Property &config)
{
  std::string outPortName = config.check("out_port", yarp::os::Value("/outport"), "").asString().c_str();
  
  std::cout << "Out Port name ==>" << outPortName << std::endl;
  classificationOutport.open(outPortName.c_str());
}
开发者ID:jizecn,项目名称:my_humanoid_robot,代码行数:7,代码来源:SkinGroup.cpp

示例8: periodInMilliSeconds

// *********************************************************************************************************************
// *********************************************************************************************************************
//                                          ICUB WHOLE BODY DYNAMICS ESTIMATOR
// *********************************************************************************************************************
// *********************************************************************************************************************
ExternalWrenchesAndTorquesEstimator::ExternalWrenchesAndTorquesEstimator(int _period,
                                                               yarpWholeBodySensors *_sensors,
                                                               yarp::os::BufferedPort<iCub::skinDynLib::skinContactList> * _port_skin_contacts,
                                                               yarp::os::Property & _wbi_yarp_conf
                                                              )
:  periodInMilliSeconds(_period),
   sensors(_sensors),
   port_skin_contacts(_port_skin_contacts),
   enable_omega_domega_IMU(false),
   min_taxel(0),
   wbi_yarp_conf(_wbi_yarp_conf),
   assume_fixed_base_from_odometry(false)
{

    resizeAll(sensors->getSensorNumber(SENSOR_ENCODER));
    resizeFTs(sensors->getSensorNumber(SENSOR_FORCE_TORQUE));
    resizeIMUs(sensors->getSensorNumber(SENSOR_IMU));


    ///< Skin timestamp
    last_reading_skin_contact_list_Stamp = -1000.0;

    if( _wbi_yarp_conf.check("fixed_base") )
    {
        assume_fixed_base = true;
        fixed_link = _wbi_yarp_conf.find("fixed_base").asString();
    }
    else
    {
        assume_fixed_base = false;
    }

    if( _wbi_yarp_conf.check("assume_fixed_from_odometry") )
    {
        this->assume_fixed_base_from_odometry = true;
    }
}
开发者ID:fjandrad,项目名称:codyco-modules,代码行数:42,代码来源:wholeBodyDynamicsStatesInterfaces.cpp

示例9: initSensors

bool SkinGroup::initSensors(yarp::os::Property &config)
{

    yarp::os::Bottle skinfiles = config.findGroup("parts").tail();

    yarp::os::ConstString skinFilePath = config.check("skinsensorpath", yarp::os::Value("C:/roboskin/software_yarp_related/iCub/app/kaspar/conf"), "specifiy skinsensor config file path").asString();
//    yarp::os::ConstString skinFilePath = config.check("skinsensorfilepath", yarp::os::Value("C:/roboskin/software_yarp_related/iCub/app/kaspar/conf"), "specifiy skinsensor config file path").asString();
    
    printf("==== %s   %d \n", skinFilePath.c_str(), skinfiles.size());
    for(int i = 0; i < skinfiles.size(); i++)
    {
        yarp::os::Property skinproperty;
        yarp::os::Bottle sensorConf(skinfiles.get(i).toString());
        if(skinproperty.fromConfigFile((skinFilePath + FILESEPARATOR + sensorConf.get(0).asString())))
        {
            // put new attribute ifLog to the property before initialising skin sensors
            //if(ifLogData)
            //{
            //    skinproperty.put("logdata", ifLogData);
            //    skinproperty.put("logfilepath", logpath.c_str());
            //}
			
            SkinBodyPart *sk = new SkinBodyPart(skinproperty);   // assuming property file is correct. No error checking and return. so be very careful
            sk->setPortToConnect(sensorConf.get(1).asString());
            
            if(sk->initConfiguration())
            {
                this->skinParts.push_back(sk);
            }
            else
            {
                delete sk;
				return false;
            }
		}
        else
        {
            fprintf(stderr, "Error loading skin sensor config file %s\n", sensorConf.get(0).asString().c_str());
			return false;
        }
    }
	return true;
}
开发者ID:jizecn,项目名称:my_humanoid_robot,代码行数:43,代码来源:SkinGroup.cpp

示例10: initConfiguration

bool SkinGroup::initConfiguration(yarp::os::Property &conf) {
  
  //int s = conf.size();
  //this->groupName = conf.get(0).asString().c_str();
  
  yarp::os::Value v = conf.find("groupname");
  
  if(v.isNull()) {
    printf("Not Group Name specified\n");
    return false;
  }
  else {
    this->groupName = v.asString().c_str();
  }
  
  
  initLogFile(conf);
  
  yarp::os::Value v2 = conf.find("parts");
  
  if(v2.isNull()) {
    return false;
  }
  else {
    // add all parts to this group
    
    if(!initSensors(conf)) {
      cerr << "ERROR: initSensors error. (SkinGroup)" << endl;
      return false;
    }
  }
  
  /*
    for (int j = 1; j < conf.size(); j++)
    {
    cout << conf.get(j).asString() << endl;
    int k = 0;
    for (k = 0; k < parts->size(); k++)
    {
    if (parts->at(k)->getPartName() == string(
    conf.get(j).asString().c_str()))
    {
    cout << "part : " << parts->at(k)->getPartName().c_str()
    << " is found and added to SkinGroup  "
    << this->groupName << endl;
    this->skinParts.push_back(parts->at(k));
    break;
    }
    }
    if (k == parts->size())
		{
		// Not found. Error
		cerr << "Sensor " << conf.get(j).asString().c_str()
		<< " for group " << this->groupName << " is not available."
					<< endl;
			return false;
		}
	}
	// not necessary. just to double check
	if (this->skinParts.size() != conf.size() - 1)
	{
		// Not found. Error
		cerr << "Not all sensors in sensorgroup " << this->groupName
				<< " are available. Check the config files" << endl;
		return false;
	}
  */
  cout << "OK. Sensors added for sensorgroup " << this->groupName << endl;
  
  // init other settings, e.g. offsets for each sensor in the whole data set
  
  taxelDimension = 0;
  for (size_t k = 0; k < skinParts.size(); k++)
    {
      offsets.push_back(taxelDimension);
      taxelDimension += skinParts[k]->getAllNumTaxels();
    }
  
  // other variables
  
  tempTactileData = new TactileData(taxelDimension);
  
  // load svm model file
  // TODO:
  yarp::os::ConstString _svmmodelfile = conf.find("svmmodel").asString();
  _svmmodelfile = conf.check("svmmodelfilepath", yarp::os::Value("traindata"), "").asString() + FILESEPARATOR + _svmmodelfile;
  
  this->svmmodelfile = _svmmodelfile.c_str();
  
  cout << "SKINGROUP : " << this->groupName << " has " << this->taxelDimension << " taxels" << endl;
  //this->classification = new TactileClassificationRawData(this->taxelDimension);
  this->classification = new TactileClassificationHist(this->taxelDimension);
  if(!this->classification->loadSVMModel(svmmodelfile.c_str()))
    {
      cout << "ERROR: cannot load SVMModel file " << svmmodelfile.c_str() << endl;
      return false;
    }
  
  yarp::os::Property custProp;
  custProp.put("normalisation", "none");
//.........这里部分代码省略.........
开发者ID:jizecn,项目名称:my_humanoid_robot,代码行数:101,代码来源:SkinGroup.cpp

示例11: initLogFile

bool SkinGroup::initLogFile(yarp::os::Property &config)
{

  ifLogData = config.check("logdata");
  std::string logPath = config.check("logfilepath", yarp::os::Value("logs"), "specify log file path for data logging if logdata flag is specified").asString().c_str();
  

  // if log data to file
  //		ifLogData = config.check("logdata");
  yarp::os::Value nameValue = config.find("childName");
    //yarp::os::Value logPathValue = config.find("logfilepath");
    std::string childName = "";
      //string logpath = ""; //config.find("logfilepath").asString().c_str();
      
      if(!nameValue.isNull()) {
	childName = nameValue.asString().c_str();
	printf("Child name is %s\n", childName.c_str());
      }
      //if(!logPathValue.isNull())
      //{
	//	logpath = logPathValue.asString().c_str();
      printf("Log File Path is 5s\n", logPath.c_str());
      //}
      if(ifLogData) {
	time_t rawtime;
	struct tm * timeinfo;
	time ( &rawtime );
	timeinfo = localtime ( &rawtime );
	  std::string timeText = to_string(timeinfo->tm_sec) + "_" + to_string(timeinfo->tm_min) + "_" + to_string(timeinfo->tm_hour) + "_" + to_string(timeinfo->tm_mday)+ "_" + to_string(timeinfo->tm_mon + 1)+ "_" + to_string(timeinfo->tm_year + 1900);//asctime(timeinfo);

	  if(childName != "") {
	    logFile = this->getGroupName() + "_" + childName + "_" + timeText;
	  }
	  else {
	    logFile = this->getGroupName() + "_" + timeText;
	  }
	  
	  if(logPath != "") {
	    logFile = (logPath + FILESEPARATOR + logFile).c_str();
	  }
	  
	  printf("LOG DATA of part %s\n", logFile.c_str());
	  pLogFile =  fopen (logFile.c_str() , "w");
	  
	  if (pLogFile == NULL) {
	    fprintf(stderr, "Error opening file %s\n", logFile.c_str());
	    fprintf(stderr, "Log File disabled\n");
	    ifLogData = false;
	  }
	  else {
	    // write head info. 
	    
	    this->logText("version", "0.1");
	    
	    this->logText("partname", this->getGroupName().c_str());
	    
	    //int dim = this->sensorsNum*12;
	    //std::string s;
	    //std::stringstream out;
	    //out << dim;
	    //s = out.str();
	    //this->logText("dimension", s.c_str());
	  }
      }
      else {
	printf("NOT LOG DATA\n");
      }
      return ifLogData;
}
开发者ID:jizecn,项目名称:my_humanoid_robot,代码行数:69,代码来源:SkinGroup.cpp

示例12: debug

YarpScope::SimpleLoader::SimpleLoader(/* FIXME const */ yarp::os::Property &options, bool *ok)
{
    YarpScope::PortReader &portReader = YarpScope::PortReader::instance();
    YarpScope::PlotManager &plotManager = YarpScope::PlotManager::instance();

    Glib::ustring graph_remote, local_port, connection_carrier;
    bool connection_persistent;

    if (!options.check("remote")) {
        debug() << "Missing \"remote\" argument. Will wait for external connection";
    } else {
        graph_remote = options.find("remote").toString().c_str();
    }

    local_port = default_local_port;

    if (options.check("carrier")) {
        connection_carrier = options.find("carrier").asString().c_str();
    } else {
        connection_carrier = default_connection_carrier;
    }

    // TODO read from command line whether connections should be persistent or not
    connection_persistent = default_connection_persistent;


    if (!options.check("index")) {
        warning() << "Missing \"index\" argument. Will use index = 0";
    }
    const yarp::os::Value &indexValue = options.find("index");

    Glib::ustring plot_title, plot_bgcolor;
    int plot_size;
    float plot_minval, plot_maxval;
    bool plot_autorescale, plot_realtime, plot_triggermode;

    if (options.check("plot_title")) {
        plot_title = options.find("plot_title").toString().c_str();
    } else {
        plot_title = graph_remote;
    }

    if (options.check("min")) {
        plot_minval = (float)options.find("min").asDouble();
    } else {
        plot_minval = default_plot_minval;
    }

    if (options.check("max")) {
        plot_maxval = (float)options.find("max").asDouble();
    } else {
        plot_maxval = default_plot_maxval;
    }

    if (options.check("size")) {
        plot_size = options.find("size").asInt();
    } else {
        plot_size = default_plot_size;
    }

    if (options.check("bgcolor")) {
        plot_bgcolor = options.find("bgcolor").asString().c_str();
    }

    plot_autorescale = options.check("autorescale");

    // TODO enable realtime mode
    plot_realtime = options.check("realtime");
    (void)plot_realtime; // UNUSED

    // TODO enable trigger mode
    plot_triggermode = options.check("triggermode");
    (void)plot_triggermode; // UNUSED

    int plotIndex = plotManager.addPlot(plot_title, 0, 0, 1, 1, plot_minval, plot_maxval, plot_size, plot_bgcolor, plot_autorescale);


    Glib::ustring graph_title, graph_color, graph_type;
    int graph_index, graph_size;

    if (!indexValue.isList()) {

        graph_index = indexValue.asInt();

        if (options.check("graph_title")) {
            if (options.find("graph_title").isList()) {
                error() << "\"graph_title\" and \"index\" arguments should have the same number of elements";
                *ok = false;
                return;
            }
            graph_title = options.find("graph_title").toString().c_str();
        }

        if (options.check("color")) {
            if (options.find("color").isList()) {
                error() << "\"color\" and \"index\" arguments should have the same number of elements";
                *ok = false;
                return;
            }
            graph_color = options.find("color").toString().c_str();
//.........这里部分代码省略.........
开发者ID:paulfitz,项目名称:yarp,代码行数:101,代码来源:SimpleLoader.cpp

示例13: init

/*! \brief Init the application with the current configuration.
 *
 *  \param config the configuration
 */
void MainWindow::init(yarp::os::Property config)
{
    this->config = config;

    string basepath=config.check("ymanagerini_dir", yarp::os::Value("")).asString().c_str();

    if(config.check("modpath")) {
        string strPath;
        string modPaths(config.find("modpath").asString().c_str());
        while (modPaths!="") {
            string::size_type pos=modPaths.find(";");
            strPath=modPaths.substr(0, pos);
            yarp::manager::trimString(strPath);
            if (!isAbsolute(strPath.c_str()))
                strPath=basepath+strPath;
            if((strPath.rfind(PATH_SEPERATOR)==string::npos) ||
                    (strPath.rfind(PATH_SEPERATOR)!=strPath.size()-1))
                strPath = strPath + string(PATH_SEPERATOR);
            lazyManager.addModules(strPath.c_str());
            if (pos==string::npos || pos==0)
                break;
            modPaths=modPaths.substr(pos+1);
        }
    }

    if(config.check("respath")) {
        string strPath;
        string resPaths(config.find("respath").asString().c_str());
        while (resPaths!="") {
            string::size_type pos=resPaths.find(";");
            strPath=resPaths.substr(0, pos);
            yarp::manager::trimString(strPath);
            if (!isAbsolute(strPath.c_str()))
                strPath=basepath+strPath;

            if((strPath.rfind(PATH_SEPERATOR)==string::npos) ||
                    (strPath.rfind(PATH_SEPERATOR)!=strPath.size()-1))
                strPath = strPath + string(PATH_SEPERATOR);

            lazyManager.addResources(strPath.c_str());
            if (pos==string::npos)
                break;
            resPaths=resPaths.substr(pos+1);
        }
    }

    yarp::manager::ErrorLogger* logger  = yarp::manager::ErrorLogger::Instance();


    if(config.check("apppath")) {
        string strPath;
        string appPaths(config.find("apppath").asString().c_str());
        while (appPaths!="") {
            string::size_type pos=appPaths.find(";");
            strPath=appPaths.substr(0, pos);
            yarp::manager::trimString(strPath);
            if (!isAbsolute(strPath.c_str())) {
                strPath=basepath+strPath;
            }

            if((strPath.rfind(PATH_SEPERATOR)==string::npos) ||
                    (strPath.rfind(PATH_SEPERATOR)!=strPath.size()-1)) {
                strPath = strPath + string(PATH_SEPERATOR);
            }

            if(config.find("load_subfolders").asString() == "yes") {
                if(!loadRecursiveApplications(strPath.c_str())) {
                    logger->addError("Cannot load the applications from  " + strPath);
                }
                loadRecursiveTemplates(strPath.c_str());
            }
            else {
                lazyManager.addApplications(strPath.c_str());
            }
            if (pos==string::npos) {
                break;
            }
            appPaths=appPaths.substr(pos+1);
        }
    }

    if (config.check("templpath")) {
        string strPath;
        string templPaths(config.find("templpath").asString().c_str());
        while (templPaths!="") {
            string::size_type pos=templPaths.find(";");
            strPath=templPaths.substr(0, pos);
            yarp::manager::trimString(strPath);
            if (!isAbsolute(strPath.c_str())) {
                strPath=basepath+strPath;
            }

            if(!loadRecursiveTemplates(strPath.c_str())) {
                logger->addError("Cannot load the templates from  " + strPath);
            }

//.........这里部分代码省略.........
开发者ID:JoErNanO,项目名称:qtyarp,代码行数:101,代码来源:mainwindow.cpp

示例14: init

/*! \brief Init the application with the current configuration.
 *
 *  \param config the configuration
 */
void MainWindow::init(yarp::os::Property config)
{
    this->config = config;

    string basepath=config.check("ymanagerini_dir", yarp::os::Value("")).asString().c_str();
    templateList.clear();

    if(config.check("modpath")){
        string strPath;
        string modPaths(config.find("modpath").asString().c_str());
        while (modPaths!=""){
            string::size_type pos=modPaths.find(";");
            strPath=modPaths.substr(0, pos);
            yarp::manager::trimString(strPath);
            if (!isAbsolute(strPath.c_str()))
                strPath=basepath+strPath;
            if((strPath.rfind(PATH_SEPERATOR)==string::npos) ||
            (strPath.rfind(PATH_SEPERATOR)!=strPath.size()-1))
                strPath = strPath + string(PATH_SEPERATOR);
            lazyManager.addModules(strPath.c_str());
            if (pos==string::npos || pos==0)
                break;
            modPaths=modPaths.substr(pos+1);
        }
    }

    if(config.check("respath")){
        string strPath;
        string resPaths(config.find("respath").asString().c_str());
        while (resPaths!=""){
            string::size_type pos=resPaths.find(";");
            strPath=resPaths.substr(0, pos);
            yarp::manager::trimString(strPath);
            if (!isAbsolute(strPath.c_str()))
                strPath=basepath+strPath;

            if((strPath.rfind(PATH_SEPERATOR)==string::npos) ||
            (strPath.rfind(PATH_SEPERATOR)!=strPath.size()-1))
                strPath = strPath + string(PATH_SEPERATOR);

            lazyManager.addResources(strPath.c_str());
            if (pos==string::npos)
                break;
            resPaths=resPaths.substr(pos+1);
        }
    }

    yarp::manager::ErrorLogger* logger  = yarp::manager::ErrorLogger::Instance();

    if(config.check("apppath")){
        string strPath;
        string appPaths(config.find("apppath").asString().c_str());
        while (appPaths!=""){
            string::size_type pos=appPaths.find(";");
            strPath=appPaths.substr(0, pos);
            yarp::manager::trimString(strPath);
            if (!isAbsolute(strPath.c_str())){
                strPath=basepath+strPath;
            }

            if((strPath.rfind(PATH_SEPERATOR)==string::npos) ||
                (strPath.rfind(PATH_SEPERATOR)!=strPath.size()-1)){
                    strPath = strPath + string(PATH_SEPERATOR);
            }

            if(config.find("load_subfolders").asString() == "yes"){
                if(!loadRecursiveApplications(strPath.c_str())){
                    logger->addError("Cannot load the applications from  " + strPath);
                }                
                loadRecursiveTemplates(strPath.c_str());
                std::sort(templateList.begin(),
                          templateList.end(), AppTemplateCompare);
                std::vector<yarp::manager::AppTemplate>::iterator itr;
                for(itr=templateList.begin(); itr!=templateList.end(); itr++)
                    ui->entitiesTree->addAppTemplate(&(*itr));
            }
            else{
                lazyManager.addApplications(strPath.c_str());
            }
            if (pos==string::npos){
                break;
            }
            appPaths=appPaths.substr(pos+1);
        }
    }

    if (config.check("templpath")){
        string strPath;
        string templPaths(config.find("templpath").asString().c_str());
        while (templPaths!=""){
            string::size_type pos=templPaths.find(";");
            strPath=templPaths.substr(0, pos);
            yarp::manager::trimString(strPath);
            if (!isAbsolute(strPath.c_str())){
                strPath=basepath+strPath;
            }
//.........这里部分代码省略.........
开发者ID:plinioMoreno,项目名称:yarp,代码行数:101,代码来源:mainwindow.cpp


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