Update Thrift CPP libraries to work with new generated source, change underlying buffers to use uint8_t* instead of std::string

Summary: Major overhaul to the CPP libraries.

Reviewed By: aditya

Test Plan: Again, keep an eye out for the unit tests commit

Notes: Initial perf tests show that Thrift is not only more robust than Pillar, but its implementation is actually around 10-20% faster. We can do about 10 RPC function calls with small data payloads in under 2ms. THAT IS FAST. THAT IS THRIFTY.




git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@664714 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/transport/TTransportException.h b/lib/cpp/transport/TTransportException.h
new file mode 100644
index 0000000..044e16d
--- /dev/null
+++ b/lib/cpp/transport/TTransportException.h
@@ -0,0 +1,63 @@
+#ifndef T_TRANSPORT_EXCEPTION_H
+#define T_TRANSPORT_EXCEPTION_H
+
+#include <string>
+
+/**
+ * Error codes for the various types of exceptions.
+ */
+enum TTransportExceptionType {
+  TTX_UNKNOWN = 0,
+  TTX_NOT_OPEN = 1,
+  TTX_TIMED_OUT = 2,
+};
+
+/**
+ * Class to encapsulate all the possible types of transport errors that may
+ * occur in various transport systems. This provides a sort of generic
+ * wrapper around the shitty UNIX E_ error codes that lets a common code
+ * base of error handling to be used for various types of transports, i.e.
+ * pipes etc.
+ *
+ * @author Mark Slee <mcslee@facebook.com>
+ */
+class TTransportException {
+ public:
+  TTransportException() :
+    type_(TTX_UNKNOWN), message_() {}
+
+  TTransportException(TTransportExceptionType type) :
+    type_(type), message_() {}
+
+  TTransportException(std::string message) :
+    type_(TTX_UNKNOWN), message_(message) {}
+
+  TTransportException(TTransportExceptionType type, std::string message) :
+    type_(type), message_(message) {}
+
+  ~TTransportException() {}
+
+  /**
+   * Returns an error code that provides information about the type of error
+   * that has occurred.
+   *
+   * @return Error code
+   */
+  TTransportExceptionType getType() { return type_; }
+ 
+  /**
+   * Returns an informative message about what caused this error.
+   *
+   * @return Error string
+   */
+  const std::string& getMessage() { return message_; }
+
+ protected:
+  /** Error code */
+  TTransportExceptionType type_;
+
+  /** Description */
+  std::string message_;
+};
+
+#endif