当前位置: 首页>>代码示例>>C++>>正文


C++ ConnectionReader::convertTextMode方法代码示例

本文整理汇总了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();
}
开发者ID:robotology,项目名称:icub-main,代码行数:34,代码来源:dynContact.cpp

示例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;
}
开发者ID:apaikan,项目名称:yarp,代码行数:9,代码来源:WireReader.cpp

示例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;
}
开发者ID:paulfitz,项目名称:yarp,代码行数:20,代码来源:Stamp.cpp


注:本文中的ConnectionReader::convertTextMode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。