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


C++ ConnectionWriter::appendBlock方法代码示例

本文整理汇总了C++中ConnectionWriter::appendBlock方法的典型用法代码示例。如果您正苦于以下问题:C++ ConnectionWriter::appendBlock方法的具体用法?C++ ConnectionWriter::appendBlock怎么用?C++ ConnectionWriter::appendBlock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ConnectionWriter的用法示例。


在下文中一共展示了ConnectionWriter::appendBlock方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: write

bool PortCommand::write(ConnectionWriter& writer) {
    //ACE_DEBUG((LM_DEBUG,"PortCommand::writeBlock"));
    //ACE_OS::printf("Writing port command, text mode %d\n", writer.isTextMode());
    if (!writer.isTextMode()) {
        int len = 0;
        if (ch=='\0') {
            len = (int)str.length()+1;
        }
        yAssert(header.length()==8);
        char *base = header.get();
        Bytes b(base,4);
        NetType::netInt(len,b);
        base[4] = '~';
        base[5] = ch;
        base[6] = 0;
        base[7] = 1;
        writer.appendBlock(header.bytes().get(),header.bytes().length());
        if (ch=='\0') {
            writer.appendBlock(str.c_str(),str.length()+1);
        }
    } else {
        if (ch!='\0') {
            char buf[] = "X";
            buf[0] = ch;
            writer.appendString(ConstString(buf).c_str(),'\n');
        } else {
            writer.appendString(str.c_str(),'\n');
        }
    }
    return !writer.isError();
}
开发者ID:giuliavezzani,项目名称:yarp,代码行数:31,代码来源:PortCommand.cpp

示例2: write

    virtual bool write(ConnectionWriter& connection)
    {
        connection.appendBlock((char*)&datum, sizeof(double));
        connection.appendBlock((char*)&payloadSize, sizeof(int));

        if (payloadSize>0)
            connection.appendBlock((char *)payload, payloadSize);

        return !connection.isError();
    }
开发者ID:BRKMYR,项目名称:yarp,代码行数:10,代码来源:port_latency.cpp

示例3: write

bool BufferedConnectionWriter::write(ConnectionWriter& connection) const
{
    stopWrite();
    size_t i;
    for (i = 0; i < header_used; i++) {
        yarp::os::ManagedBytes& b = *(header[i]);
        connection.appendBlock(b.get(), b.used());
    }
    for (i = 0; i < lst_used; i++) {
        yarp::os::ManagedBytes& b = *(lst[i]);
        connection.appendBlock(b.get(), b.used());
    }
    return !connection.isError();
}
开发者ID:ale-git,项目名称:yarp,代码行数:14,代码来源:BufferedConnectionWriter.cpp

示例4: length

bool yarp::os::SizedWriter::write(ConnectionWriter& connection) const
{
    for (size_t i = 0; i < length(); i++) {
        connection.appendBlock((char*)data(i), length(i));
    }
    return true;
}
开发者ID:robotology,项目名称:yarp,代码行数:7,代码来源:SizedWriter.cpp

示例5: 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();
}
开发者ID:holgerfriedrich,项目名称:yarp,代码行数:28,代码来源:BottleImpl.cpp

示例6: writeRaw

bool StoreBlob::writeRaw(ConnectionWriter& writer) const
{
    writer.appendInt32(static_cast<std::int32_t>(x.length()));
    writer.appendBlock(x.c_str(), x.length());
    return true;
}
开发者ID:claudiofantacci,项目名称:yarp,代码行数:6,代码来源:Storable.cpp

示例7: writeRaw

bool StoreBlob::writeRaw(ConnectionWriter& writer) {
    writer.appendInt((int)x.length());
    writer.appendBlock(x.c_str(),x.length());
    return true;
}
开发者ID:holgerfriedrich,项目名称:yarp,代码行数:5,代码来源:BottleImpl.cpp


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