diff options
Diffstat (limited to 'include/grpc++')
-rw-r--r-- | include/grpc++/byte_buffer.h | 1 | ||||
-rw-r--r-- | include/grpc++/config.h | 24 | ||||
-rw-r--r-- | include/grpc++/time.h | 16 |
3 files changed, 25 insertions, 16 deletions
diff --git a/include/grpc++/byte_buffer.h b/include/grpc++/byte_buffer.h index ceb62622fd..3e40eaed1d 100644 --- a/include/grpc++/byte_buffer.h +++ b/include/grpc++/byte_buffer.h @@ -35,6 +35,7 @@ #define GRPCXX_BYTE_BUFFER_H #include <grpc/grpc.h> +#include <grpc/byte_buffer.h> #include <grpc/support/log.h> #include <grpc++/config.h> #include <grpc++/slice.h> diff --git a/include/grpc++/config.h b/include/grpc++/config.h index 55b2a64482..ca74064be2 100644 --- a/include/grpc++/config.h +++ b/include/grpc++/config.h @@ -46,7 +46,7 @@ #define GRPC_CXX0X_NO_OVERRIDE 1 #define GRPC_CXX0X_NO_CHRONO 1 #define GRPC_CXX0X_NO_THREAD 1 -#endif +#endif #endif // Visual Studio #ifndef __clang__ @@ -99,24 +99,28 @@ ::google::protobuf::io::ZeroCopyOutputStream #define GRPC_CUSTOM_ZEROCOPYINPUTSTREAM \ ::google::protobuf::io::ZeroCopyInputStream -#define GRPC_CUSTOM_CODEDINPUTSTREAM \ - ::google::protobuf::io::CodedInputStream +#define GRPC_CUSTOM_CODEDINPUTSTREAM ::google::protobuf::io::CodedInputStream #endif - #ifdef GRPC_CXX0X_NO_NULLPTR #include <memory> const class { -public: - template <class T> operator T*() const {return static_cast<T *>(0);} - template <class T> operator std::unique_ptr<T>() const { + public: + template <class T> + operator T *() const { + return static_cast<T *>(0); + } + template <class T> + operator std::unique_ptr<T>() const { return std::unique_ptr<T>(static_cast<T *>(0)); } - template <class T> operator std::shared_ptr<T>() const { + template <class T> + operator std::shared_ptr<T>() const { return std::shared_ptr<T>(static_cast<T *>(0)); } - operator bool() const {return false;} -private: + operator bool() const { return false; } + + private: void operator&() const = delete; } nullptr = {}; #endif diff --git a/include/grpc++/time.h b/include/grpc++/time.h index f9b2ce5cab..8fb2f8505c 100644 --- a/include/grpc++/time.h +++ b/include/grpc++/time.h @@ -52,22 +52,22 @@ namespace grpc { template <typename T> class TimePoint { public: - TimePoint(const T& time) { - you_need_a_specialization_of_TimePoint(); - } + TimePoint(const T& time) { you_need_a_specialization_of_TimePoint(); } gpr_timespec raw_time() { gpr_timespec t; return t; } + private: void you_need_a_specialization_of_TimePoint(); }; -template<> +template <> class TimePoint<gpr_timespec> { public: - TimePoint(const gpr_timespec& time) : time_(time) { } + TimePoint(const gpr_timespec& time) : time_(time) {} gpr_timespec raw_time() { return time_; } + private: gpr_timespec time_; }; @@ -85,6 +85,9 @@ namespace grpc { // from and to should be absolute time. void Timepoint2Timespec(const std::chrono::system_clock::time_point& from, gpr_timespec* to); +void TimepointHR2Timespec( + const std::chrono::high_resolution_clock::time_point& from, + gpr_timespec* to); std::chrono::system_clock::time_point Timespec2Timepoint(gpr_timespec t); @@ -92,9 +95,10 @@ template <> class TimePoint<std::chrono::system_clock::time_point> { public: TimePoint(const std::chrono::system_clock::time_point& time) { - Timepoint2Timespec(time, &time_); + Timepoint2Timespec(time, &time_); } gpr_timespec raw_time() const { return time_; } + private: gpr_timespec time_; }; |