X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fpickle.hpp;h=60694fa83d92d8da1e9891e6865574d13d7e0ea2;hb=9115776479fc67fe12cc3f7ccb8da2fd684d2232;hp=f333960a7adefb31a57d48165c2da5ac753bdb6e;hpb=447576da195e098d54c8e1279f7bb3ff1b5f2d49;p=apitrace diff --git a/common/pickle.hpp b/common/pickle.hpp index f333960..60694fa 100644 --- a/common/pickle.hpp +++ b/common/pickle.hpp @@ -106,13 +106,15 @@ private: public: PickleWriter(std::ostream &_os) : - os(_os) - { + os(_os) { + } + + inline void begin() { os.put(PROTO); os.put(2); } - ~PickleWriter() { + inline void end() { os.put(STOP); } @@ -266,6 +268,16 @@ public: os.put(u.c[0]); } + inline void writeByteArray(const void *buf, size_t length) { + os.put(GLOBAL); + os << "__builtin__\nbytearray\n"; + os.put(BINPUT); + os.put(1); + writeString(static_cast(buf), length); + os.put(TUPLE1); + os.put(REDUCE); + } + protected: inline void putInt16(uint16_t i) { os.put( i & 0xff);