bool MapGrid2D::write(yarp::os::ConnectionWriter& connection) { connection.appendInt(BOTTLE_TAG_LIST); connection.appendInt(9); connection.appendInt(BOTTLE_TAG_INT); connection.appendInt(m_width); connection.appendInt(BOTTLE_TAG_INT); connection.appendInt(m_height); connection.appendInt(BOTTLE_TAG_DOUBLE); connection.appendDouble(m_origin.x); connection.appendInt(BOTTLE_TAG_DOUBLE); connection.appendDouble(m_origin.y); connection.appendInt(BOTTLE_TAG_DOUBLE); connection.appendDouble(m_origin.theta); connection.appendInt(BOTTLE_TAG_DOUBLE); connection.appendDouble(m_resolution); connection.appendInt(BOTTLE_TAG_STRING); connection.appendRawString(m_map_name.c_str()); unsigned char *mem = nullptr; int memsize = 0; mem = m_map_occupancy.getRawImage(); memsize = m_map_occupancy.getRawImageSize(); connection.appendInt(BOTTLE_TAG_BLOB); connection.appendInt(memsize); connection.appendExternalBlock((char*)mem, memsize); mem = m_map_flags.getRawImage(); memsize = m_map_flags.getRawImageSize(); connection.appendInt(BOTTLE_TAG_BLOB); connection.appendInt(memsize); connection.appendExternalBlock((char*)mem, memsize); connection.convertTextMode(); return !connection.isError(); }
bool SystemInfoSerializer::write(yarp::os::ConnectionWriter& connection) { // updating system info memory = SystemInfo::getMemoryInfo(); storage = SystemInfo::getStorageInfo(); //network = SystemInfo::getNetworkInfo(); processor = SystemInfo::getProcessorInfo(); platform = SystemInfo::getPlatformInfo(); load = SystemInfo::getLoadInfo(); user = SystemInfo::getUserInfo(); // serializing memory connection.appendInt(memory.totalSpace); connection.appendInt(memory.freeSpace); // serializing storage connection.appendInt(storage.totalSpace); connection.appendInt(storage.freeSpace); // serializing network //connection.appendString(network.mac.c_str()); //connection.appendString(network.ip4.c_str()); //connection.appendString(network.ip6.c_str()); // serializing processor connection.appendString(processor.architecture.c_str()); connection.appendString(processor.model.c_str()); connection.appendString(processor.vendor.c_str()); connection.appendInt(processor.family); connection.appendInt(processor.modelNumber); connection.appendInt(processor.cores); connection.appendInt(processor.siblings); connection.appendDouble(processor.frequency); // serializing load connection.appendDouble(load.cpuLoad1); connection.appendDouble(load.cpuLoad5); connection.appendDouble(load.cpuLoad15); connection.appendInt(load.cpuLoadInstant); // serializing platform connection.appendString(platform.name.c_str()); connection.appendString(platform.distribution.c_str()); connection.appendString(platform.release.c_str()); connection.appendString(platform.codename.c_str()); connection.appendString(platform.kernel.c_str()); connection.appendString(platform.environmentVars.toString().c_str()); // serializing user connection.appendString(user.userName.c_str()); connection.appendString(user.realName.c_str()); connection.appendString(user.homeDir.c_str()); connection.appendInt(user.userID); return !connection.isError(); }
bool Matrix::write(yarp::os::ConnectionWriter& connection) { MatrixPortContentHeader header; //header.totalLen = sizeof(header)+sizeof(double)*this->size(); header.outerListTag = BOTTLE_TAG_LIST; header.outerListLen = 3; header.rowsTag = BOTTLE_TAG_INT; header.colsTag = BOTTLE_TAG_INT; header.listTag = BOTTLE_TAG_LIST + BOTTLE_TAG_DOUBLE; header.rows=rows(); header.cols=cols(); header.listLen = header.rows*header.cols; connection.appendBlock((char*)&header, sizeof(header)); int l=0; const double *tmp=data(); for(l=0;l<header.listLen;l++) connection.appendDouble(tmp[l]); // if someone is foolish enough to connect in text mode, // let them see something readable. connection.convertTextMode(); return true; }
bool Quaternion::write(yarp::os::ConnectionWriter& connection) { QuaternionPortContentHeader header; header.listTag = (BOTTLE_TAG_LIST | BOTTLE_TAG_DOUBLE); header.listLen = 4; connection.appendBlock((char*)&header, sizeof(header)); connection.appendDouble(this->internal_data[0]); connection.appendDouble(this->internal_data[1]); connection.appendDouble(this->internal_data[2]); connection.appendDouble(this->internal_data[3]); // if someone is foolish enough to connect in text mode, // let them see something readable. connection.convertTextMode(); return !connection.isError(); }
bool Vector::write(yarp::os::ConnectionWriter& connection) { VectorPortContentHeader header; header.listTag = (BOTTLE_TAG_LIST | BOTTLE_TAG_DOUBLE); header.listLen = (int)size(); connection.appendBlock((char*)&header, sizeof(header)); int k=0; for (k=0;k<header.listLen;k++) connection.appendDouble((*this)[k]); // if someone is foolish enough to connect in text mode, // let them see something readable. connection.convertTextMode(); return !connection.isError(); }