From cf00ec0931a79f0e1d192e76c295341227f13337 Mon Sep 17 00:00:00 2001
From: Grigoris Pavlakis <gregory.pavlakis@gmail.com>
Date: Sat, 30 Mar 2019 18:58:30 +0000
Subject: [PATCH] Add code review suggestions

---
 inc/Services/FunctionManagementService.hpp | 33 ++++++++++++++++++----
 src/Services/FunctionManagementService.cpp | 30 --------------------
 2 files changed, 28 insertions(+), 35 deletions(-)

diff --git a/inc/Services/FunctionManagementService.hpp b/inc/Services/FunctionManagementService.hpp
index a4973dd5..1c2f74e6 100644
--- a/inc/Services/FunctionManagementService.hpp
+++ b/inc/Services/FunctionManagementService.hpp
@@ -11,9 +11,9 @@
 #include "Message.hpp"
 #include "Service.hpp"
 
-#define FUNCMAPSIZE     128     // size of the function map (number of elements)
-#define FUNCNAMELENGTH  32      // max length of the function name
-#define MAXARGLENGTH    32      // maximum argument byte string length
+#define FUNC_MAP_SIZE     128     // size of the function map (number of elements)
+#define FUNC_NAME_LENGTH  32      // max length of the function name
+#define MAX_ARG_LENGTH    32      // maximum argument byte string length
 
 /**
  * @todo: Undef TESTMODE before flight!!!!
@@ -38,8 +38,31 @@
  * @author Grigoris Pavlakis <grigpavl@ece.auth.gr>
  */
 
-typedef String<FUNCNAMELENGTH> functionName;
-typedef etl::map<functionName, void(*)(String<MAXARGLENGTH>), FUNCMAPSIZE>
+ /**
+ * Usage of the include() function:
+ *
+ * @code
+ * void foo(String<MAXARGLENGTH> b) {
+ * 		std::cout << "SPAAAACE!" << std::endl;
+ * 	}
+ *
+ * void bar(String<MAXARGLENGTH> b) {
+ * 		std::cout << "I HAZ A CUBESAT THAT SNAPS PIX!" << std::endl;
+ * 	}
+ *
+ * void baz(String<MAXARGLENGTH> b) {
+ * 		std::cout << "QWERTYUIOP" << std::endl;
+ * 	}
+ *
+ * 	FunctionManagementService::FunctionManagementService() {
+ * 		include(String<FUNCNAMELENGTH>("foo"), &foo);
+ * 		include(String<FUNCNAMELENGTH>("bar"), &bar);
+ * 		include(String<FUNCNAMELENGTH>("baz"), &baz);
+ * 	}
+ */
+
+typedef String<FUNC_NAME_LENGTH> functionName;
+typedef etl::map<functionName, void(*)(String<MAX_ARG_LENGTH>), FUNC_MAP_SIZE>
 FunctionMap;
 
 class FunctionManagementService : public Service {
diff --git a/src/Services/FunctionManagementService.cpp b/src/Services/FunctionManagementService.cpp
index c727e00d..252bd4fc 100644
--- a/src/Services/FunctionManagementService.cpp
+++ b/src/Services/FunctionManagementService.cpp
@@ -1,35 +1,5 @@
 #include "Services/FunctionManagementService.hpp"
 
-/**
- * Usage of the include() function:
- *
- * void foo(String<MAXARGLENGTH> b) {
- * 		std::cout << "SPAAAACE!" << std::endl;
- * 	}
- *
- * void bar(String<MAXARGLENGTH> b) {
- * 		std::cout << "I HAZ A CUBESAT THAT SNAPS PIX!" << std::endl;
- * 	}
- *
- * void baz(String<MAXARGLENGTH> b) {
- * 		std::cout << "QWERTYUIOP" << std::endl;
- * 	}
- *
- * 	FunctionManagementService::FunctionManagementService() {
- * 		include(String<FUNCNAMELENGTH>("foo"), &foo);
- * 		include(String<FUNCNAMELENGTH>("bar"), &bar);
- * 		include(String<FUNCNAMELENGTH>("baz"), &baz);
- * 	}
- */
-
-/*
- * FunctionManagementService::FunctionManagementService() {
- * All the functions that should be included in the pointer map at initialization shall be here.
- * and included as in the examples above.
- *
- * }
- */
-
 int FunctionManagementService::call(Message& msg) {
 	/**
 	 * @todo: Add test for message and service type using the ErrorHandler
-- 
GitLab