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


C++ xmlrpc::XmlRpcValue类代码示例

本文整理汇总了C++中xmlrpc::XmlRpcValue的典型用法代码示例。如果您正苦于以下问题:C++ XmlRpcValue类的具体用法?C++ XmlRpcValue怎么用?C++ XmlRpcValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: checkAndSetFeature

  void checkAndSetFeature(CamData& cd, string param_name, dc1394feature_t feature)
  {
    string p = cd.name + string("/") + param_name;
    if (has_param(p))
    {
      XmlRpc::XmlRpcValue val;
      get_param(p, val);
      
      if (val.getType() == XmlRpc::XmlRpcValue::TypeString)
        if (val == string("auto"))
          cd.cam->setFeatureMode(feature, DC1394_FEATURE_MODE_AUTO);
        else 
          cd.cam->setFeatureMode(feature, DC1394_FEATURE_MODE_MANUAL);
          
      
      if (val.getType() == XmlRpc::XmlRpcValue::TypeInt)
      {
        cd.cam->setFeatureMode(feature, DC1394_FEATURE_MODE_MANUAL);
        cd.cam->setFeature(feature, (int)(val));
      }

      if (val.getType() == XmlRpc::XmlRpcValue::TypeDouble)
      {
        cd.cam->setFeatureMode(feature, DC1394_FEATURE_MODE_MANUAL);
        cd.cam->setFeatureAbsolute(feature, (double)(val));
      }
    }
  }
开发者ID:janfrs,项目名称:kwc-ros-pkg,代码行数:28,代码来源:dc1394_cam_server.cpp

示例2: checkAndSetWhitebalance

  void checkAndSetWhitebalance(CamData& cd, string param_name, dc1394feature_t feature)
  {
    string p = cd.name + string("/") + param_name;
    string p_b = cd.name + string("/") + param_name + string("_b");
    string p_r = cd.name + string("/") + param_name + string("_r");

    if (has_param(p_b) && has_param(p_r))
    {
      XmlRpc::XmlRpcValue val;
      XmlRpc::XmlRpcValue val_b;
      XmlRpc::XmlRpcValue val_r;

      get_param(p, val);
      get_param(p_b, val_b);
      get_param(p_r, val_r);
      
      if (val.getType() == XmlRpc::XmlRpcValue::TypeString && val == string("auto"))
        cd.cam->setFeatureMode(feature, DC1394_FEATURE_MODE_AUTO);
      else if (val_b.getType() == XmlRpc::XmlRpcValue::TypeInt && val_r.getType() == XmlRpc::XmlRpcValue::TypeInt)
      {
        cd.cam->setFeatureMode(feature, DC1394_FEATURE_MODE_MANUAL);
        cd.cam->setFeature(feature, (int)(val_b), (int)(val_r));
      }
    }
  }
开发者ID:janfrs,项目名称:kwc-ros-pkg,代码行数:25,代码来源:dc1394_cam_server.cpp

示例3: set

 bool set(std::string key, XmlRpc::XmlRpcValue val)
 {
     try
     {
         if (val.getType() == XmlRpc::XmlRpcValue::TypeBoolean){
             bool value = static_cast<bool>(val);
             return (set(key,value));
         }
         if (val.getType() == XmlRpc::XmlRpcValue::TypeDouble){
             double value = static_cast<double>(val);
             return (set(key,value));
         }
         if (val.getType() == XmlRpc::XmlRpcValue::TypeString){
             std::string value = static_cast<std::string>(val);
             return (set(key,value));
         }
         if (val.getType() == XmlRpc::XmlRpcValue::TypeInt){
             int value = static_cast<int>(val);
             return (set(key,value));
         }
     }
     catch (...)
     {
         return false;
     }
     return false;
 }
开发者ID:LucaGemma87,项目名称:pacman_vision,代码行数:27,代码来源:modules_config.hpp

示例4: get

 bool get(std::string key, XmlRpc::XmlRpcValue& val)
 {
     try
     {
         bool v;
         if (get(key,v)){
             XmlRpc::XmlRpcValue vb(v);
             val = vb;
             return (val.valid());
         }
         double vd;
         if (get(key,vd)){
             val = vd;
             return (val.valid());
         }
         int vi;
         if (get(key,vi)){
             val=vi;
             return (val.valid());
         }
         std::string vs;
         if (get(key, vs)){
             val=vs.c_str();
             return (val.valid());
         }
     }
     catch (...)
     {
         return false;
     }
     return false;
 }
开发者ID:LucaGemma87,项目名称:pacman_vision,代码行数:32,代码来源:modules_config.hpp

示例5: while

