本文整理汇总了C++中yarp::os::ConnectionReader::expectDouble方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionReader::expectDouble方法的具体用法?C++ ConnectionReader::expectDouble怎么用?C++ ConnectionReader::expectDouble使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类yarp::os::ConnectionReader
的用法示例。
在下文中一共展示了ConnectionReader::expectDouble方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
bool Matrix::read(yarp::os::ConnectionReader& connection) {
// auto-convert text mode interaction
connection.convertTextMode();
MatrixPortContentHeader header;
bool ok = connection.expectBlock((char*)&header, sizeof(header));
if (!ok) return false;
int r=rows();
int c=cols();
if (header.listLen > 0)
{
if ( r != (int)(header.rows) || c!=(int)(header.cols))
{
resize(header.rows, header.cols);
}
int l=0;
double *tmp=data();
for(l=0;l<header.listLen;l++)
tmp[l]=connection.expectDouble();
}
else
return false;
return true;
}
示例2: 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;
}
示例3: 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;
}
示例4: read
bool Quaternion::read(yarp::os::ConnectionReader& connection)
{
// auto-convert text mode interaction
connection.convertTextMode();
QuaternionPortContentHeader header;
bool ok = connection.expectBlock((char*)&header, sizeof(header));
if (!ok) return false;
if (header.listLen == 4 && header.listTag == (BOTTLE_TAG_LIST | BOTTLE_TAG_DOUBLE))
{
this->internal_data[0] = connection.expectDouble();
this->internal_data[1] = connection.expectDouble();
this->internal_data[2] = connection.expectDouble();
this->internal_data[3] = connection.expectDouble();
}
else
{
return false;
}
return !connection.isError();
}
示例5: read
bool Vector::read(yarp::os::ConnectionReader& connection) {
// auto-convert text mode interaction
connection.convertTextMode();
VectorPortContentHeader header;
bool ok = connection.expectBlock((char*)&header, sizeof(header));
if (!ok) return false;
if (header.listLen > 0 &&
header.listTag == BOTTLE_TAG_LIST + BOTTLE_TAG_DOUBLE) {
if (size() != (size_t)(header.listLen))
resize(header.listLen);
int k=0;
for (k=0;k<header.listLen;k++)
(*this)[k]=connection.expectDouble();
} else {
return false;
}
return !connection.isError();
}