blob: 976c383555716bed07cc1994a901f20ddb8098b8 [file] [log] [blame]
Mark Sleee8540632006-05-30 09:24:40 +00001#ifndef T_BINARY_PROTOCOL_H
2#define T_BINARY_PROTOCOL_H
3
4#include "protocol/TProtocol.h"
5
6/**
7 * The default binary protocol for thrift. Writes all data in a very basic
8 * binary format, essentially just spitting out the raw bytes.
9 *
10 * @author Mark Slee <mcslee@facebook.com>
11 */
12class TBinaryProtocol : public TProtocol {
13 public:
14 TBinaryProtocol() {}
15 ~TBinaryProtocol() {}
16
17 std::string
18 readFunction(TBuf& buf) const;
19 std::string
20 writeFunction(const std::string& name, const std::string& args) const;
21
22 std::map<uint32_t, TBuf>
23 readStruct(TBuf& buf) const;
24 std::string
25 writeStruct(const std::map<uint32_t,std::string>& s) const;
26
27 std::string readString (TBuf& buf) const;
28 uint8_t readByte (TBuf& buf) const;
29 uint32_t readU32 (TBuf& buf) const;
30 int32_t readI32 (TBuf& buf) const;
31 uint64_t readU64 (TBuf& buf) const;
32 int64_t readI64 (TBuf& buf) const;
33
34 std::string writeString (const std::string& str) const;
35 std::string writeByte (const uint8_t byte) const;
36 std::string writeU32 (const uint32_t u32) const;
37 std::string writeI32 (const int32_t i32) const;
38 std::string writeU64 (const uint64_t u64) const;
39 std::string writeI64 (const int64_t i64) const;
40};
41
42#endif