Thrift: Is it possible to do only serialization with C++ Thrift library?

后端 未结 5 1558
执笔经年
执笔经年 2021-01-02 05:21

With C++ Apache Thrift library, is it possible to use only Serialization/Deserialization and not use RPC services?

As I understand from this page, it is possible to

5条回答
  •  情书的邮戳
    2021-01-02 05:32

    In c++ you can use the TFileTransport:

    boost::shared_ptr transport(new TFileTransport(filename));
    boost::shared_ptr protocol(new TBinaryProtocol(transport));
    yourObj.write(protocol.get()); // to write
    

    or

    yourObj.read(protocol.get()); // to read
    

提交回复
热议问题