diff --git a/lib/cpp/Makefile.am b/lib/cpp/Makefile.am
index f36ac82..344e330 100644
--- a/lib/cpp/Makefile.am
+++ b/lib/cpp/Makefile.am
@@ -111,11 +111,11 @@
                          src/protocol/TCompactProtocol.h \
                          src/protocol/TDenseProtocol.h \
                          src/protocol/TDebugProtocol.h \
-                         src/protocol/TOneWayProtocol.h \
                          src/protocol/TBase64Utils.h \
                          src/protocol/TJSONProtocol.h \
                          src/protocol/TProtocolTap.h \
                          src/protocol/TProtocolException.h \
+                         src/protocol/TVirtualProtocol.h \
                          src/protocol/TProtocol.h
 
 include_transportdir = $(include_thriftdir)/transport
diff --git a/lib/cpp/src/protocol/TBinaryProtocol.h b/lib/cpp/src/protocol/TBinaryProtocol.h
index 7fd3de6..45c5842 100644
--- a/lib/cpp/src/protocol/TBinaryProtocol.h
+++ b/lib/cpp/src/protocol/TBinaryProtocol.h
@@ -21,6 +21,7 @@
 #define _THRIFT_PROTOCOL_TBINARYPROTOCOL_H_ 1
 
 #include "TProtocol.h"
+#include "TVirtualProtocol.h"
 
 #include <boost/shared_ptr.hpp>
 
@@ -31,7 +32,7 @@
  * binary format, essentially just spitting out the raw bytes.
  *
  */
