本文整理汇总了C++中yarp::os::ConnectionReader::expectInt方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionReader::expectInt方法的具体用法?C++ ConnectionReader::expectInt怎么用?C++ ConnectionReader::expectInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yarp::os::ConnectionReader
的用法示例。
在下文中一共展示了ConnectionReader::expectInt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
bool C_sendingBuffer::read(yarp::os::ConnectionReader& connection)
{
connection.convertTextMode(); // if connection is text-mode, convert!
int tag = connection.expectInt();
if (tag!=BOTTLE_TAG_LIST+BOTTLE_TAG_BLOB+BOTTLE_TAG_INT)
return false;
int ct = connection.expectInt();
if (ct!=2)
return false;
size_of_the_packet = connection.expectInt();
connection.expectBlock(packet, SIZE_OF_DATA);
return true;
}
示例2: read
bool eventBuffer::read(yarp::os::ConnectionReader& connection)
{
connection.convertTextMode(); // if connection is text-mode, convert!
int tag = connection.expectInt();
if (tag != BOTTLE_TAG_LIST+BOTTLE_TAG_BLOB+BOTTLE_TAG_INT)
return false;
int ct = connection.expectInt();
if (ct!=2)
return false;
size_of_the_packet = connection.expectInt();
int ceilSizeOfPacket = (size_of_the_packet+7)/8*8; // the nearest multiple of 8 greater or equal to size_of_the_packet
memset(packet, 0, SIZE_OF_DATA);
connection.expectBlock(packet, ceilSizeOfPacket);
return true;
}
示例3: read
bool SystemInfoSerializer::read(yarp::os::ConnectionReader& connection)
{
// reading memory
memory.totalSpace = connection.expectInt();
memory.freeSpace = connection.expectInt();
// reading storage
storage.totalSpace = connection.expectInt();
storage.freeSpace = connection.expectInt();
// reading network
//network.mac = connection.expectText();
//network.ip4 = connection.expectText();
//network.ip6 = connection.expectText();
// reading processor
processor.architecture = connection.expectText();
processor.model = connection.expectText();
processor.vendor = connection.expectText();
processor.family = connection.expectInt();
processor.modelNumber = connection.expectInt();
processor.cores = connection.expectInt();
processor.siblings = connection.expectInt();
processor.frequency = connection.expectDouble();
// reading load
load.cpuLoad1 = connection.expectDouble();
load.cpuLoad5 = connection.expectDouble();
load.cpuLoad15 = connection.expectDouble();
load.cpuLoadInstant = connection.expectInt();
// reading platform
platform.name = connection.expectText();
platform.distribution = connection.expectText();
platform.release = connection.expectText();
platform.codename = connection.expectText();
platform.kernel = connection.expectText();
platform.environmentVars.fromString(connection.expectText());
// reading user
user.userName = connection.expectText();
user.realName = connection.expectText();
user.homeDir = connection.expectText();
user.userID = connection.expectInt();
return true;
}
示例4: read
bool eventBottle::read(yarp::os::ConnectionReader& connection) {
connection.convertTextMode(); // if connection is text-mode, convert!
int tag = connection.expectInt();
if (tag != BOTTLE_TAG_LIST + BOTTLE_TAG_BLOB + BOTTLE_TAG_INT) {
return false;
}
int ct = connection.expectInt();
if (ct!=2) {
return false;
}
bytes_of_the_packet = connection.expectInt();
size_of_the_packet = bytes_of_the_packet / wordDimension; // number of 32 bit word times 4bytes
connection.expectBlock(packetPointer,bytes_of_the_packet);
//printf(" eventBottle::read:size_of_the_packet %d bytes_of_the_packet %d \n", size_of_the_packet, bytes_of_the_packet);
// ---------------------------------------------------------------------------------------------------------
// ------------------------ deserialisation of the bottle -------------------------------------
//printf("bytes of the packet %d \n",bytes_of_the_packet );
int word;
char* i_data = packetPointer;
packet->clear(); // clear the bottle before any other adding
unsigned char tmpChar;
for(int i = 0 ; i < bytes_of_the_packet;) {
word = 0;
for (int j = 0 ; j < 4 ; j++){
tmpChar = (unsigned char) *i_data;
//printf("%02x ", *i_data );
int value = tmpChar << (8 * j);
word = word | value;
i_data++;
i++;
}
packet->addInt(word);
//printf("= %08x \n", word);
}
//----------------------------------------------------------------------------------------------------------
//packet->fromBinary(packetPointer,bytes_of_the_packet);
size_of_the_bottle = packet->size();
return true;
}
示例5: memset
bool MapGrid2D::read(yarp::os::ConnectionReader& connection)
{
// auto-convert text mode interaction
connection.convertTextMode();
connection.expectInt();
connection.expectInt();
connection.expectInt();
m_width = connection.expectInt();
connection.expectInt();
m_height = connection.expectInt();
connection.expectInt();
m_origin.x = connection.expectDouble();
connection.expectInt();
m_origin.y = connection.expectDouble();
connection.expectInt();
m_origin.theta = connection.expectDouble();
connection.expectInt();
m_resolution = connection.expectDouble();
connection.expectInt();
int siz = connection.expectInt();
char buff[255]; memset(buff, 0, 255);
connection.expectBlock((char*)buff, siz);
m_map_name = buff;
m_map_occupancy.resize(m_width, m_height);
m_map_flags.resize(m_width, m_height);
bool ok = true;
unsigned char *mem = nullptr;
int memsize = 0;
connection.expectInt();
memsize = connection.expectInt();
if (memsize != m_map_occupancy.getRawImageSize()) { return false; }
mem = m_map_occupancy.getRawImage();
ok &= connection.expectBlock((char*)mem, memsize);
connection.expectInt();
memsize = connection.expectInt();
if (memsize != m_map_flags.getRawImageSize()) { return false; }
mem = m_map_flags.getRawImage();
ok &= connection.expectBlock((char*)mem, memsize);
if (!ok) return false;
return !connection.isError();
return true;
}