本文整理汇总了C++中xmlrpc_c::paramList::size方法的典型用法代码示例。如果您正苦于以下问题:C++ paramList::size方法的具体用法?C++ paramList::size怎么用?C++ paramList::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类xmlrpc_c::paramList
的用法示例。
在下文中一共展示了paramList::size方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Exception
void devTcp4Client_Interface::client_create(xmlrpc_c::paramList const& paramList,
xmlrpc_c::value* retvalP) {
ACE_TRACE("devTcp4Client_Interface::create");
std::string devname = static_cast<std::string>(paramList.getString(0));
if (devices::instance()->exists(devname)) {
throw Exception("Device with that name already exists.");
}
std::string address = IPv4Addr::IPv4_Any;
int port = 0;
devTcp4Client* tcp4_dev = new devTcp4Client(devname, this);
devices::instance()->add(tcp4_dev);
if (paramList.size() > 1) {
address = static_cast<std::string>(paramList.getString(2));
tcp4_dev->setAddress(address);
}
if (paramList.size() > 2) {
port = static_cast<int>(paramList.getInt(3));
tcp4_dev->setPort(port);
if (port > 0) tcp4_dev->openConnection();
}
*retvalP = xmlrpc_c::value_nil();
}
示例2: print
void Log::print(const xmlrpc_c::paramList & params)
{
for(unsigned i=0; i < params.size(); i++) {
std::clog<<"param["<<i<<"]\n";
printValues(params.getStruct(i));
}
}
示例3: execute
void ElementMethodCl::execute(xmlrpc_c::paramList const& paramList,xmlrpc_c::value * const retvalP)
{
if (paramList.size() == 0)
{
/* return list of element */
*retvalP = xmlrpc_c::value_string("empty");
}
}
示例4: get_rate_limit
virtual void get_rate_limit(xmlrpc_c::paramList const& paramList, xmlrpc_c::value* retvalP) {
ACE_TRACE("modEmulateRate_Interface::get_rate");
int rate = 0;
if (paramList.size() > 2 ) {
rate = find_handler(paramList)->getRateLimitAtTime(paramList.getDouble(2));
}
else {
rate = find_handler(paramList)->getRateLimit();
}
*retvalP = xmlrpc_c::value_double(rate);
}
示例5: data
void RemoteKinematics::PositionMethod::execute(xmlrpc_c::paramList const& paramList,
xmlrpc_c::value* const resultP) {
// n:AA
if (paramList.size() == 2) {
vector<value> keys = paramList.getArray(0);
vector<value> values = paramList.getArray(1);
// Size check
if (keys.size() != values.size()) throw girerr::error("Keys vector and values vector doesn't have same size");
// Empty check
if (keys.empty()) return;
bool integer_keys = keys[0].type() == xmlrpc_c::value::TYPE_INT;
vector<double> data(values.size());
for (int i = 0; i < values.size(); ++i) data[i] = value_double(values[i]);
if (integer_keys) {
vector<int> joint_names(keys.size());
for (int i = 0; i < keys.size(); ++i) joint_names[i] = value_int(keys[i]);
this->m_kinematics->setPosition(joint_names, data);
} else {
vector<string> joint_names(keys.size());
for (int i = 0; i < keys.size(); ++i) joint_names[i] = value_string(keys[i]);
this->m_kinematics->setPosition(joint_names, data);
}
*resultP = value_nil();
return;
}
// S:
SensorData<double>::Ptr data;
if (paramList.size() == 0) {
data = this->m_kinematics->getPosition();
// S:A
} else if (paramList.size() == 1) {
// Empty check
vector<value> keys = paramList.getArray(0);
if (keys.empty()) return;
bool integer_keys = keys[0].type() == xmlrpc_c::value::TYPE_INT;
if (integer_keys) {
vector<int> joint_names(keys.size());
for (int i = 0; i < keys.size(); ++i) joint_names[i] = (int) value_int(keys[i]);
data = this->m_kinematics->getPosition(joint_names);
} else {
vector<string> joint_names(keys.size());
for (int i = 0; i < keys.size(); ++i) joint_names[i] = (string) value_string(keys[i]);
data = this->m_kinematics->getPosition(joint_names);
}
} else throw girerr::error("Unknown signature for hardness function");
// TODO Check for memory leaks
// Some optimisation by using C library of xmlrpc-c
xmlrpc_env env;
xmlrpc_env_init(&env);
xmlrpc_value* elem;
xmlrpc_value* values;
xmlrpc_value* result;
// Init result array
values = xmlrpc_array_new(&env);
for (int i = 0; i < data->data.size(); ++i) {
elem = xmlrpc_double_new(&env, data->data[i]);
xmlrpc_array_append_item(&env, values, elem);
xmlrpc_DECREF(elem);
}
// XMLRPC-C timestamp
elem = xmlrpc_double_new(&env, data->timestamp);
// Create result struct
result = xmlrpc_struct_new(&env);
xmlrpc_struct_set_value(&env, result, "data", values);
xmlrpc_struct_set_value(&env, result, "timestamp", elem);
// Apply result
resultP->instantiate(result);
// Clean this shit!
xmlrpc_DECREF(elem);
xmlrpc_DECREF(values);
xmlrpc_DECREF(result);
xmlrpc_env_clean(&env);
}