aboutsummaryrefslogtreecommitdiffhomepage
path: root/include/grpc++/impl
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-08-18 09:33:44 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-08-18 09:33:44 -0700
commitd6c98df792198c5c9687ed35a676efbc5e621e0f (patch)
treed8dae211eb45035d095e4549ab5af439e67b22dc /include/grpc++/impl
parentbb1c795f998f052f854a6e1aeebff44e293a29f4 (diff)
clang-format all source
Diffstat (limited to 'include/grpc++/impl')
-rw-r--r--include/grpc++/impl/call.h24
-rw-r--r--include/grpc++/impl/grpc_library.h1
-rw-r--r--include/grpc++/impl/serialization_traits.h6
-rw-r--r--include/grpc++/impl/sync_no_cxx11.h8
-rw-r--r--include/grpc++/impl/thd_no_cxx11.h21
5 files changed, 26 insertions, 34 deletions
diff --git a/include/grpc++/impl/call.h b/include/grpc++/impl/call.h
index d49102fa3e..bc1db4c12c 100644
--- a/include/grpc++/impl/call.h
+++ b/include/grpc++/impl/call.h
@@ -67,14 +67,10 @@ class WriteOptions {
WriteOptions(const WriteOptions& other) : flags_(other.flags_) {}
/// Clear all flags.
- inline void Clear() {
- flags_ = 0;
- }
+ inline void Clear() { flags_ = 0; }
/// Returns raw flags bitset.
- inline gpr_uint32 flags() const {
- return flags_;
- }
+ inline gpr_uint32 flags() const { return flags_; }
/// Sets flag for the disabling of compression for the next message write.
///
@@ -122,9 +118,7 @@ class WriteOptions {
/// not go out on the wire immediately.
///
/// \sa GRPC_WRITE_BUFFER_HINT
- inline bool get_buffer_hint() const {
- return GetBit(GRPC_WRITE_BUFFER_HINT);
- }
+ inline bool get_buffer_hint() const { return GetBit(GRPC_WRITE_BUFFER_HINT); }
WriteOptions& operator=(const WriteOptions& rhs) {
flags_ = rhs.flags_;
@@ -132,17 +126,11 @@ class WriteOptions {
}
private:
- void SetBit(const gpr_int32 mask) {
- flags_ |= mask;
- }
+ void SetBit(const gpr_int32 mask) { flags_ |= mask; }
- void ClearBit(const gpr_int32 mask) {
- flags_ &= ~mask;
- }
+ void ClearBit(const gpr_int32 mask) { flags_ &= ~mask; }
- bool GetBit(const gpr_int32 mask) const {
- return flags_ & mask;
- }
+ bool GetBit(const gpr_int32 mask) const { return flags_ & mask; }
gpr_uint32 flags_;
};
diff --git a/include/grpc++/impl/grpc_library.h b/include/grpc++/impl/grpc_library.h
index f9fa677901..ce4211418d 100644
--- a/include/grpc++/impl/grpc_library.h
+++ b/include/grpc++/impl/grpc_library.h
@@ -46,5 +46,4 @@ class GrpcLibrary {
} // namespace grpc
-
#endif // GRPCXX_IMPL_GRPC_LIBRARY_H
diff --git a/include/grpc++/impl/serialization_traits.h b/include/grpc++/impl/serialization_traits.h
index 1f5c674e4c..3ea66a3405 100644
--- a/include/grpc++/impl/serialization_traits.h
+++ b/include/grpc++/impl/serialization_traits.h
@@ -37,12 +37,12 @@
namespace grpc {
/// Defines how to serialize and deserialize some type.
-///
+///
/// Used for hooking different message serialization API's into GRPC.
/// Each SerializationTraits implementation must provide the following
/// functions:
/// static Status Serialize(const Message& msg,
-/// grpc_byte_buffer** buffer,
+/// grpc_byte_buffer** buffer,
// bool* own_buffer);
/// static Status Deserialize(grpc_byte_buffer* buffer,
/// Message* msg,
@@ -57,7 +57,7 @@ namespace grpc {
/// msg. max_message_size is passed in as a bound on the maximum number of
/// message bytes Deserialize should accept.
///
-/// Both functions return a Status, allowing them to explain what went
+/// Both functions return a Status, allowing them to explain what went
/// wrong if required.
template <class Message,
class UnusedButHereForPartialTemplateSpecialization = void>
diff --git a/include/grpc++/impl/sync_no_cxx11.h b/include/grpc++/impl/sync_no_cxx11.h
index 5869b04c76..120a031045 100644
--- a/include/grpc++/impl/sync_no_cxx11.h
+++ b/include/grpc++/impl/sync_no_cxx11.h
@@ -38,7 +38,7 @@
namespace grpc {
-template<class mutex>
+template <class mutex>
class lock_guard;
class condition_variable;
@@ -46,6 +46,7 @@ class mutex {
public:
mutex() { gpr_mu_init(&mu_); }
~mutex() { gpr_mu_destroy(&mu_); }
+
private:
::gpr_mu mu_;
template <class mutex>
@@ -58,6 +59,7 @@ class lock_guard {
public:
lock_guard(mutex &mu) : mu_(mu), locked(true) { gpr_mu_lock(&mu.mu_); }
~lock_guard() { unlock_internal(); }
+
protected:
void lock_internal() {
if (!locked) gpr_mu_lock(&mu_.mu_);
@@ -67,6 +69,7 @@ class lock_guard {
if (locked) gpr_mu_unlock(&mu_.mu_);
locked = false;
}
+
private:
mutex &mu_;
bool locked;
@@ -76,7 +79,7 @@ class lock_guard {
template <class mutex>
class unique_lock : public lock_guard<mutex> {
public:
- unique_lock(mutex &mu) : lock_guard<mutex>(mu) { }
+ unique_lock(mutex &mu) : lock_guard<mutex>(mu) {}
void lock() { this->lock_internal(); }
void unlock() { this->unlock_internal(); }
};
@@ -92,6 +95,7 @@ class condition_variable {
}
void notify_one() { gpr_cv_signal(&cv_); }
void notify_all() { gpr_cv_broadcast(&cv_); }
+
private:
gpr_cv cv_;
};
diff --git a/include/grpc++/impl/thd_no_cxx11.h b/include/grpc++/impl/thd_no_cxx11.h
index a6bdd7dfe9..84d03ce184 100644
--- a/include/grpc++/impl/thd_no_cxx11.h
+++ b/include/grpc++/impl/thd_no_cxx11.h
@@ -40,7 +40,8 @@ namespace grpc {
class thread {
public:
- template<class T> thread(void (T::*fptr)(), T *obj) {
+ template <class T>
+ thread(void (T::*fptr)(), T *obj) {
func_ = new thread_function<T>(fptr, obj);
joined_ = false;
start();
@@ -53,28 +54,28 @@ class thread {
gpr_thd_join(thd_);
joined_ = true;
}
+
private:
void start() {
gpr_thd_options options = gpr_thd_options_default();
gpr_thd_options_set_joinable(&options);
- gpr_thd_new(&thd_, thread_func, (void *) func_, &options);
+ gpr_thd_new(&thd_, thread_func, (void *)func_, &options);
}
static void thread_func(void *arg) {
- thread_function_base *func = (thread_function_base *) arg;
+ thread_function_base *func = (thread_function_base *)arg;
func->call();
}
class thread_function_base {
public:
- virtual ~thread_function_base() { }
+ virtual ~thread_function_base() {}
virtual void call() = 0;
};
- template<class T>
+ template <class T>
class thread_function : public thread_function_base {
public:
- thread_function(void (T::*fptr)(), T *obj)
- : fptr_(fptr)
- , obj_(obj) { }
+ thread_function(void (T::*fptr)(), T *obj) : fptr_(fptr), obj_(obj) {}
virtual void call() { (obj_->*fptr_)(); }
+
private:
void (T::*fptr_)();
T *obj_;
@@ -84,8 +85,8 @@ class thread {
bool joined_;
// Disallow copy and assign.
- thread(const thread&);
- void operator=(const thread&);
+ thread(const thread &);
+ void operator=(const thread &);
};
} // namespace grpc