Path::Path() {
	ros::NodeHandle nh;
	XmlRpc::XmlRpcValue pathCfg;
	nh.getParam("/path", pathCfg);
	try {
		int i = 0;
		do {
			char pointName[256];
			sprintf(pointName, "point%d", i);
			if (!pathCfg.hasMember(pointName))
				break;

			XmlRpc::XmlRpcValue pointCfg = pathCfg[std::string(pointName)];
			geometry_msgs::Point p;
			if (!(pointCfg.hasMember("x") && pointCfg.hasMember("y")))
				continue;

			p.x = FLOAT_PARAM(pointCfg["x"]);
			p.y = FLOAT_PARAM(pointCfg["y"]);
			p.z = 0;

			points.push_back(p);
		} while ((++i) != 0);
	} catch (XmlRpc::XmlRpcException& e) {
		ROS_ERROR("Unable to parse path parameter. (%s)", e.getMessage().c_str());
	}
}
开发者ID:Niggins,项目名称:COMP3431-Assignment1,代码行数:27,代码来源:path.cpp

示例6: execute

void startWorkingCallback::execute (XmlRpc::XmlRpcValue& params, XmlRpc::XmlRpcValue& result)
{
    // if no arguments were received
    if (!params.valid())
    {
        result = ctrl_xmlrpc->startProcessing();
    }
    else
    {
        switch(params.size())
        {
        // start the server in online mode with port and blocksize
        case 2:
            ctrl_xmlrpc->startEegServer((int) params[0], (int) params[1]);
            result = 0;
            break;
        case 3:
            ctrl_xmlrpc->startEegServer((std::string) params[0], (int) params[1], (int) params[2]);
            result = 0;
            break;
        default:
            OMG("WARNING! Server got wrong number of arguments!");
            break;
        }
    }
    fflush(stdout);
}
开发者ID:BioinformaticsArchive,项目名称:pyspace,代码行数:27,代码来源:ctrl_xmlrpc.cpp

示例7: getConfigurationFromParameters

void TeleopCOB::getConfigurationFromParameters()
{
	//std::map<std::string,joint_module> joint_modules; //std::vector<std::string> module_names;
	if(n_.hasParam("modules"))
	{
		XmlRpc::XmlRpcValue modules;
		ROS_DEBUG("modules found ");
		n_.getParam("modules", modules);
		if(modules.getType() == XmlRpc::XmlRpcValue::TypeStruct)
		{
			ROS_DEBUG("modules are of type struct with size %d",(int)modules.size());

			for(std::map<std::string,XmlRpc::XmlRpcValue>::iterator p=modules.begin();p!=modules.end();++p)
			{
				std::string mod_name = p->first;
				ROS_DEBUG("module name: %s",mod_name.c_str());
				XmlRpc::XmlRpcValue mod_struct = p->second;
				if(mod_struct.getType() != XmlRpc::XmlRpcValue::TypeStruct)
					ROS_WARN("invalid module, name: %s",mod_name.c_str());
				// search for joint_name parameter in current module struct to determine which type of module
				// only joint mods or wheel mods supported
				// which mens that is no joint names are found, then the module is a wheel module
				// TODO replace with build in find, but could not get it to work
				if(!assign_joint_module(mod_name, mod_struct))
				{
					// add wheel module struct
					ROS_DEBUG("wheel module found");
					assign_base_module(mod_struct);
				}
			}
		}
	}
}
开发者ID:abubeck,项目名称:cob_apps,代码行数:33,代码来源:cob_teleop.cpp

示例8: getImpl

bool getImpl(const std::string& key, int& i, bool use_cache)
{
  XmlRpc::XmlRpcValue v;
  if (!getImpl(key, v, use_cache))
  {
    return false;
  }

  if (v.getType() == XmlRpc::XmlRpcValue::TypeDouble)
  {
    double d = v;

    if (fmod(d, 1.0) < 0.5)
    {
      d = floor(d);
    }
    else
    {
      d = ceil(d);
    }

    i = d;
  }
  else if (v.getType() != XmlRpc::XmlRpcValue::TypeInt)
  {
    return false;
  }
  else
  {
    i = v;
  }

  return true;
}
开发者ID:rosmod,项目名称:rosmod-comm,代码行数:34,代码来源:rosmod_param.cpp

示例9: setParams