-class TBinaryProtocol : public TProtocol {
+class TBinaryProtocol : public TVirtualProtocol<TBinaryProtocol> {
  protected:
   static const int32_t VERSION_MASK = 0xffff0000;
   static const int32_t VERSION_1 = 0x80010000;
@@ -39,7 +40,7 @@
 
  public:
   TBinaryProtocol(boost::shared_ptr<TTransport> trans) :
-    TProtocol(trans),
+    TVirtualProtocol<TBinaryProtocol>(trans),
     string_limit_(0),
     container_limit_(0),
     strict_read_(false),
@@ -52,7 +53,7 @@
                   int32_t container_limit,
                   bool strict_read,
                   bool strict_write) :
-    TProtocol(trans),
+    TVirtualProtocol<TBinaryProtocol>(trans),
     string_limit_(string_limit),
     container_limit_(container_limit),
     strict_read_(strict_read),
@@ -84,11 +85,11 @@
    * Writing functions.
    */
 
-  virtual uint32_t writeMessageBegin(const std::string& name,
-                                     const TMessageType messageType,
-                                     const int32_t seqid);
+  uint32_t writeMessageBegin(const std::string& name,
+                             const TMessageType messageType,
+                             const int32_t seqid);
 
-  virtual uint32_t writeMessageEnd();
+  uint32_t writeMessageEnd();
 
 
   uint32_t writeStructBegin(const char* name);
diff --git a/lib/cpp/src/protocol/TCompactProtocol.h b/lib/cpp/src/protocol/TCompactProtocol.h
index 1d940a2..77c4454 100644
--- a/lib/cpp/src/protocol/TCompactProtocol.h
+++ b/lib/cpp/src/protocol/TCompactProtocol.h
@@ -20,7 +20,7 @@
 #ifndef _THRIFT_PROTOCOL_TCOMPACTPROTOCOL_H_
 #define _THRIFT_PROTOCOL_TCOMPACTPROTOCOL_H_ 1
 
-#include "TProtocol.h"
+#include "TVirtualProtocol.h"
 
 #include <stack>
 #include <boost/shared_ptr.hpp>
@@ -30,7 +30,7 @@
 /**
  * C++ Implementation of the Compact Protocol as described in THRIFT-110
  */
-class TCompactProtocol : public TProtocol {
+class TCompactProtocol : public TVirtualProtocol<TCompactProtocol> {
 
  protected:
   static const int8_t  PROTOCOL_ID = 0x82;
@@ -86,7 +86,7 @@
 
  public:
   TCompactProtocol(boost::shared_ptr<TTransport> trans) :
-    TProtocol(trans),
+    TVirtualProtocol<TCompactProtocol>(trans),
     lastFieldId_(0),
     string_limit_(0),
     string_buf_(NULL),
@@ -99,7 +99,7 @@
   TCompactProtocol(boost::shared_ptr<TTransport> trans,
                    int32_t string_limit,
                    int32_t container_limit) :
-    TProtocol(trans),
+    TVirtualProtocol<TCompactProtocol>(trans),
     lastFieldId_(0),
     string_limit_(string_limit),
     string_buf_(NULL),
diff --git a/lib/cpp/src/protocol/TDebugProtocol.h b/lib/cpp/src/protocol/TDebugProtocol.h
index ab69e0c..1efcbd0 100644
--- a/lib/cpp/src/protocol/TDebugProtocol.h
+++ b/lib/cpp/src/protocol/TDebugProtocol.h
@@ -20,8 +20,7 @@
 #ifndef _THRIFT_PROTOCOL_TDEBUGPROTOCOL_H_
 #define _THRIFT_PROTOCOL_TDEBUGPROTOCOL_H_ 1
 
-#include "TProtocol.h"
-#include "TOneWayProtocol.h"
+#include "TVirtualProtocol.h"
 
 #include <boost/shared_ptr.hpp>
 
@@ -46,7 +45,7 @@
  * Reading from this protocol is not supported.
  *
  */
-class TDebugProtocol : public TWriteOnlyProtocol {
+class TDebugProtocol : public TVirtualProtocol<TDebugProtocol> {
  private:
   enum write_state_t
   { UNINIT
@@ -59,7 +58,7 @@
 
  public:
   TDebugProtocol(boost::shared_ptr<TTransport> trans)
-    : TWriteOnlyProtocol(trans, "TDebugProtocol")
+    : TVirtualProtocol<TDebugProtocol>(trans)
     , string_limit_(DEFAULT_STRING_LIMIT)
     , string_prefix_size_(DEFAULT_STRING_PREFIX_SIZE)
   {
@@ -78,11 +77,11 @@
   }
 
 
-  virtual uint32_t writeMessageBegin(const std::string& name,
-                                     const TMessageType messageType,
-                                     const int32_t seqid);
+  uint32_t writeMessageBegin(const std::string& name,
+                             const TMessageType messageType,
+                             const int32_t seqid);
 
-  virtual uint32_t writeMessageEnd();
+  uint32_t writeMessageEnd();
 
 
   uint32_t writeStructBegin(const char* name);
diff --git a/lib/cpp/src/protocol/TDenseProtocol.h b/lib/cpp/src/protocol/TDenseProtocol.h
index 7655a47..ca2d427 100644
--- a/lib/cpp/src/protocol/TDenseProtocol.h
+++ b/lib/cpp/src/protocol/TDenseProtocol.h
@@ -56,7 +56,8 @@
  * methods within our versions.
  *
  */
-class TDenseProtocol : public TBinaryProtocol {
+class TDenseProtocol
+  : public TVirtualProtocol<TDenseProtocol, TBinaryProtocol> {
  protected:
   static const int32_t VERSION_MASK = 0xffff0000;
   // VERSION_1 (0x80010000)  is taken by TBinaryProtocol.
@@ -72,7 +73,7 @@
    */
   TDenseProtocol(boost::shared_ptr<TTransport> trans,
                  TypeSpec* type_spec = NULL) :
-    TBinaryProtocol(trans),
+    TVirtualProtocol<TDenseProtocol, TBinaryProtocol>(trans),
     type_spec_(type_spec),
     standalone_(true)
   {}
@@ -89,56 +90,54 @@
    * Writing functions.
    */
 
-  virtual uint32_t writeMessageBegin(const std::string& name,
-                                     const TMessageType messageType,
-                                     const int32_t seqid);
+  uint32_t writeMessageBegin(const std::string& name,
+                             const TMessageType messageType,
+                             const int32_t seqid);
 
-  virtual uint32_t writeMessageEnd();
+  uint32_t writeMessageEnd();
 
 
-  virtual uint32_t writeStructBegin(const char* name);
+  uint32_t writeStructBegin(const char* name);
 
-  virtual uint32_t writeStructEnd();
+  uint32_t writeStructEnd();
 
-  virtual uint32_t writeFieldBegin(const char* name,
-                                   const TType fieldType,
-                                   const int16_t fieldId);
+  uint32_t writeFieldBegin(const char* name,
+                           const TType fieldType,
+                           const int16_t fieldId);
 
-  virtual uint32_t writeFieldEnd();
+  uint32_t writeFieldEnd();
 
-  virtual uint32_t writeFieldStop();
+  uint32_t writeFieldStop();
 
-  virtual uint32_t writeMapBegin(const TType keyType,
-                                 const TType valType,
-                                 const uint32_t size);
+  uint32_t writeMapBegin(const TType keyType,
+                         const TType valType,
+                         const uint32_t size);
 
-  virtual uint32_t writeMapEnd();
+  uint32_t writeMapEnd();
 
-  virtual uint32_t writeListBegin(const TType elemType,
-                                  const uint32_t size);
+  uint32_t writeListBegin(const TType elemType, const uint32_t size);
 
-  virtual uint32_t writeListEnd();
+  uint32_t writeListEnd();
 
-  virtual uint32_t writeSetBegin(const TType elemType,
-                                 const uint32_t size);
+  uint32_t writeSetBegin(const TType elemType, const uint32_t size);
 
-  virtual uint32_t writeSetEnd();
+  uint32_t writeSetEnd();
 
-  virtual uint32_t writeBool(const bool value);
+  uint32_t writeBool(const bool value);
 
-  virtual uint32_t writeByte(const int8_t byte);
+  uint32_t writeByte(const int8_t byte);
 
-  virtual uint32_t writeI16(const int16_t i16);
+  uint32_t writeI16(const int16_t i16);
 
-  virtual uint32_t writeI32(const int32_t i32);
+  uint32_t writeI32(const int32_t i32);
 
-  virtual uint32_t writeI64(const int64_t i64);
+  uint32_t writeI64(const int64_t i64);
 
-  virtual uint32_t writeDouble(const double dub);
+  uint32_t writeDouble(const double dub);
 
-  virtual uint32_t writeString(const std::string& str);
+  uint32_t writeString(const std::string& str);
 
-  virtual uint32_t writeBinary(const std::string& str);
+  uint32_t writeBinary(const std::string& str);
 
 
   /*
diff --git a/lib/cpp/src/protocol/TJSONProtocol.cpp b/lib/cpp/src/protocol/TJSONProtocol.cpp
index 2a9c8f0..ed2f518 100644
--- a/lib/cpp/src/protocol/TJSONProtocol.cpp
+++ b/lib/cpp/src/protocol/TJSONProtocol.cpp
@@ -357,7 +357,7 @@
 
 
 TJSONProtocol::TJSONProtocol(boost::shared_ptr<TTransport> ptrans) :
-  TProtocol(ptrans),
+  TVirtualProtocol<TJSONProtocol>(ptrans),
   context_(new TJSONContext()),
   reader_(*ptrans) {
 }
diff --git a/lib/cpp/src/protocol/TJSONProtocol.h b/lib/cpp/src/protocol/TJSONProtocol.h
index 2df499a..cd42f5e 100644
--- a/lib/cpp/src/protocol/TJSONProtocol.h
+++ b/lib/cpp/src/protocol/TJSONProtocol.h
@@ -20,7 +20,7 @@
 #ifndef _THRIFT_PROTOCOL_TJSONPROTOCOL_H_
 #define _THRIFT_PROTOCOL_TJSONPROTOCOL_H_ 1
 
-#include "TProtocol.h"
+#include "TVirtualProtocol.h"
 
 #include <stack>
 
@@ -92,7 +92,7 @@
  * transmission. I don't know of any work-around for this issue.
  *
  */
-class TJSONProtocol : public TProtocol {
+class TJSONProtocol : public TVirtualProtocol<TJSONProtocol> {
  public:
 
   TJSONProtocol(boost::shared_ptr<TTransport> ptrans);
diff --git a/lib/cpp/src/protocol/TOneWayProtocol.h b/lib/cpp/src/protocol/TOneWayProtocol.h
deleted file mode 100644
index 6f08fe1..0000000
--- a/lib/cpp/src/protocol/TOneWayProtocol.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-#ifndef _THRIFT_PROTOCOL_TONEWAYPROTOCOL_H_
-#define _THRIFT_PROTOCOL_TONEWAYPROTOCOL_H_ 1
-
-#include "TProtocol.h"
-
-namespace apache { namespace thrift { namespace protocol {
-
-/**
- * Abstract class for implementing a protocol that can only be written,
- * not read.
- *
- */
-class TWriteOnlyProtocol : public TProtocol {
- public:
-  /**
-   * @param subclass_name  The name of the concrete subclass.
-   */
-  TWriteOnlyProtocol(boost::shared_ptr<TTransport> trans,
-                     const std::string& subclass_name)
-    : TProtocol(trans)
-    , subclass_(subclass_name)
-  {}
-
-  // All writing functions remain abstract.
-
-  /**
-   * Reading functions all throw an exception.
-   */
-
-  uint32_t readMessageBegin(std::string& name,
-                            TMessageType& messageType,
-                            int32_t& seqid) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readMessageEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readStructBegin(std::string& name) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readStructEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readFieldBegin(std::string& name,
-                          TType& fieldType,
-                          int16_t& fieldId) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readFieldEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readMapBegin(TType& keyType,
-                        TType& valType,
-                        uint32_t& size) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readMapEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readListBegin(TType& elemType,
-                         uint32_t& size) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readListEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readSetBegin(TType& elemType,
-                        uint32_t& size) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readSetEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readBool(bool& value) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readByte(int8_t& byte) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readI16(int16_t& i16) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readI32(int32_t& i32) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readI64(int64_t& i64) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readDouble(double& dub) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readString(std::string& str) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
-  uint32_t readBinary(std::string& str) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support reading (yet).");
-  }
-
- private:
-  std::string subclass_;
-};
-
-
-/**
- * Abstract class for implementing a protocol that can only be read,
- * not written.
- *
- */
-class TReadOnlyProtocol : public TProtocol {
- public:
-  /**
-   * @param subclass_name  The name of the concrete subclass.
-   */
-  TReadOnlyProtocol(boost::shared_ptr<TTransport> trans,
-                    const std::string& subclass_name)
-    : TProtocol(trans)
-    , subclass_(subclass_name)
-  {}
-
-  // All reading functions remain abstract.
-
-  /**
-   * Writing functions all throw an exception.
-   */
-
-  uint32_t writeMessageBegin(const std::string& name,
-                             const TMessageType messageType,
-                             const int32_t seqid) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeMessageEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-
-  uint32_t writeStructBegin(const char* name) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeStructEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeFieldBegin(const char* name,
-                           const TType fieldType,
-                           const int16_t fieldId) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeFieldEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeFieldStop() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeMapBegin(const TType keyType,
-                         const TType valType,
-                         const uint32_t size) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeMapEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeListBegin(const TType elemType,
-                          const uint32_t size) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeListEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeSetBegin(const TType elemType,
-                         const uint32_t size) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeSetEnd() {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeBool(const bool value) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeByte(const int8_t byte) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeI16(const int16_t i16) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeI32(const int32_t i32) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeI64(const int64_t i64) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeDouble(const double dub) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeString(const std::string& str) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
-  uint32_t writeBinary(const std::string& str) {
-    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
-        subclass_ + " does not support writing (yet).");
-  }
-
- private:
-  std::string subclass_;
-};
-
-}}} // apache::thrift::protocol
-
-#endif // #ifndef _THRIFT_PROTOCOL_TBINARYPROTOCOL_H_
diff --git a/lib/cpp/src/protocol/TProtocol.h b/lib/cpp/src/protocol/TProtocol.h
index 2e24f75..6bf7e3b 100644
--- a/lib/cpp/src/protocol/TProtocol.h
+++ b/lib/cpp/src/protocol/TProtocol.h
@@ -165,6 +165,111 @@
   T_ONEWAY     = 4
 };
 
+
+/**
+ * Helper template for implementing TProtocol::skip().
+ *
+ * Templatized to avoid having to make virtual function calls.
+ */
+template <class Protocol_>
+uint32_t skip(Protocol_& prot, TType type) {
+  switch (type) {
+  case T_BOOL:
+    {
+      bool boolv;
+      return prot.readBool(boolv);
+    }
+  case T_BYTE:
+    {
+      int8_t bytev;
+      return prot.readByte(bytev);
+    }
+  case T_I16:
+    {
+      int16_t i16;
+      return prot.readI16(i16);
+    }
+  case T_I32:
+    {
+      int32_t i32;
+      return prot.readI32(i32);
+    }
+  case T_I64:
+    {
+      int64_t i64;
+      return prot.readI64(i64);
+    }
+  case T_DOUBLE:
+    {
+      double dub;
+      return prot.readDouble(dub);
+    }
+  case T_STRING:
+    {
+      std::string str;
+      return prot.readBinary(str);
+    }
+  case T_STRUCT:
+    {
+      uint32_t result = 0;
+      std::string name;
+      int16_t fid;
+      TType ftype;
+      result += prot.readStructBegin(name);
+      while (true) {
+        result += prot.readFieldBegin(name, ftype, fid);
+        if (ftype == T_STOP) {
+          break;
+        }
+        result += skip(prot, ftype);
+        result += prot.readFieldEnd();
+      }
+      result += prot.readStructEnd();
+      return result;
+    }
+  case T_MAP:
+    {
+      uint32_t result = 0;
+      TType keyType;
+      TType valType;
+      uint32_t i, size;
+      result += prot.readMapBegin(keyType, valType, size);
+      for (i = 0; i < size; i++) {
+        result += skip(prot, keyType);
+        result += skip(prot, valType);
+      }
+      result += prot.readMapEnd();
+      return result;
+    }
+  case T_SET:
+    {
+      uint32_t result = 0;
+      TType elemType;
+      uint32_t i, size;
+      result += prot.readSetBegin(elemType, size);
+      for (i = 0; i < size; i++) {
+        result += skip(prot, elemType);
+      }
+      result += prot.readSetEnd();
+      return result;
+    }
+  case T_LIST:
+    {
+      uint32_t result = 0;
+      TType elemType;
+      uint32_t i, size;
+      result += prot.readListBegin(elemType, size);
+      for (i = 0; i < size; i++) {
+        result += skip(prot, elemType);
+      }
+      result += prot.readListEnd();
+      return result;
+    }
+  default:
+    return 0;
+  }
+}
+
 /**
  * Abstract class for a thrift protocol driver. These are all the methods that
  * a protocol must implement. Essentially, there must be some way of reading
@@ -187,108 +292,324 @@
    * Writing functions.
    */
 
-  virtual uint32_t writeMessageBegin(const std::string& name,
-                                     const TMessageType messageType,
-                                     const int32_t seqid) = 0;
+  virtual uint32_t writeMessageBegin_virt(const std::string& name,
+                                          const TMessageType messageType,
+                                          const int32_t seqid) = 0;
 
-  virtual uint32_t writeMessageEnd() = 0;
+  virtual uint32_t writeMessageEnd_virt() = 0;
 
 
-  virtual uint32_t writeStructBegin(const char* name) = 0;
+  virtual uint32_t writeStructBegin_virt(const char* name) = 0;
 
-  virtual uint32_t writeStructEnd() = 0;
+  virtual uint32_t writeStructEnd_virt() = 0;
 
-  virtual uint32_t writeFieldBegin(const char* name,
-                                   const TType fieldType,
-                                   const int16_t fieldId) = 0;
+  virtual uint32_t writeFieldBegin_virt(const char* name,
+                                        const TType fieldType,
+                                        const int16_t fieldId) = 0;
 
-  virtual uint32_t writeFieldEnd() = 0;
+  virtual uint32_t writeFieldEnd_virt() = 0;
 
-  virtual uint32_t writeFieldStop() = 0;
+  virtual uint32_t writeFieldStop_virt() = 0;
 
-  virtual uint32_t writeMapBegin(const TType keyType,
-                                 const TType valType,
-                                 const uint32_t size) = 0;
+  virtual uint32_t writeMapBegin_virt(const TType keyType,
+                                      const TType valType,
+                                      const uint32_t size) = 0;
 
-  virtual uint32_t writeMapEnd() = 0;
+  virtual uint32_t writeMapEnd_virt() = 0;
 
-  virtual uint32_t writeListBegin(const TType elemType,
-                                  const uint32_t size) = 0;
+  virtual uint32_t writeListBegin_virt(const TType elemType,
+                                       const uint32_t size) = 0;
 
-  virtual uint32_t writeListEnd() = 0;
+  virtual uint32_t writeListEnd_virt() = 0;
 
-  virtual uint32_t writeSetBegin(const TType elemType,
-                                 const uint32_t size) = 0;
+  virtual uint32_t writeSetBegin_virt(const TType elemType,
+                                      const uint32_t size) = 0;
 
-  virtual uint32_t writeSetEnd() = 0;
+  virtual uint32_t writeSetEnd_virt() = 0;
 
-  virtual uint32_t writeBool(const bool value) = 0;
+  virtual uint32_t writeBool_virt(const bool value) = 0;
 
-  virtual uint32_t writeByte(const int8_t byte) = 0;
+  virtual uint32_t writeByte_virt(const int8_t byte) = 0;
 
-  virtual uint32_t writeI16(const int16_t i16) = 0;
+  virtual uint32_t writeI16_virt(const int16_t i16) = 0;
 
-  virtual uint32_t writeI32(const int32_t i32) = 0;
+  virtual uint32_t writeI32_virt(const int32_t i32) = 0;
 
-  virtual uint32_t writeI64(const int64_t i64) = 0;
+  virtual uint32_t writeI64_virt(const int64_t i64) = 0;
 
-  virtual uint32_t writeDouble(const double dub) = 0;
+  virtual uint32_t writeDouble_virt(const double dub) = 0;
 
-  virtual uint32_t writeString(const std::string& str) = 0;
+  virtual uint32_t writeString_virt(const std::string& str) = 0;
 
-  virtual uint32_t writeBinary(const std::string& str) = 0;
+  virtual uint32_t writeBinary_virt(const std::string& str) = 0;
+
+  uint32_t writeMessageBegin(const std::string& name,
+                             const TMessageType messageType,
+                             const int32_t seqid) {
+    T_VIRTUAL_CALL();
+    return writeMessageBegin_virt(name, messageType, seqid);
+  }
+
+  uint32_t writeMessageEnd() {
+    T_VIRTUAL_CALL();
+    return writeMessageEnd_virt();
+  }
+
+
+  uint32_t writeStructBegin(const char* name) {
+    T_VIRTUAL_CALL();
+    return writeStructBegin_virt(name);
+  }
+
+  uint32_t writeStructEnd() {
+    T_VIRTUAL_CALL();
+    return writeStructEnd_virt();
+  }
+
+  uint32_t writeFieldBegin(const char* name,
+                           const TType fieldType,
+                           const int16_t fieldId) {
+    T_VIRTUAL_CALL();
+    return writeFieldBegin_virt(name, fieldType, fieldId);
+  }
+
+  uint32_t writeFieldEnd() {
+    T_VIRTUAL_CALL();
+    return writeFieldEnd_virt();
+  }
+
+  uint32_t writeFieldStop() {
+    T_VIRTUAL_CALL();
+    return writeFieldStop_virt();
+  }
+
+  uint32_t writeMapBegin(const TType keyType,
+                         const TType valType,
+                         const uint32_t size) {
+    T_VIRTUAL_CALL();
+    return writeMapBegin_virt(keyType, valType, size);
+  }
+
+  uint32_t writeMapEnd() {
+    T_VIRTUAL_CALL();
+    return writeMapEnd_virt();
+  }
+
+  uint32_t writeListBegin(const TType elemType, const uint32_t size) {
+    T_VIRTUAL_CALL();
+    return writeListBegin_virt(elemType, size);
+  }
+
+  uint32_t writeListEnd() {
+    T_VIRTUAL_CALL();
+    return writeListEnd_virt();
+  }
+
+  uint32_t writeSetBegin(const TType elemType, const uint32_t size) {
+    T_VIRTUAL_CALL();
+    return writeSetBegin_virt(elemType, size);
+  }
+
+  uint32_t writeSetEnd() {
+    T_VIRTUAL_CALL();
+    return writeSetEnd_virt();
+  }
+
+  uint32_t writeBool(const bool value) {
+    T_VIRTUAL_CALL();
+    return writeBool_virt(value);
+  }
+
+  uint32_t writeByte(const int8_t byte) {
+    T_VIRTUAL_CALL();
+    return writeByte_virt(byte);
+  }
+
+  uint32_t writeI16(const int16_t i16) {
+    T_VIRTUAL_CALL();
+    return writeI16_virt(i16);
+  }
+
+  uint32_t writeI32(const int32_t i32) {
+    T_VIRTUAL_CALL();
+    return writeI32_virt(i32);
+  }
+
+  uint32_t writeI64(const int64_t i64) {
+    T_VIRTUAL_CALL();
+    return writeI64_virt(i64);
+  }
+
+  uint32_t writeDouble(const double dub) {
+    T_VIRTUAL_CALL();
+    return writeDouble_virt(dub);
+  }
+
+  uint32_t writeString(const std::string& str) {
+    T_VIRTUAL_CALL();
+    return writeString_virt(str);
+  }
+
+  uint32_t writeBinary(const std::string& str) {
+    T_VIRTUAL_CALL();
+    return writeBinary_virt(str);
+  }
 
   /**
    * Reading functions
    */
 
-  virtual uint32_t readMessageBegin(std::string& name,
-                                    TMessageType& messageType,
-                                    int32_t& seqid) = 0;
+  virtual uint32_t readMessageBegin_virt(std::string& name,
+                                         TMessageType& messageType,
+                                         int32_t& seqid) = 0;
 
-  virtual uint32_t readMessageEnd() = 0;
+  virtual uint32_t readMessageEnd_virt() = 0;
 
-  virtual uint32_t readStructBegin(std::string& name) = 0;
+  virtual uint32_t readStructBegin_virt(std::string& name) = 0;
 
-  virtual uint32_t readStructEnd() = 0;
+  virtual uint32_t readStructEnd_virt() = 0;
 
-  virtual uint32_t readFieldBegin(std::string& name,
-                                  TType& fieldType,
-                                  int16_t& fieldId) = 0;
+  virtual uint32_t readFieldBegin_virt(std::string& name,
+                                       TType& fieldType,
+                                       int16_t& fieldId) = 0;
 
-  virtual uint32_t readFieldEnd() = 0;
+  virtual uint32_t readFieldEnd_virt() = 0;
 
-  virtual uint32_t readMapBegin(TType& keyType,
-                                TType& valType,
-                                uint32_t& size) = 0;
+  virtual uint32_t readMapBegin_virt(TType& keyType,
+                                     TType& valType,
+                                     uint32_t& size) = 0;
 
-  virtual uint32_t readMapEnd() = 0;
+  virtual uint32_t readMapEnd_virt() = 0;
 
-  virtual uint32_t readListBegin(TType& elemType,
-                                 uint32_t& size) = 0;
+  virtual uint32_t readListBegin_virt(TType& elemType,
+                                      uint32_t& size) = 0;
 
-  virtual uint32_t readListEnd() = 0;
+  virtual uint32_t readListEnd_virt() = 0;
 
-  virtual uint32_t readSetBegin(TType& elemType,
-                                uint32_t& size) = 0;
+  virtual uint32_t readSetBegin_virt(TType& elemType,
+                                     uint32_t& size) = 0;
 
-  virtual uint32_t readSetEnd() = 0;
+  virtual uint32_t readSetEnd_virt() = 0;
 
-  virtual uint32_t readBool(bool& value) = 0;
+  virtual uint32_t readBool_virt(bool& value) = 0;
 
-  virtual uint32_t readByte(int8_t& byte) = 0;
+  virtual uint32_t readByte_virt(int8_t& byte) = 0;
 
-  virtual uint32_t readI16(int16_t& i16) = 0;
+  virtual uint32_t readI16_virt(int16_t& i16) = 0;
 
-  virtual uint32_t readI32(int32_t& i32) = 0;
+  virtual uint32_t readI32_virt(int32_t& i32) = 0;
 
-  virtual uint32_t readI64(int64_t& i64) = 0;
+  virtual uint32_t readI64_virt(int64_t& i64) = 0;
 
-  virtual uint32_t readDouble(double& dub) = 0;
+  virtual uint32_t readDouble_virt(double& dub) = 0;
 
-  virtual uint32_t readString(std::string& str) = 0;
+  virtual uint32_t readString_virt(std::string& str) = 0;
 
-  virtual uint32_t readBinary(std::string& str) = 0;
+  virtual uint32_t readBinary_virt(std::string& str) = 0;
+
+  uint32_t readMessageBegin(std::string& name,
+                            TMessageType& messageType,
+                            int32_t& seqid) {
+    T_VIRTUAL_CALL();
+    return readMessageBegin_virt(name, messageType, seqid);
+  }
+
+  uint32_t readMessageEnd() {
+    T_VIRTUAL_CALL();
+    return readMessageEnd_virt();
+  }
+
+  uint32_t readStructBegin(std::string& name) {
+    T_VIRTUAL_CALL();
+    return readStructBegin_virt(name);
+  }
+
+  uint32_t readStructEnd() {
+    T_VIRTUAL_CALL();
+    return readStructEnd_virt();
+  }
+
+  uint32_t readFieldBegin(std::string& name,
+                          TType& fieldType,
+                          int16_t& fieldId) {
+    T_VIRTUAL_CALL();
+    return readFieldBegin_virt(name, fieldType, fieldId);
+  }
+
+  uint32_t readFieldEnd() {
+    T_VIRTUAL_CALL();
+    return readFieldEnd_virt();
+  }
+
+  uint32_t readMapBegin(TType& keyType, TType& valType, uint32_t& size) {
+    T_VIRTUAL_CALL();
+    return readMapBegin_virt(keyType, valType, size);
+  }
+
+  uint32_t readMapEnd() {
+    T_VIRTUAL_CALL();
+    return readMapEnd_virt();
+  }
+
+  uint32_t readListBegin(TType& elemType, uint32_t& size) {
+    T_VIRTUAL_CALL();
+    return readListBegin_virt(elemType, size);
+  }
+
+  uint32_t readListEnd() {
+    T_VIRTUAL_CALL();
+    return readListEnd_virt();
+  }
+
+  uint32_t readSetBegin(TType& elemType, uint32_t& size) {
+    T_VIRTUAL_CALL();
+    return readSetBegin_virt(elemType, size);
+  }
+
+  uint32_t readSetEnd() {
+    T_VIRTUAL_CALL();
+    return readSetEnd_virt();
+  }
+
+  uint32_t readBool(bool& value) {
+    T_VIRTUAL_CALL();
+    return readBool_virt(value);
+  }
+
+  uint32_t readByte(int8_t& byte) {
+    T_VIRTUAL_CALL();
+    return readByte_virt(byte);
+  }
+
+  uint32_t readI16(int16_t& i16) {
+    T_VIRTUAL_CALL();
+    return readI16_virt(i16);
+  }
+
+  uint32_t readI32(int32_t& i32) {
+    T_VIRTUAL_CALL();
+    return readI32_virt(i32);
+  }
+
+  uint32_t readI64(int64_t& i64) {
+    T_VIRTUAL_CALL();
+    return readI64_virt(i64);
+  }
+
+  uint32_t readDouble(double& dub) {
+    T_VIRTUAL_CALL();
+    return readDouble_virt(dub);
+  }
+
+  uint32_t readString(std::string& str) {
+    T_VIRTUAL_CALL();
+    return readString_virt(str);
+  }
+
+  uint32_t readBinary(std::string& str) {
+    T_VIRTUAL_CALL();
+    return readBinary_virt(str);
+  }
 
   uint32_t readBool(std::vector<bool>::reference ref) {
     bool value;
@@ -301,101 +622,11 @@
    * Method to arbitrarily skip over data.
    */
   uint32_t skip(TType type) {
-    switch (type) {
-    case T_BOOL:
-      {
-        bool boolv;
-        return readBool(boolv);
-      }
-    case T_BYTE:
-      {
-        int8_t bytev;
-        return readByte(bytev);
-      }
-    case T_I16:
-      {
-        int16_t i16;
-        return readI16(i16);
-      }
-    case T_I32:
-      {
-        int32_t i32;
-        return readI32(i32);
-      }
-    case T_I64:
-      {
-        int64_t i64;
-        return readI64(i64);
-      }
-    case T_DOUBLE:
-      {
-        double dub;
-        return readDouble(dub);
-      }
-    case T_STRING:
-      {
-        std::string str;
-        return readBinary(str);
-      }
-    case T_STRUCT:
-      {
-        uint32_t result = 0;
-        std::string name;
-        int16_t fid;
-        TType ftype;
-        result += readStructBegin(name);
-        while (true) {
-          result += readFieldBegin(name, ftype, fid);
-          if (ftype == T_STOP) {
-            break;
-          }
-          result += skip(ftype);
-          result += readFieldEnd();
-        }
-        result += readStructEnd();
-        return result;
-      }
-    case T_MAP:
-      {
-        uint32_t result = 0;
-        TType keyType;
-        TType valType;
-        uint32_t i, size;
-        result += readMapBegin(keyType, valType, size);
-        for (i = 0; i < size; i++) {
-          result += skip(keyType);
-          result += skip(valType);
-        }
-        result += readMapEnd();
-        return result;
-      }
-    case T_SET:
-      {
-        uint32_t result = 0;
-        TType elemType;
-        uint32_t i, size;
-        result += readSetBegin(elemType, size);
-        for (i = 0; i < size; i++) {
-          result += skip(elemType);
-        }
-        result += readSetEnd();
-        return result;
-      }
-    case T_LIST:
-      {
-        uint32_t result = 0;
-        TType elemType;
-        uint32_t i, size;
-        result += readListBegin(elemType, size);
-        for (i = 0; i < size; i++) {
-          result += skip(elemType);
-        }
-        result += readListEnd();
-        return result;
-      }
-    default:
-      return 0;
-    }
+    T_VIRTUAL_CALL();
+    return skip_virt(type);
+  }
+  virtual uint32_t skip_virt(TType type) {
+    return ::apache::thrift::protocol::skip(*this, type);
   }
 
   inline boost::shared_ptr<TTransport> getTransport() {
diff --git a/lib/cpp/src/protocol/TProtocolTap.h b/lib/cpp/src/protocol/TProtocolTap.h
index 5580216..26fbd3a 100644
--- a/lib/cpp/src/protocol/TProtocolTap.h
+++ b/lib/cpp/src/protocol/TProtocolTap.h
@@ -20,7 +20,7 @@
 #ifndef _THRIFT_PROTOCOL_TPROTOCOLTAP_H_
 #define _THRIFT_PROTOCOL_TPROTOCOLTAP_H_ 1
 
-#include <protocol/TOneWayProtocol.h>
+#include <protocol/TVirtualProtocol.h>
 
 namespace apache { namespace thrift { namespace protocol {
 
@@ -32,44 +32,44 @@
  * second protocol object.
  *
  */
-class TProtocolTap : public TReadOnlyProtocol {
+class TProtocolTap : public TVirtualProtocol<TProtocolTap> {
  public:
    TProtocolTap(boost::shared_ptr<TProtocol> source,
                 boost::shared_ptr<TProtocol> sink)
-     : TReadOnlyProtocol(source->getTransport(), "TProtocolTap")
+     : TVirtualProtocol<TProtocolTap>(source->getTransport())
      , source_(source)
      , sink_(sink)
   {}
 
-  virtual uint32_t readMessageBegin(std::string& name,
-                                    TMessageType& messageType,
-                                    int32_t& seqid) {
+  uint32_t readMessageBegin(std::string& name,
+                            TMessageType& messageType,
+                            int32_t& seqid) {
     uint32_t rv = source_->readMessageBegin(name, messageType, seqid);
     sink_->writeMessageBegin(name, messageType, seqid);
     return rv;
   }
 
-  virtual uint32_t readMessageEnd() {
+  uint32_t readMessageEnd() {
     uint32_t rv = source_->readMessageEnd();
     sink_->writeMessageEnd();
     return rv;
   }
 
-  virtual uint32_t readStructBegin(std::string& name) {
+  uint32_t readStructBegin(std::string& name) {
     uint32_t rv = source_->readStructBegin(name);
     sink_->writeStructBegin(name.c_str());
     return rv;
   }
 
-  virtual uint32_t readStructEnd() {
+  uint32_t readStructEnd() {
     uint32_t rv = source_->readStructEnd();
     sink_->writeStructEnd();
     return rv;
   }
 
-  virtual uint32_t readFieldBegin(std::string& name,
-                                  TType& fieldType,
-                                  int16_t& fieldId) {
+  uint32_t readFieldBegin(std::string& name,
+                          TType& fieldType,
+                          int16_t& fieldId) {
     uint32_t rv = source_->readFieldBegin(name, fieldType, fieldId);
     if (fieldType == T_STOP) {
       sink_->writeFieldStop();
@@ -80,98 +80,96 @@
   }
 
 
-  virtual uint32_t readFieldEnd() {
+  uint32_t readFieldEnd() {
     uint32_t rv = source_->readFieldEnd();
     sink_->writeFieldEnd();
     return rv;
   }
 
-  virtual uint32_t readMapBegin(TType& keyType,
-                                TType& valType,
-                                uint32_t& size) {
+  uint32_t readMapBegin(TType& keyType,
+                        TType& valType,
+                        uint32_t& size) {
     uint32_t rv = source_->readMapBegin(keyType, valType, size);
     sink_->writeMapBegin(keyType, valType, size);
     return rv;
   }
 
 
-  virtual uint32_t readMapEnd() {
+  uint32_t readMapEnd() {
     uint32_t rv = source_->readMapEnd();
     sink_->writeMapEnd();
     return rv;
   }
 
-  virtual uint32_t readListBegin(TType& elemType,
-                                 uint32_t& size) {
+  uint32_t readListBegin(TType& elemType, uint32_t& size) {
     uint32_t rv = source_->readListBegin(elemType, size);
     sink_->writeListBegin(elemType, size);
     return rv;
   }
 
 
-  virtual uint32_t readListEnd() {
+  uint32_t readListEnd() {
     uint32_t rv = source_->readListEnd();
     sink_->writeListEnd();
     return rv;
   }
 
-  virtual uint32_t readSetBegin(TType& elemType,
-                                uint32_t& size) {
+  uint32_t readSetBegin(TType& elemType, uint32_t& size) {
     uint32_t rv = source_->readSetBegin(elemType, size);
     sink_->writeSetBegin(elemType, size);
     return rv;
   }
 
 
-  virtual uint32_t readSetEnd() {
+  uint32_t readSetEnd() {
     uint32_t rv = source_->readSetEnd();
     sink_->writeSetEnd();
     return rv;
   }
 
-  virtual uint32_t readBool(bool& value) {
+  uint32_t readBool(bool& value) {
     uint32_t rv = source_->readBool(value);
     sink_->writeBool(value);
     return rv;
   }
 
-  virtual uint32_t readByte(int8_t& byte) {
+  uint32_t readByte(int8_t& byte) {
     uint32_t rv = source_->readByte(byte);
     sink_->writeByte(byte);
     return rv;
   }
 
-  virtual uint32_t readI16(int16_t& i16) {
+  uint32_t readI16(int16_t& i16) {
     uint32_t rv = source_->readI16(i16);
     sink_->writeI16(i16);
     return rv;
   }
 
-  virtual uint32_t readI32(int32_t& i32) {
+  uint32_t readI32(int32_t& i32) {
     uint32_t rv = source_->readI32(i32);
     sink_->writeI32(i32);
     return rv;
   }
 
-  virtual uint32_t readI64(int64_t& i64) {
+  uint32_t readI64(int64_t& i64) {
     uint32_t rv = source_->readI64(i64);
     sink_->writeI64(i64);
     return rv;
   }
 
-  virtual uint32_t readDouble(double& dub) {
+  uint32_t readDouble(double& dub) {
     uint32_t rv = source_->readDouble(dub);
     sink_->writeDouble(dub);
     return rv;
   }
 
-  virtual uint32_t readString(std::string& str) {
+  uint32_t readString(std::string& str) {
     uint32_t rv = source_->readString(str);
     sink_->writeString(str);
     return rv;
   }
 
-  virtual uint32_t readBinary(std::string& str) {
+  uint32_t readBinary(std::string& str) {
     uint32_t rv = source_->readBinary(str);
     sink_->writeBinary(str);
     return rv;
diff --git a/lib/cpp/src/protocol/TVirtualProtocol.h b/lib/cpp/src/protocol/TVirtualProtocol.h
new file mode 100644
index 0000000..7f01570
--- /dev/null
+++ b/lib/cpp/src/protocol/TVirtualProtocol.h
@@ -0,0 +1,495 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#ifndef _THRIFT_PROTOCOL_TVIRTUALPROTOCOL_H_
+#define _THRIFT_PROTOCOL_TVIRTUALPROTOCOL_H_ 1
+
+#include <protocol/TProtocol.h>
+
+namespace apache { namespace thrift { namespace protocol {
+
+using apache::thrift::transport::TTransport;
+
+/**
+ * Helper class that provides default implementations of TProtocol methods.
+ *
+ * This class provides default implementations of the non-virtual TProtocol
+ * methods.  It exists primarily so TVirtualProtocol can derive from it.  It
+ * prevents TVirtualProtocol methods from causing infinite recursion if the
+ * non-virtual methods are not overridden by the TVirtualProtocol subclass.
+ *
+ * You probably don't want to use this class directly.  Use TVirtualProtocol
+ * instead.
+ */
+class TProtocolDefaults : public TProtocol {
+ public:
+  uint32_t readMessageBegin(std::string& name,
+                            TMessageType& messageType,
+                            int32_t& seqid) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readMessageEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readStructBegin(std::string& name) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readStructEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readFieldBegin(std::string& name,
+                          TType& fieldType,
+                          int16_t& fieldId) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readFieldEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readMapBegin(TType& keyType, TType& valType, uint32_t& size) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readMapEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readListBegin(TType& elemType, uint32_t& size) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readListEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readSetBegin(TType& elemType, uint32_t& size) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readSetEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readBool(bool& value) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readByte(int8_t& byte) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readI16(int16_t& i16) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readI32(int32_t& i32) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readI64(int64_t& i64) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readDouble(double& dub) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readString(std::string& str) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t readBinary(std::string& str) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support reading (yet).");
+  }
+
+  uint32_t writeMessageBegin(const std::string& name,
+                             const TMessageType messageType,
+                             const int32_t seqid) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeMessageEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+
+  uint32_t writeStructBegin(const char* name) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeStructEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeFieldBegin(const char* name,
+                           const TType fieldType,
+                           const int16_t fieldId) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeFieldEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeFieldStop() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeMapBegin(const TType keyType,
+                         const TType valType,
+                         const uint32_t size) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeMapEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeListBegin(const TType elemType, const uint32_t size) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeListEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeSetBegin(const TType elemType, const uint32_t size) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeSetEnd() {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeBool(const bool value) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeByte(const int8_t byte) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeI16(const int16_t i16) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeI32(const int32_t i32) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeI64(const int64_t i64) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeDouble(const double dub) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeString(const std::string& str) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t writeBinary(const std::string& str) {
+    throw TProtocolException(TProtocolException::NOT_IMPLEMENTED,
+                             "this protocol does not support writing (yet).");
+  }
+
+  uint32_t skip(TType type) {
+    return ::apache::thrift::protocol::skip(*this, type);
+  }
+
+ protected:
+  TProtocolDefaults(boost::shared_ptr<TTransport> ptrans)
+    : TProtocol(ptrans)
+  {}
+};
+
+/**
+ * Concrete TProtocol classes should inherit from TVirtualProtocol
+ * so they don't have to manually override virtual methods.
+ */
+template <class Protocol_, class Super_=TProtocolDefaults>
+class TVirtualProtocol : public Super_ {
+ public:
+  /**
+   * Writing functions.
+   */
+
+  virtual uint32_t writeMessageBegin_virt(const std::string& name,
+                                          const TMessageType messageType,
+                                          const int32_t seqid) {
+    return static_cast<Protocol_*>(this)->writeMessageBegin(name, messageType,
+                                                            seqid);
+  }
+
+  virtual uint32_t writeMessageEnd_virt() {
+    return static_cast<Protocol_*>(this)->writeMessageEnd();
+  }
+
+
+  virtual uint32_t writeStructBegin_virt(const char* name) {
+    return static_cast<Protocol_*>(this)->writeStructBegin(name);
+  }
+
+  virtual uint32_t writeStructEnd_virt() {
+    return static_cast<Protocol_*>(this)->writeStructEnd();
+  }
+
+  virtual uint32_t writeFieldBegin_virt(const char* name,
+                                        const TType fieldType,
+                                        const int16_t fieldId) {
+    return static_cast<Protocol_*>(this)->writeFieldBegin(name, fieldType,
+                                                          fieldId);
+  }
+
+  virtual uint32_t writeFieldEnd_virt() {
+    return static_cast<Protocol_*>(this)->writeFieldEnd();
+  }
+
+  virtual uint32_t writeFieldStop_virt() {
+    return static_cast<Protocol_*>(this)->writeFieldStop();
+  }
+
+  virtual uint32_t writeMapBegin_virt(const TType keyType,
+                                      const TType valType,
+                                      const uint32_t size) {
+    return static_cast<Protocol_*>(this)->writeMapBegin(keyType, valType, size);
+  }
+
+  virtual uint32_t writeMapEnd_virt() {
+    return static_cast<Protocol_*>(this)->writeMapEnd();
+  }
+
+  virtual uint32_t writeListBegin_virt(const TType elemType,
+                                       const uint32_t size) {
+    return static_cast<Protocol_*>(this)->writeListBegin(elemType, size);
+  }
+
+  virtual uint32_t writeListEnd_virt() {
+    return static_cast<Protocol_*>(this)->writeListEnd();
+  }
+
+  virtual uint32_t writeSetBegin_virt(const TType elemType,
+                                      const uint32_t size) {
+    return static_cast<Protocol_*>(this)->writeSetBegin(elemType, size);
+  }
+
+  virtual uint32_t writeSetEnd_virt() {
+    return static_cast<Protocol_*>(this)->writeSetEnd();
+  }
+
+  virtual uint32_t writeBool_virt(const bool value) {
+    return static_cast<Protocol_*>(this)->writeBool(value);
+  }
+
+  virtual uint32_t writeByte_virt(const int8_t byte) {
+    return static_cast<Protocol_*>(this)->writeByte(byte);
+  }
+
+  virtual uint32_t writeI16_virt(const int16_t i16) {
+    return static_cast<Protocol_*>(this)->writeI16(i16);
+  }
+
+  virtual uint32_t writeI32_virt(const int32_t i32) {
+    return static_cast<Protocol_*>(this)->writeI32(i32);
+  }
+
+  virtual uint32_t writeI64_virt(const int64_t i64) {
+    return static_cast<Protocol_*>(this)->writeI64(i64);
+  }
+
+  virtual uint32_t writeDouble_virt(const double dub) {
+    return static_cast<Protocol_*>(this)->writeDouble(dub);
+  }
+
+  virtual uint32_t writeString_virt(const std::string& str) {
+    return static_cast<Protocol_*>(this)->writeString(str);
+  }
+
+  virtual uint32_t writeBinary_virt(const std::string& str) {
+    return static_cast<Protocol_*>(this)->writeBinary(str);
+  }
+
+  /**
+   * Reading functions
+   */
+
+  virtual uint32_t readMessageBegin_virt(std::string& name,
+                                         TMessageType& messageType,
+                                         int32_t& seqid) {
+    return static_cast<Protocol_*>(this)->readMessageBegin(name, messageType,
+                                                           seqid);
+  }
+
+  virtual uint32_t readMessageEnd_virt() {
+    return static_cast<Protocol_*>(this)->readMessageEnd();
+  }
+
+  virtual uint32_t readStructBegin_virt(std::string& name) {
+    return static_cast<Protocol_*>(this)->readStructBegin(name);
+  }
+
+  virtual uint32_t readStructEnd_virt() {
+    return static_cast<Protocol_*>(this)->readStructEnd();
+  }
+
+  virtual uint32_t readFieldBegin_virt(std::string& name,
+                                       TType& fieldType,
+                                       int16_t& fieldId) {
+    return static_cast<Protocol_*>(this)->readFieldBegin(name, fieldType,
+                                                         fieldId);
+  }
+
+  virtual uint32_t readFieldEnd_virt() {
+    return static_cast<Protocol_*>(this)->readFieldEnd();
+  }
+
+  virtual uint32_t readMapBegin_virt(TType& keyType,
+                                     TType& valType,
+                                     uint32_t& size) {
+    return static_cast<Protocol_*>(this)->readMapBegin(keyType, valType, size);
+  }
+
+  virtual uint32_t readMapEnd_virt() {
+    return static_cast<Protocol_*>(this)->readMapEnd();
+  }
+
+  virtual uint32_t readListBegin_virt(TType& elemType,
+                                      uint32_t& size) {
+    return static_cast<Protocol_*>(this)->readListBegin(elemType, size);
+  }
+
+  virtual uint32_t readListEnd_virt() {
+    return static_cast<Protocol_*>(this)->readListEnd();
+  }
+
+  virtual uint32_t readSetBegin_virt(TType& elemType,
+                                     uint32_t& size) {
+    return static_cast<Protocol_*>(this)->readSetBegin(elemType, size);
+  }
+
+  virtual uint32_t readSetEnd_virt() {
+    return static_cast<Protocol_*>(this)->readSetEnd();
+  }
+
+  virtual uint32_t readBool_virt(bool& value) {
+    return static_cast<Protocol_*>(this)->readBool(value);
+  }
+
+  virtual uint32_t readByte_virt(int8_t& byte) {
+    return static_cast<Protocol_*>(this)->readByte(byte);
+  }
+
+  virtual uint32_t readI16_virt(int16_t& i16) {
+    return static_cast<Protocol_*>(this)->readI16(i16);
+  }
+
+  virtual uint32_t readI32_virt(int32_t& i32) {
+    return static_cast<Protocol_*>(this)->readI32(i32);
+  }
+
+  virtual uint32_t readI64_virt(int64_t& i64) {
+    return static_cast<Protocol_*>(this)->readI64(i64);
+  }
+
+  virtual uint32_t readDouble_virt(double& dub) {
+    return static_cast<Protocol_*>(this)->readDouble(dub);
+  }
+
+  virtual uint32_t readString_virt(std::string& str) {
+    return static_cast<Protocol_*>(this)->readString(str);
+  }
+
+  virtual uint32_t readBinary_virt(std::string& str) {
+    return static_cast<Protocol_*>(this)->readBinary(str);
+  }
+
+  virtual uint32_t skip_virt(TType type) {
+    return static_cast<Protocol_*>(this)->skip(type);
+  }
+
+  /*
+   * Provide a default skip() implementation that uses non-virtual read
+   * methods.
+   *
+   * Note: subclasses that use TVirtualProtocol to derive from another protocol
+   * implementation (i.e., not TProtocolDefaults) should beware that this may
+   * override any non-default skip() implementation provided by the parent
+   * transport class.  They may need to explicitly redefine skip() to call the
+   * correct parent implementation, if desired.
+   */
+  uint32_t skip(TType type) {
+    Protocol_* const prot = static_cast<Protocol_*>(this);
+    return ::apache::thrift::protocol::skip(*prot, type);
+  }
+
+ protected:
+  TVirtualProtocol(boost::shared_ptr<TTransport> ptrans)
+    : Super_(ptrans)
+  {}
+};
+
+}}} // apache::thrift::protocol
+
+#endif // #define _THRIFT_PROTOCOL_TVIRTUALPROTOCOL_H_ 1
