From 5c5b866a67a39940f413e492cc9587173ad4d8aa Mon Sep 17 00:00:00 2001
From: Sergey Yakubov <sergey.yakubov@desy.de>
Date: Thu, 30 Nov 2017 17:52:48 +0100
Subject: [PATCH] update source with google style

---
 common/cpp/include/common/networking.h        | 69 +++++++++----------
 common/cpp/include/common/os.h                | 15 ++--
 common/cpp/unittests/test_common.cpp          |  5 +-
 producer/api/include/producer/producer.h      | 24 +++----
 producer/api/src/producer/producer.cpp        | 10 ++-
 producer/api/unittests/test_producer.cpp      | 19 +++--
 .../inotify-event-detector-cpp/src/main.cpp   | 19 +++--
 .../unittests/test_inotify_client.cpp         |  5 +-
 8 files changed, 77 insertions(+), 89 deletions(-)

diff --git a/common/cpp/include/common/networking.h b/common/cpp/include/common/networking.h
index fb0fdadb6..590ccfa66 100644
--- a/common/cpp/include/common/networking.h
+++ b/common/cpp/include/common/networking.h
@@ -4,41 +4,40 @@
 #include <cstdint>
 #include "os.h"
 
-namespace HIDRA2
-{
-    enum OP_CODE : uint8_t {
-        OP_CODE__HELLO,
-    };
-
-    enum ERROR_CODE : uint16_t {
-        ERR__NO_ERROR,
-        ERR__UNSUPPORTED_VERSION,
-        ERR__INTERNAL_SERVER_ERROR = 65535,
-    };
-
-    struct NetworkRequest {
-        OP_CODE     op_code;
-        uint64_t    request_id;
-        char        data[];
-    };
-
-    struct NetworkResponse {
-        OP_CODE     op_code;
-        uint64_t    request_id;
-        ERROR_CODE  error_code;
-        char        data[];
-    };
-
-    struct OP_HelloRequest {
-        uint32_t client_version;
-
-        OS_TYPE os : 4;
-        bool is_x64 : 1;
-    };
-
-    struct OP_HelloResponse {
-        uint32_t server_version;
-    };
+namespace HIDRA2 {
+enum OP_CODE : uint8_t {
+  OP_CODE__HELLO,
+};
+
+enum ERROR_CODE : uint16_t {
+  ERR__NO_ERROR,
+  ERR__UNSUPPORTED_VERSION,
+  ERR__INTERNAL_SERVER_ERROR = 65535,
+};
+
+struct NetworkRequest {
+  OP_CODE     op_code;
+  uint64_t    request_id;
+  char        data[];
+};
+
+struct NetworkResponse {
+  OP_CODE     op_code;
+  uint64_t    request_id;
+  ERROR_CODE  error_code;
+  char        data[];
+};
+
+struct OP_HelloRequest {
+  uint32_t client_version;
+
+  OS_TYPE os : 4;
+  bool is_x64 : 1;
+};
+
+struct OP_HelloResponse {
+  uint32_t server_version;
+};
 }
 
 #endif //HIDRA2__COMMON_NETWORKING_H
diff --git a/common/cpp/include/common/os.h b/common/cpp/include/common/os.h
index 984756e0a..7b9adf120 100644
--- a/common/cpp/include/common/os.h
+++ b/common/cpp/include/common/os.h
@@ -3,15 +3,14 @@
 
 #include <cstdint>
 
-namespace HIDRA2
-{
-    enum OS_TYPE : uint8_t {
-        OS_UNKOWN,
-        OS_LINUX,
-        OS_WINDOWS,
+namespace HIDRA2 {
+enum OS_TYPE : uint8_t {
+  OS_UNKOWN,
+  OS_LINUX,
+  OS_WINDOWS,
 
-        OS_INVALID = 16, /* Never use more then 4 bit */
-    };
+  OS_INVALID = 16, /* Never use more then 4 bit */
+};
 }
 
 #endif //HIDRA2__COMMON_OS_H
diff --git a/common/cpp/unittests/test_common.cpp b/common/cpp/unittests/test_common.cpp
index 5f7937f18..34528ae8f 100644
--- a/common/cpp/unittests/test_common.cpp
+++ b/common/cpp/unittests/test_common.cpp
@@ -1,6 +1,5 @@
 #include <gtest/gtest.h>
 
-TEST(EMPTY, REMOVEME)
-{
-    EXPECT_EQ(1, 1);
+TEST(EMPTY, REMOVEME) {
+  EXPECT_EQ(1, 1);
 }
diff --git a/producer/api/include/producer/producer.h b/producer/api/include/producer/producer.h
index efcfb311d..5b9c919fc 100644
--- a/producer/api/include/producer/producer.h
+++ b/producer/api/include/producer/producer.h
@@ -3,21 +3,19 @@
 
 #include <string>
 
-namespace HIDRA2
-{
-    class Producer
-    {
-    private:
-        static unsigned long kinit_count_;
-        Producer();
-    public:
-        static const uint32_t VERSION;
+namespace HIDRA2 {
+class Producer {
+ private:
+  static unsigned long kinit_count_;
+  Producer();
+ public:
+  static const uint32_t VERSION;
 
-        Producer(const Producer&) = delete;
-        Producer& operator=(const Producer&) = delete;
+  Producer(const Producer&) = delete;
+  Producer& operator=(const Producer&) = delete;
 
-        static Producer* CreateProducer(std::string receiver_address);
-    };
+  static Producer* CreateProducer(std::string receiver_address);
+};
 }
 
 #endif //HIDRA2__PRODUCER_PRODUCER_H
diff --git a/producer/api/src/producer/producer.cpp b/producer/api/src/producer/producer.cpp
index dd530f97a..454d72d7c 100644
--- a/producer/api/src/producer/producer.cpp
+++ b/producer/api/src/producer/producer.cpp
@@ -3,12 +3,10 @@
 unsigned long HIDRA2::Producer::kinit_count_ = 0;
 const uint32_t HIDRA2::Producer::VERSION = 1;
 
-HIDRA2::Producer::Producer()
-{
-    kinit_count_++;
+HIDRA2::Producer::Producer() {
+  kinit_count_++;
 }
 
-HIDRA2::Producer *HIDRA2::Producer::CreateProducer(std::string receiver_address)
-{
-    return new Producer();
+HIDRA2::Producer *HIDRA2::Producer::CreateProducer(std::string receiver_address) {
+  return new Producer();
 }
diff --git a/producer/api/unittests/test_producer.cpp b/producer/api/unittests/test_producer.cpp
index edb6d762f..c5c6df802 100644
--- a/producer/api/unittests/test_producer.cpp
+++ b/producer/api/unittests/test_producer.cpp
@@ -1,16 +1,13 @@
 #include <gtest/gtest.h>
 #include <producer/producer.h>
 
-namespace
-{
-    TEST(VERSION, VersionAboveZero)
-    {
-        EXPECT_GE(HIDRA2::Producer::VERSION, 0);
-    }
+namespace {
+TEST(VERSION, VersionAboveZero) {
+  EXPECT_GE(HIDRA2::Producer::VERSION, 0);
+}
 
-    TEST(CreateProducer, PointerIsNotNullptr)
-    {
-        HIDRA2::Producer* prod = HIDRA2::Producer::CreateProducer("127.0.0.1");
-        EXPECT_NE(prod, nullptr);
-    }
+TEST(CreateProducer, PointerIsNotNullptr) {
+  HIDRA2::Producer* prod = HIDRA2::Producer::CreateProducer("127.0.0.1");
+  EXPECT_NE(prod, nullptr);
+}
 }
diff --git a/producer/inotify-event-detector-cpp/src/main.cpp b/producer/inotify-event-detector-cpp/src/main.cpp
index 0f7c8b6cf..f3b74fca6 100644
--- a/producer/inotify-event-detector-cpp/src/main.cpp
+++ b/producer/inotify-event-detector-cpp/src/main.cpp
@@ -1,17 +1,16 @@
 #include <producer/producer.h>
 #include <iostream>
 
-int main (int argc, char* argv[])
-{
-    std::cout << "Running producer version: " << HIDRA2::Producer::VERSION << std::endl;
+int main (int argc, char* argv[]) {
+  std::cout << "Running producer version: " << HIDRA2::Producer::VERSION << std::endl;
 
-    HIDRA2::Producer* producer = HIDRA2::Producer::CreateProducer("127.0.0.1");
-    if(!producer) {
-        std::cerr << "Fail to create producer" << std::endl;
-        return 1;
-    }
+  HIDRA2::Producer* producer = HIDRA2::Producer::CreateProducer("127.0.0.1");
+  if(!producer) {
+    std::cerr << "Fail to create producer" << std::endl;
+    return 1;
+  }
 
-    std::cout << "Successfully create producer " << std::hex << producer << std::endl;
+  std::cout << "Successfully create producer " << std::hex << producer << std::endl;
 
-    return 0;
+  return 0;
 }
diff --git a/producer/inotify-event-detector-cpp/unittests/test_inotify_client.cpp b/producer/inotify-event-detector-cpp/unittests/test_inotify_client.cpp
index 5f7937f18..34528ae8f 100644
--- a/producer/inotify-event-detector-cpp/unittests/test_inotify_client.cpp
+++ b/producer/inotify-event-detector-cpp/unittests/test_inotify_client.cpp
@@ -1,6 +1,5 @@
 #include <gtest/gtest.h>
 
-TEST(EMPTY, REMOVEME)
-{
-    EXPECT_EQ(1, 1);
+TEST(EMPTY, REMOVEME) {
+  EXPECT_EQ(1, 1);
 }
-- 
GitLab