bool DepthImageOccupancyMapUpdater::setParams(XmlRpc::XmlRpcValue &params)
{
  try
  {
    sensor_type_ = (std::string) params["sensor_type"];
    if (params.hasMember("image_topic"))
      image_topic_ = (std::string) params["image_topic"];
    if (params.hasMember("queue_size"))
      queue_size_ = (int)params["queue_size"];
    
    readXmlParam(params, "near_clipping_plane_distance", &near_clipping_plane_distance_);
    readXmlParam(params, "far_clipping_plane_distance", &far_clipping_plane_distance_);
    readXmlParam(params, "shadow_threshold", &shadow_threshold_);
    readXmlParam(params, "padding_scale", &padding_scale_);
    readXmlParam(params, "padding_offset", &padding_offset_);
    readXmlParam(params, "skip_vertical_pixels", &skip_vertical_pixels_);
    readXmlParam(params, "skip_horizontal_pixels", &skip_horizontal_pixels_);
  }
  catch (XmlRpc::XmlRpcException &ex)
  {
    ROS_ERROR("XmlRpc Exception: %s", ex.getMessage().c_str());
    return false;
  }
  
  return true;
}
开发者ID:mpomarlan,项目名称:moveit_puzzle_demo,代码行数:26,代码来源:depth_image_occupancy_map_updater.cpp

示例10: setParams

 bool PointCloudMoveitFilter::setParams(XmlRpc::XmlRpcValue &params)
 {
   try
   {
     if (!params.hasMember("point_cloud_topic"))
       return false;
     point_cloud_topic_ = static_cast<const std::string&>(params["point_cloud_topic"]);
     
     readXmlParam(params, "max_range", &max_range_);
     readXmlParam(params, "padding_offset", &padding_);
     readXmlParam(params, "padding_scale", &scale_);
     readXmlParam(params, "point_subsample", &point_subsample_);
     if (!params.hasMember("filtered_cloud_topic")) {
       ROS_ERROR("filtered_cloud_topic is required");
       return false;
     }
     else {
       filtered_cloud_topic_ = static_cast<const std::string&>(params["filtered_cloud_topic"]);
     }
     if (params.hasMember("filtered_cloud_use_color")) {
       use_color_ = (bool)params["filtered_cloud_use_color"];
     }
     if (params.hasMember("filtered_cloud_keep_organized")) {
       keep_organized_ = (bool)params["filtered_cloud_keep_organized"];
     }
   }
   catch (XmlRpc::XmlRpcException& ex)
   {
     ROS_ERROR("XmlRpc Exception: %s", ex.getMessage().c_str());
     return false;
   }
   
   return true;
 }
开发者ID:otsubo,项目名称:jsk_recognition,代码行数:34,代码来源:pointcloud_moveit_filter.cpp

示例11: readPoseParam

void FootstepMarker::readPoseParam(ros::NodeHandle& pnh, const std::string param,
                                   tf::Transform& offset) {
  XmlRpc::XmlRpcValue v;
  geometry_msgs::Pose pose;
  if (pnh.hasParam(param)) {
    pnh.param(param, v, v);
    // check if v is 7 length Array
    if (v.getType() == XmlRpc::XmlRpcValue::TypeArray &&
        v.size() == 7) {
      // safe parameter access by getXMLDoubleValue
      pose.position.x = getXMLDoubleValue(v[0]);
      pose.position.y = getXMLDoubleValue(v[1]);
      pose.position.z = getXMLDoubleValue(v[2]);
      pose.orientation.x = getXMLDoubleValue(v[3]);
      pose.orientation.y = getXMLDoubleValue(v[4]);
      pose.orientation.z = getXMLDoubleValue(v[5]);
      pose.orientation.w = getXMLDoubleValue(v[6]);
      // converst the message as following: msg -> eigen -> tf
      //void poseMsgToEigen(const geometry_msgs::Pose &m, Eigen::Affine3d &e);
      Eigen::Affine3d e;
      tf::poseMsgToEigen(pose, e); // msg -> eigen
      tf::transformEigenToTF(e, offset); // eigen -> tf
    }
    else {
      ROS_ERROR_STREAM(param << " is malformed, which should be 7 length array");
    }
  }
  else {
    ROS_WARN_STREAM("there is no parameter on " << param);
  }
}
开发者ID:DaikiMaekawa,项目名称:jsk_visualization,代码行数:31,代码来源:footstep_marker.cpp

示例12: getNodes

bool getNodes(V_string& nodes)
{
  XmlRpc::XmlRpcValue args, result, payload;
  args[0] = this_node::getName();

  if (!execute("getSystemState", args, result, payload, true))
  {
    return false;
  }

  S_string node_set;
  for (int i = 0; i < payload.size(); ++i)
  {
    for (int j = 0; j < payload[i].size(); ++j)
    {
      XmlRpc::XmlRpcValue val = payload[i][j][1];
      for (int k = 0; k < val.size(); ++k)
      {
        std::string name = payload[i][j][1][k];
        node_set.insert(name);
      }
    }
  }

  nodes.insert(nodes.end(), node_set.begin(), node_set.end());

  return true;
}
开发者ID:1ee7,项目名称:micROS-drt,代码行数:28,代码来源:master.cpp

