summaryrefslogtreecommitdiffstats
path: root/registration.hpp
diff options
context:
space:
mode:
authorPatrick Venture <venture@google.com>2018-11-01 15:39:53 -0700
committerPatrick Venture <venture@google.com>2018-11-02 07:44:49 -0700
commitf78d90420967100233cc9c2a5e0834e9789e2637 (patch)
treea2acee81dcaa830217753a84acf5af7c92a9c3f5 /registration.hpp
parente84b4ddb671d97cb4725ee2de18979c69e42b971 (diff)
downloadopenpower-proc-control-f78d90420967100233cc9c2a5e0834e9789e2637.tar.gz
openpower-proc-control-f78d90420967100233cc9c2a5e0834e9789e2637.zip
add .clang-format
Add .clang-format for automatic style. Change-Id: I6d240009370179b5b8f1f646b0476a059ec6aa85 Signed-off-by: Patrick Venture <venture@google.com>
Diffstat (limited to 'registration.hpp')
-rw-r--r--registration.hpp67
1 files changed, 31 insertions, 36 deletions
diff --git a/registration.hpp b/registration.hpp
index d0dde00..0f093ff 100644
--- a/registration.hpp
+++ b/registration.hpp
@@ -1,9 +1,9 @@
#pragma once
#include <functional>
+#include <iostream>
#include <map>
#include <string>
-#include <iostream>
namespace openpower
{
@@ -18,13 +18,11 @@ using ProcedureMap = std::map<ProcedureName, ProcedureFunction>;
* This macro can be used in each procedure cpp file to make it
* available to the openpower-proc-control executable.
*/
-#define REGISTER_PROCEDURE(name, func) \
- namespace func##_ns \
- { \
- openpower::util::Registration r{ \
- std::move(name), std::move(func)}; \
- }
-
+#define REGISTER_PROCEDURE(name, func) \
+ namespace func##_ns \
+ { \
+ openpower::util::Registration r{std::move(name), std::move(func)}; \
+ }
/**
* Used to register procedures. Each procedure function can then
@@ -32,33 +30,30 @@ using ProcedureMap = std::map<ProcedureName, ProcedureFunction>;
*/
class Registration
{
- public:
-
- /**
- * Adds the procedure name and function to the internal
- * procedure map.
- *
- * @param[in] name - the procedure name
- * @param[in] function - the function to run
- */
- Registration(ProcedureName&& name,
- ProcedureFunction&& function)
- {
- procedures.emplace(std::move(name), std::move(function));
- }
-
- /**
- * Returns the map of procedures
- */
- static const ProcedureMap& getProcedures()
- {
- return procedures;
- }
-
- private:
-
- static ProcedureMap procedures;
+ public:
+ /**
+ * Adds the procedure name and function to the internal
+ * procedure map.
+ *
+ * @param[in] name - the procedure name
+ * @param[in] function - the function to run
+ */
+ Registration(ProcedureName&& name, ProcedureFunction&& function)
+ {
+ procedures.emplace(std::move(name), std::move(function));
+ }
+
+ /**
+ * Returns the map of procedures
+ */
+ static const ProcedureMap& getProcedures()
+ {
+ return procedures;
+ }
+
+ private:
+ static ProcedureMap procedures;
};
-}
-}
+} // namespace util
+} // namespace openpower
OpenPOWER on IntegriCloud