THRIFT-922. cpp: Convert transport classes to use non-virtual calls
Update the thrift transport classes to use non-virtual calls for most
functions. The correct implementation is determined at compile time via
templates now. Only the base TTransport class falls back to using
virtual function calls.
git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@1005134 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/lib/cpp/src/TLogging.h b/lib/cpp/src/TLogging.h
index 2df82dd..54cccbe 100644
--- a/lib/cpp/src/TLogging.h
+++ b/lib/cpp/src/TLogging.h
@@ -160,4 +160,26 @@
#define T_LOG_OPER(format_string,...)
#endif
+
+/**
+ * T_GLOBAL_DEBUG_VIRTUAL = 0: normal operation,
+ * virtual call debug messages disabled
+ * T_GLOBAL_DEBUG_VIRTUAL = 1: log a debug messages whenever an
+ * avoidable virtual call is made
+ */
+#define T_GLOBAL_DEBUG_VIRTUAL 0
+
+/**
+ * Log a message indicating that a virtual function call is being made.
+ *
+ * This should be disabled during normal use. It is intended to be used
+ * only to help debug serialization performance.
+ */
+#if T_GLOBAL_DEBUG_VIRTUAL > 0
+ #define T_VIRTUAL_CALL() \
+ fprintf(stderr,"[%s,%d] virtual call\n", __FILE__, __LINE__)
+#else
+ #define T_VIRTUAL_CALL()
+#endif
+
#endif // #ifndef _THRIFT_TLOGGING_H_