本文整理汇总了C++中ConnectionReader::convertTextMode方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionReader::convertTextMode方法的具体用法?C++ ConnectionReader::convertTextMode怎么用?C++ ConnectionReader::convertTextMode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ConnectionReader
的用法示例。
在下文中一共展示了ConnectionReader::convertTextMode方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: read
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
bool dynContact::read(ConnectionReader& connection){
// auto-convert text mode interaction
connection.convertTextMode();
// 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
if(connection.expectInt()!= BOTTLE_TAG_LIST || connection.expectInt()!=4)
return false;
// - a list of 3 int, i.e. contactId, bodyPart, linkNumber
if(connection.expectInt()!=BOTTLE_TAG_LIST+BOTTLE_TAG_INT || connection.expectInt()!=3)
return false;
contactId = connection.expectInt();
bodyPart = (BodyPart)connection.expectInt();
linkNumber = connection.expectInt();
// - a list of 3 double, i.e. the CoP
if(connection.expectInt()!=BOTTLE_TAG_LIST+BOTTLE_TAG_DOUBLE || connection.expectInt()!=3)
return false;
for(int i=0;i<3;i++) CoP[i] = connection.expectDouble();
// - a list of 3 double, i.e. the force
if(connection.expectInt()!=BOTTLE_TAG_LIST+BOTTLE_TAG_DOUBLE || connection.expectInt()!=3)
return false;
for(int i=0;i<3;i++) F[i] = connection.expectDouble();
setForce(F);
// - a list of 3 double, i.e. the moment
if(connection.expectInt()!=BOTTLE_TAG_LIST+BOTTLE_TAG_DOUBLE || connection.expectInt()!=3)
return false;
for(int i=0;i<3;i++) Mu[i] = connection.expectDouble();
return !connection.isError();
}
示例2: reader
WireReader::WireReader(ConnectionReader& reader) : reader(reader)
{
reader.convertTextMode();
state = &baseState;
flush_if_needed = false;
get_mode = false;
support_get_mode = false;
expecting = false;
}
示例3: read
bool Stamp::read(ConnectionReader& connection) {
connection.convertTextMode();
int header = connection.expectInt();
if (header!=BOTTLE_TAG_LIST) { return false; }
int len = connection.expectInt();
if (len!=2) { return false; }
int code;
code = connection.expectInt();
if (code!=BOTTLE_TAG_INT) { return false; }
sequenceNumber = connection.expectInt();
code = connection.expectInt();
if (code!=BOTTLE_TAG_DOUBLE) { return false; }
timeStamp = connection.expectDouble();
if (connection.isError()) {
sequenceNumber = -1;
timeStamp = 0;
return false;
}
return true;
}