示例13: getDoubleArray

bool FTParamsInternal::getDoubleArray(XmlRpc::XmlRpcValue params, const char* name, double *results, unsigned len)
{
  if(!params.hasMember(name))
  {
    ROS_ERROR("Expected ft_param to have '%s' element", name);
    return false;
  }

  XmlRpc::XmlRpcValue values = params[name];
  if (values.getType() != XmlRpc::XmlRpcValue::TypeArray)
  {
    ROS_ERROR("Expected FT param '%s' to be list type", name);
    return false;
  }
  if (values.size() != int(len))
  {
    ROS_ERROR("Expected FT param '%s' to have %d elements", name, len);
    return false;
  }
  for (unsigned i=0; i<len; ++i)
  {
    if (values[i].getType() != XmlRpc::XmlRpcValue::TypeDouble)
    {
      ROS_ERROR("Expected FT param %s[%d] to be floating point type", name, i);
      return false;
    } else {
      results[i] = static_cast<double>(values[i]);
    }
  }

  return true;
}
开发者ID:PR2,项目名称:pr2_ethercat_drivers,代码行数:32,代码来源:wg06.cpp

示例14: generateConfigVector

/*generateConfigVector stores the pinging sensors, to which pinging sensor is a listening
 * sensor bound to in a cycle and which sensors are not used at all.
 * In the output, the pinging sensors are represented by PINGING_SENSOR, location of
 * each listening sensor holds the address of its corresponding pinging sensor
 * and the sensors not used at all are represented by SENSOR_NOT_USED.
 */
std::vector <std::vector<int> > generateConfigVector(XmlRpc::XmlRpcValue config_list)
{
	std::vector<std::vector<int> > config;
	XmlRpc::XmlRpcValue current_cycle;
	ROS_ASSERT(config_list.getType() == XmlRpc::XmlRpcValue::TypeArray);

	for(int i = 0; i < config_list.size(); i++)
	{
		ROS_ASSERT(config_list[i].getType() == XmlRpc::XmlRpcValue::TypeStruct);
		std::vector<int> cycle_vector; //For holding configuration for each cycle.
		cycle_vector.resize(MAX_SENSORS);
		for (int j=0; j<MAX_SENSORS; j++)
			cycle_vector[j]=SENSOR_NOT_USED;

		//better to keep it dynamic
		for (int j = 0; j<MAX_SENSORS; j++){
			char str_index[3] = {'\0','\0', '\0'}; // for storing int to hex conv. 
			sprintf(str_index,"%d", j); // Unsure if yamlcpp parser reads hexadecimal values
			if(config_list[i].hasMember(str_index))
			{
				cycle_vector[j]=PINGING_SENSOR; //Set -1 for pinging sensor
				current_cycle = (config_list[i]).operator[](str_index);
				ROS_ASSERT(current_cycle.getType() == XmlRpc::XmlRpcValue::TypeArray);
				ROS_ASSERT(current_cycle.size()>0);
				//Assign address of pinging sensor to each listening sensor
				for (int k = 0; k<current_cycle.size(); k++){
					cycle_vector[static_cast<int>(current_cycle[k])]=((static_cast<int>(current_cycle[k])!=j)?j:PINGING_AND_LISTENING_SENSOR);
				}
			}
		}
		config.push_back(cycle_vector);
	}
	return config;
}
开发者ID:ipa-goa,项目名称:ipa_lcrob,代码行数:40,代码来源:us_driver.cpp

示例15: getProcState

void CRTLXmlrpc::getProcState(XmlRpc::XmlRpcValue& result)
{

    result.setSize(3);
    result[1] = 0.0;
    result[2] = 0.0;

    if(eegmanager == NULL) {
        result[0] = std::string("IDLE");
        return;
    }

    // update local state variable
    if(!eegmanager->isRunning()) started = false;

    if(eegmanager->isRunning()) {
        result.setSize(eegmanager->bandwidth.size()*2 + 1);
        result[0] = std::string("RUNNING");
        result.setSize(eegmanager->bandwidth.size());
        for(uint32_t i=0; i<eegmanager->bandwidth.size(); i++) {
            result[(i*2)+1] = eegmanager->bandwidth[i];
            result[(i*2)+2] = eegmanager->fill[i];
        }
        return;
    }

    if(eegmanager->current_setup().size() > 0) {
        result[0] = std::string("CONFIGURED");
        return;
    }

    result[0] = std::string("IDLE");

    return;
}
开发者ID:BioinformaticsArchive,项目名称:pyspace,代码行数:35,代码来源:ctrl_xmlrpc.cpp


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