More boosification of thrift driver, server, transport and protocol code

Modified TestServer to use thread-pool manager 


	


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664737 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/protocol/TBinaryProtocol.h b/lib/cpp/src/protocol/TBinaryProtocol.h
index 0f0560a..3456abf 100644
--- a/lib/cpp/src/protocol/TBinaryProtocol.h
+++ b/lib/cpp/src/protocol/TBinaryProtocol.h
@@ -1,10 +1,14 @@
 #ifndef T_BINARY_PROTOCOL_H
 #define T_BINARY_PROTOCOL_H
 
-#include "protocol/TProtocol.h"
+#include <protocol/TProtocol.h>
+
+#include <boost/shared_ptr.hpp>
 
 namespace facebook { namespace thrift { namespace protocol { 
 
+using namespace boost;
+
 /**
  * The default binary protocol for thrift. Writes all data in a very basic
  * binary format, essentially just spitting out the raw bytes.
@@ -12,7 +16,7 @@
  * @author Mark Slee <mcslee@facebook.com>
  */
 class TBinaryProtocol : public TProtocol {
- public:
+  public:
   TBinaryProtocol() {}
   ~TBinaryProtocol() {}
 
@@ -20,108 +24,122 @@
    * Writing functions.
    */
 
-  uint32_t writeStructBegin   (TTransport*    out,
+  virtual uint32_t writeMessageBegin(shared_ptr<TTransport> out,
+				     const TMessageType messageType,
+				     const uint32_t seqid) const;
+
+  virtual uint32_t writeMessageEnd   (shared_ptr<TTransport> out) const;
+
+
+  uint32_t writeStructBegin   (shared_ptr<TTransport>    out,
                                const std::string& name)   const;
 
-  uint32_t writeStructEnd     (TTransport*    out)        const;
+  uint32_t writeStructEnd     (shared_ptr<TTransport>    out)        const;
 
-  uint32_t writeFieldBegin    (TTransport*    out,
+  uint32_t writeFieldBegin    (shared_ptr<TTransport>    out,
                                const std::string& name,
                                const TType    fieldType,
                                const uint16_t fieldId)    const;
 
-  uint32_t writeFieldEnd      (TTransport*    out)        const;
+  uint32_t writeFieldEnd      (shared_ptr<TTransport>    out)        const;
 
-  uint32_t writeFieldStop     (TTransport*    out)        const;
+  uint32_t writeFieldStop     (shared_ptr<TTransport>    out)        const;
                                        
-  uint32_t writeMapBegin      (TTransport*    out,
+  uint32_t writeMapBegin      (shared_ptr<TTransport>    out,
                                const TType    keyType,
                                const TType    valType,
                                const int32_t  size)       const;
 
-  uint32_t writeMapEnd        (TTransport*    out)        const;
+  uint32_t writeMapEnd        (shared_ptr<TTransport>    out)        const;
 
-  uint32_t writeListBegin     (TTransport*    out,
+  uint32_t writeListBegin     (shared_ptr<TTransport>    out,
                                const TType    elemType,
                                const int32_t  size)       const;
 
-  uint32_t writeListEnd       (TTransport*    out)        const;
+  uint32_t writeListEnd       (shared_ptr<TTransport>    out)        const;
 
-  uint32_t writeSetBegin      (TTransport*    out,
+  uint32_t writeSetBegin      (shared_ptr<TTransport>    out,
                                const TType    elemType,
                                const int32_t  size)       const;
 
-  uint32_t writeSetEnd        (TTransport*    out)        const;
+  uint32_t writeSetEnd        (shared_ptr<TTransport>    out)        const;
 
-  uint32_t writeByte          (TTransport*    out,
+  uint32_t writeByte          (shared_ptr<TTransport>    out,
                                const uint8_t  byte)       const;
 
-  uint32_t writeU32           (TTransport*    out,
+  uint32_t writeU32           (shared_ptr<TTransport>    out,
                                const uint32_t u32)        const;
 
-  uint32_t writeI32           (TTransport*    out,
+  uint32_t writeI32           (shared_ptr<TTransport>    out,
                                const int32_t  i32)        const;
 
-  uint32_t writeU64           (TTransport*    out,
+  uint32_t writeU64           (shared_ptr<TTransport>    out,
                                const uint64_t u64)        const;
 
-  uint32_t writeI64           (TTransport*    out,
+  uint32_t writeI64           (shared_ptr<TTransport>    out,
                                const int64_t  i64)        const;
 
-  uint32_t writeString        (TTransport*    out,
+  uint32_t writeString        (shared_ptr<TTransport>    out,
                                const std::string& str)    const;
 
   /**
    * Reading functions
    */
 
-  uint32_t readStructBegin    (TTransport*    in,
+
+  uint32_t readMessasgeBegin    (shared_ptr<TTransport>    in,
+				 TMessageType& messageType,
+				 uint32_t& seqid) const;
+
+  uint32_t readMessageEnd      (shared_ptr<TTransport>    in) const;
+
+  uint32_t readStructBegin    (shared_ptr<TTransport>    in,
                                std::string& name)         const;
 
-  uint32_t readStructEnd      (TTransport*    in)         const;
+  uint32_t readStructEnd      (shared_ptr<TTransport>    in)         const;
 
-  uint32_t readFieldBegin     (TTransport*    in,
+  uint32_t readFieldBegin     (shared_ptr<TTransport>    in,
                                std::string&   name,
                                TType&         fieldType,
                                uint16_t&      fieldId)    const;
   
-  uint32_t readFieldEnd       (TTransport*    in)         const;
+  uint32_t readFieldEnd       (shared_ptr<TTransport>    in)         const;
  
-  uint32_t readMapBegin       (TTransport*    in,
+  uint32_t readMapBegin       (shared_ptr<TTransport>    in,
                                TType&         keyType,
                                TType&         valType,
                                int32_t&       size)       const;
 
-  uint32_t readMapEnd         (TTransport*    in)         const;
+  uint32_t readMapEnd         (shared_ptr<TTransport>    in)         const;
 
-  uint32_t readListBegin      (TTransport*    in,
+  uint32_t readListBegin      (shared_ptr<TTransport>    in,
                                TType&         elemType,
                                int32_t&       size)       const;
   
-  uint32_t readListEnd        (TTransport*    in)         const;
+  uint32_t readListEnd        (shared_ptr<TTransport>    in)         const;
 
-  uint32_t readSetBegin       (TTransport*    in,
+  uint32_t readSetBegin       (shared_ptr<TTransport>    in,
                                TType&         elemType,
                                int32_t&       size)       const;
 
-  uint32_t readSetEnd         (TTransport*    in)         const;
+  uint32_t readSetEnd         (shared_ptr<TTransport>    in)         const;
 
-  uint32_t readByte           (TTransport*    in,
+  uint32_t readByte           (shared_ptr<TTransport>    in,
                                uint8_t&       byte)       const;
 
-  uint32_t readU32            (TTransport*    in,
+  uint32_t readU32            (shared_ptr<TTransport>    in,
                                uint32_t&      u32)        const;
 
-  uint32_t readI32            (TTransport*    in,
+  uint32_t readI32            (shared_ptr<TTransport>    in,
                                int32_t&       i32)        const;
 
-  uint32_t readU64            (TTransport*    in,
+  uint32_t readU64            (shared_ptr<TTransport>    in,
                                uint64_t&      u64)        const;
 
-  uint32_t readI64            (TTransport*    in,
+  uint32_t readI64            (shared_ptr<TTransport>    in,
                                int64_t&       i64)        const;
 
-  uint32_t readString         (TTransport*    in,
+  uint32_t readString         (shared_ptr<TTransport>    in,
                                std::string&   str)        const;
 
 };