本文整理汇总了C++中yarp::os::Bottle::addInt32方法的典型用法代码示例。如果您正苦于以下问题:C++ Bottle::addInt32方法的具体用法?C++ Bottle::addInt32怎么用?C++ Bottle::addInt32使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yarp::os::Bottle
的用法示例。
在下文中一共展示了Bottle::addInt32方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: encode
void GaussianAE::encode(yarp::os::Bottle &b) const
{
LabelledAE::encode(b);
b.addInt32(_gaei[0]);
b.addInt32(_gaei[1]);
b.addInt32(_gaei[2]);
}
示例2: respond
bool JoypadCtrlParser::respond(const yarp::os::Bottle& cmd, yarp::os::Bottle& response)
{
bool ret;
ret = false;
if(cmd.get(0).asVocab() != VOCAB_IJOYPADCTRL || !cmd.get(1).isVocab() || !cmd.get(2).isVocab() || !cmd.get(3).isVocab())
{
response.addVocab(VOCAB_FAILED);
return ret;
}
if(cmd.get(1).asVocab() == VOCAB_GET)
{
int toGet;
toGet = cmd.get(2).asVocab();
if(cmd.get(3).asVocab() == VOCAB_COUNT)
{
if(countGetters.find(toGet) != countGetters.end())
{
unsigned int count;
getcountmethod getter;
getter = countGetters[toGet];
if((device->*getter)(count))
{
response.addVocab(VOCAB_OK);
response.addInt32(count);
ret = true;
}
}
else if (toGet == VOCAB_STICKDOF && cmd.get(4).isInt32())
{
unsigned int count;
if (device->getStickDoF(cmd.get(4).asInt32(), count))
{
response.addVocab(VOCAB_OK);
response.addInt32(count);
ret = true;
}
else
{
response.addVocab(VOCAB_FAILED);
ret = false;
}
}
else
{
response.addVocab(VOCAB_FAILED);
ret = false;
}
}
else if(cmd.get(3).asVocab() == VOCAB_VALUE)
{
switch (cmd.get(2).asVocab()) {
case VOCAB_BUTTON:
{
float value;
if(cmd.get(4).isInt32() && device->getButton(cmd.get(4).asInt32(), value))
{
response.addVocab(VOCAB_OK);
response.addFloat64(value);
ret = true;
}
break;
}
case VOCAB_AXIS:
{
double value;
if(cmd.get(4).isInt32() && device->getAxis(cmd.get(4).asInt32(), value))
{
response.addVocab(VOCAB_OK);
response.addFloat64(value);
ret = true;
}
break;
}
case VOCAB_STICK:
{
if(cmd.get(4).isVocab())
{
yarp::sig::Vector frame;
auto mode = cmd.get(4).asVocab() == VOCAB_CARTESIAN ? yarp::dev::IJoypadController::JypCtrlcoord_CARTESIAN : yarp::dev::IJoypadController::JypCtrlcoord_POLAR;
if(cmd.get(5).isInt32() && device->getStick(cmd.get(5).asInt32(), frame, mode))
{
response.addVocab(VOCAB_OK);
for(size_t i = 0; i < frame.size(); ++i)
{
response.addFloat64(frame[i]);
}
ret = true;
}
}
break;
}
case VOCAB_STICKDOF:
{
//.........这里部分代码省略.........