summaryrefslogtreecommitdiff
path: root/src/components/include/utils
diff options
context:
space:
mode:
Diffstat (limited to 'src/components/include/utils')
-rw-r--r--src/components/include/utils/custom_string.h4
-rw-r--r--src/components/include/utils/logger.h24
-rw-r--r--src/components/include/utils/macro.h14
-rw-r--r--src/components/include/utils/message_queue.h15
-rw-r--r--src/components/include/utils/prioritized_queue.h4
-rw-r--r--src/components/include/utils/rwlock.h24
-rw-r--r--src/components/include/utils/scope_guard.h2
-rw-r--r--src/components/include/utils/semantic_version.h2
-rw-r--r--src/components/include/utils/threads/async_runner.h6
-rw-r--r--src/components/include/utils/threads/message_loop_thread.h2
-rw-r--r--src/components/include/utils/threads/thread.h4
-rw-r--r--src/components/include/utils/typed_enum_print.h2
12 files changed, 51 insertions, 52 deletions
diff --git a/src/components/include/utils/custom_string.h b/src/components/include/utils/custom_string.h
index 7b21e7a64d..0e5ef244f0 100644
--- a/src/components/include/utils/custom_string.h
+++ b/src/components/include/utils/custom_string.h
@@ -81,8 +81,8 @@ class CustomString {
CustomString(size_t n, char c);
/**
- * @brief Returns the length of the string, in terms of characters.
- */
+ * @brief Returns the length of the string, in terms of characters.
+ */
size_t size() const;
/**
diff --git a/src/components/include/utils/logger.h b/src/components/include/utils/logger.h
index 75daa552a2..907f8f4db0 100644
--- a/src/components/include/utils/logger.h
+++ b/src/components/include/utils/logger.h
@@ -35,13 +35,13 @@
#ifdef ENABLE_LOG
#include <errno.h>
-#include <string.h>
-#include <sstream>
#include <log4cxx/propertyconfigurator.h>
#include <log4cxx/spi/loggingevent.h>
-#include "utils/push_log.h"
-#include "utils/logger_status.h"
+#include <string.h>
+#include <sstream>
#include "utils/auto_trace.h"
+#include "utils/logger_status.h"
+#include "utils/push_log.h"
#endif // ENABLE_LOG
#ifdef ENABLE_LOG
@@ -121,15 +121,15 @@ log4cxx_time_t time_now();
#define LOG4CXX_FATAL(loggerPtr, logEvent) \
LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getFatal(), logEvent)
-#define LOG4CXX_ERROR_WITH_ERRNO(loggerPtr, message) \
- LOG4CXX_ERROR(loggerPtr, \
- message << ", error code " << errno << " (" << strerror(errno) \
- << ")")
+#define LOG4CXX_ERROR_WITH_ERRNO(loggerPtr, message) \
+ LOG4CXX_ERROR( \
+ loggerPtr, \
+ message << ", error code " << errno << " (" << strerror(errno) << ")")
-#define LOG4CXX_WARN_WITH_ERRNO(loggerPtr, message) \
- LOG4CXX_WARN(loggerPtr, \
- message << ", error code " << errno << " (" << strerror(errno) \
- << ")")
+#define LOG4CXX_WARN_WITH_ERRNO(loggerPtr, message) \
+ LOG4CXX_WARN( \
+ loggerPtr, \
+ message << ", error code " << errno << " (" << strerror(errno) << ")")
#else // ENABLE_LOG is OFF
diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h
index e6f3b6b3ca..00298f690e 100644
--- a/src/components/include/utils/macro.h
+++ b/src/components/include/utils/macro.h
@@ -40,7 +40,7 @@
#include "logger.h"
// A macro to set some action for variable to avoid "unused variable" warning
-#define UNUSED(x) (void) x;
+#define UNUSED(x) (void)x;
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
@@ -133,9 +133,9 @@
#endif
/*
-* @brief Calculate size of na array
-* @param arr array, which size need to calculate
-*/
+ * @brief Calculate size of na array
+ * @param arr array, which size need to calculate
+ */
#define ARRAYSIZE(arr) sizeof(arr) / sizeof(*arr)
#ifdef BUILD_TESTS
@@ -146,9 +146,9 @@
#endif // BUILD_TESTS
/*
-* @brief deprecate a method declaration, a warning will be thrown by your
-* compiler if a method with this macro is used
-*/
+ * @brief deprecate a method declaration, a warning will be thrown by your
+ * compiler if a method with this macro is used
+ */
#if __cplusplus > 201103L
#define DEPRECATED [[deprecated]]
#else
diff --git a/src/components/include/utils/message_queue.h b/src/components/include/utils/message_queue.h
index 093aa4cac2..8dfe7afa52 100644
--- a/src/components/include/utils/message_queue.h
+++ b/src/components/include/utils/message_queue.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_MESSAGE_QUEUE_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_MESSAGE_QUEUE_H_
-#include <queue>
#include <algorithm>
+#include <queue>
#include "utils/conditional_variable.h"
#include "utils/lock.h"
@@ -97,9 +97,9 @@ class MessageQueue {
void wait();
/**
- * \brief waitUntilEmpty message queue
- * Wait until message queue is empty
- */
+ * \brief waitUntilEmpty message queue
+ * Wait until message queue is empty
+ */
void WaitUntilEmpty();
/**
@@ -112,8 +112,8 @@ class MessageQueue {
void Shutdown();
/**
- * \brief Clears queue.
- */
+ * \brief Clears queue.
+ */
void Reset();
private:
@@ -131,8 +131,7 @@ class MessageQueue {
};
template <typename T, class Q>
-MessageQueue<T, Q>::MessageQueue()
- : shutting_down_(false) {}
+MessageQueue<T, Q>::MessageQueue() : shutting_down_(false) {}
template <typename T, class Q>
MessageQueue<T, Q>::~MessageQueue() {}
diff --git a/src/components/include/utils/prioritized_queue.h b/src/components/include/utils/prioritized_queue.h
index eb4ba6a6c3..a2eb200012 100644
--- a/src/components/include/utils/prioritized_queue.h
+++ b/src/components/include/utils/prioritized_queue.h
@@ -33,9 +33,9 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_PRIORITIZED_QUEUE_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_PRIORITIZED_QUEUE_H_
-#include <queue>
-#include <map>
#include <algorithm>
+#include <map>
+#include <queue>
#include "utils/macro.h"
diff --git a/src/components/include/utils/rwlock.h b/src/components/include/utils/rwlock.h
index b7e7484b48..5c7735713e 100644
--- a/src/components/include/utils/rwlock.h
+++ b/src/components/include/utils/rwlock.h
@@ -98,15 +98,15 @@ class RWLock {
bool TryAcquireForReading();
/**
- * @brief Try to Acqure read-write lock for writing.
- * Applies a write lock like AcquireForWriting(), with the exception that
+ * @brief Try to Acqure read-write lock for writing.
+ * Applies a write lock like AcquireForWriting(), with the exception that
* the
- * function fails if any thread currently holds rwlock (for reading or
+ * function fails if any thread currently holds rwlock (for reading or
* writing)
- * Invoke of TryAcquireForWriting will not block calling thread and returns
+ * Invoke of TryAcquireForWriting will not block calling thread and returns
* "false"
- * @returns true if lock was acquired and false if was not
- */
+ * @returns true if lock was acquired and false if was not
+ */
bool TryAcquireForWriting();
/**
@@ -126,12 +126,12 @@ class RWLock {
bool AcquireForWriting();
/**
- * @brief Release read-write lock.
- * Releases a lock held on the read-write lock object.
- * Results are undefined if the read-write lock rwlock
- * is not held by the calling thread.
- * @returns true if lock was released and false if was not
- */
+ * @brief Release read-write lock.
+ * Releases a lock held on the read-write lock object.
+ * Results are undefined if the read-write lock rwlock
+ * is not held by the calling thread.
+ * @returns true if lock was released and false if was not
+ */
bool Release();
private:
diff --git a/src/components/include/utils/scope_guard.h b/src/components/include/utils/scope_guard.h
index a425356c0e..a05be6dc11 100644
--- a/src/components/include/utils/scope_guard.h
+++ b/src/components/include/utils/scope_guard.h
@@ -322,5 +322,5 @@ ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(Obj& obj,
const P1& p1) {
return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
}
-}
+} // namespace utils
#endif // SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H_
diff --git a/src/components/include/utils/semantic_version.h b/src/components/include/utils/semantic_version.h
index 5fe7ce1deb..5b2f2a1cdf 100644
--- a/src/components/include/utils/semantic_version.h
+++ b/src/components/include/utils/semantic_version.h
@@ -120,6 +120,6 @@ struct SemanticVersion {
extern const SemanticVersion base_rpc_version;
extern const SemanticVersion rpc_version_5;
-}
+} // namespace utils
#endif // SRC_COMPONENTS_INCLUDE_UTILS_CALLABLE_H \ No newline at end of file
diff --git a/src/components/include/utils/threads/async_runner.h b/src/components/include/utils/threads/async_runner.h
index 64c9d09939..5c88112267 100644
--- a/src/components/include/utils/threads/async_runner.h
+++ b/src/components/include/utils/threads/async_runner.h
@@ -33,14 +33,14 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_THREADS_ASYNC_RUNNER_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_THREADS_ASYNC_RUNNER_H_
-#include <string>
#include <queue>
+#include <string>
-#include "thread_delegate.h"
#include "thread.h"
+#include "thread_delegate.h"
-#include "utils/lock.h"
#include "utils/conditional_variable.h"
+#include "utils/lock.h"
namespace threads {
diff --git a/src/components/include/utils/threads/message_loop_thread.h b/src/components/include/utils/threads/message_loop_thread.h
index add7fc38b8..26ae127b69 100644
--- a/src/components/include/utils/threads/message_loop_thread.h
+++ b/src/components/include/utils/threads/message_loop_thread.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_THREADS_MESSAGE_LOOP_THREAD_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_THREADS_MESSAGE_LOOP_THREAD_H_
-#include <string>
#include <queue>
+#include <string>
#include "utils/logger.h"
#include "utils/macro.h"
diff --git a/src/components/include/utils/threads/thread.h b/src/components/include/utils/threads/thread.h
index cba79b20bd..6f72679d63 100644
--- a/src/components/include/utils/threads/thread.h
+++ b/src/components/include/utils/threads/thread.h
@@ -40,11 +40,11 @@
#include <ostream>
#include <string>
+#include "utils/conditional_variable.h"
+#include "utils/lock.h"
#include "utils/macro.h"
#include "utils/threads/thread_delegate.h"
#include "utils/threads/thread_options.h"
-#include "utils/conditional_variable.h"
-#include "utils/lock.h"
namespace threads {
diff --git a/src/components/include/utils/typed_enum_print.h b/src/components/include/utils/typed_enum_print.h
index e2b903c948..0f3cc41bf8 100644
--- a/src/components/include/utils/typed_enum_print.h
+++ b/src/components/include/utils/typed_enum_print.h
@@ -33,8 +33,8 @@
#ifndef SRC_COMPONENTS_INCLUDE_UTILS_TYPED_ENUM_PRINT_H_
#define SRC_COMPONENTS_INCLUDE_UTILS_TYPED_ENUM_PRINT_H_
-#include <type_traits>
#include <ostream>
+#include <type_traits>
namespace utils {