本文整理汇总了C++中ConnectionWriter::appendInt方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionWriter::appendInt方法的具体用法?C++ ConnectionWriter::appendInt怎么用?C++ ConnectionWriter::appendInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionWriter
的用法示例。
在下文中一共展示了ConnectionWriter::appendInt方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: write
bool Stamp::write(ConnectionWriter& connection) {
connection.appendInt(BOTTLE_TAG_LIST); // nested structure
connection.appendInt(2); // with two elements
connection.appendInt(BOTTLE_TAG_INT);
connection.appendInt(sequenceNumber);
connection.appendInt(BOTTLE_TAG_DOUBLE);
connection.appendDouble(timeStamp);
connection.convertTextMode();
return !connection.isError();
}
示例2: write
bool Value::write(ConnectionWriter& connection) {
if (!proxy) {
connection.appendInt(BOTTLE_TAG_LIST);
connection.appendInt(0);
return !connection.isError();
}
connection.appendInt(BOTTLE_TAG_LIST);
connection.appendInt(1);
return proxy->write(connection);
}
示例3: write
bool BottleImpl::write(ConnectionWriter& writer) {
// could simplify this if knew lengths of blocks up front
if (writer.isTextMode()) {
//writer.appendLine(toString());
writer.appendString(toString().c_str(),'\n');
} else {
#ifdef USE_YARP1_PREFIX
if (!nested) {
String name = "YARP2";
writer.appendInt(name.length()+1);
writer.appendString(name.c_str(),'\0');
}
#endif
synch();
/*
if (!nested) {
// No byte count any more, to facilitate nesting
//YMSG(("bottle byte count %d\n",byteCount()));
//writer.appendInt(byteCount()+sizeof(NetInt32));
writer.appendInt(StoreList::code + speciality);
}
*/
//writer.appendBlockCopy(Bytes((char*)getBytes(),byteCount()));
writer.appendBlock((char*)getBytes(),byteCount());
}
return !writer.isError();
}
示例4: write
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//~~~~~~~~~~~~~~~~~~~~~~
// SERIALIZATION methods
//~~~~~~~~~~~~~~~~~~~~~~
bool dynContact::write(ConnectionWriter& connection) const{
// represent a dynContact as a list of 4 elements that are:
// - a list of 3 int, i.e. contactId, bodyPart, linkNumber
// - a list of 3 double, i.e. the CoP
// - a list of 3 double, i.e. the force
// - a list of 3 double, i.e. the moment
connection.appendInt(BOTTLE_TAG_LIST);
connection.appendInt(4);
// list of 3 int, i.e. contactId, bodyPart, linkNumber
connection.appendInt(BOTTLE_TAG_LIST + BOTTLE_TAG_INT);
connection.appendInt(3);
connection.appendInt(contactId);
connection.appendInt(bodyPart); // left_arm, right_arm, ...
connection.appendInt(linkNumber);
// list of 3 double, i.e. the CoP
connection.appendInt(BOTTLE_TAG_LIST + BOTTLE_TAG_DOUBLE);
connection.appendInt(3);
for(int i=0;i<3;i++) connection.appendDouble(CoP[i]);
// list of 3 double, i.e. the force
connection.appendInt(BOTTLE_TAG_LIST + BOTTLE_TAG_DOUBLE);
connection.appendInt(3);
for(int i=0;i<3;i++) connection.appendDouble(F[i]);
// list of 3 double, i.e. the moment
connection.appendInt(BOTTLE_TAG_LIST + BOTTLE_TAG_DOUBLE);
connection.appendInt(3);
for(int i=0;i<3;i++) connection.appendDouble(Mu[i]);
// if someone is foolish enough to connect in text mode,
// let them see something readable.
connection.convertTextMode();
return !connection.isError();
}
示例5: writeRaw
bool StoreBlob::writeRaw(ConnectionWriter& writer) {
writer.appendInt((int)x.length());
writer.appendBlock(x.c_str(),x.length());
return true;
}
示例6: write
virtual bool write(ConnectionWriter& connection) {
printf("Writing an integer\n");
connection.appendInt(val);
return true;
}