From ba9a6e5998ef17f635f6c11ac9597fb6da7b309e Mon Sep 17 00:00:00 2001
From: Grigoris Pavlakis <grigpavl@ece.auth.gr>
Date: Wed, 2 Jan 2019 21:26:57 +0200
Subject: [PATCH] Update some docstrings and clean up an if statement

---
 inc/Services/FunctionManagementService.hpp | 14 +++++++++-----
 src/Services/FunctionManagementService.cpp |  8 ++------
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/inc/Services/FunctionManagementService.hpp b/inc/Services/FunctionManagementService.hpp
index 08f30c75..add0b031 100644
--- a/inc/Services/FunctionManagementService.hpp
+++ b/inc/Services/FunctionManagementService.hpp
@@ -2,7 +2,7 @@
 #define ECSS_SERVICES_FUNCTIONMANAGEMENTSERVICE_HPP
 
 #include <cstdint>
-#include <iostream> // TEMPORARY!
+#include <iostream> // USED BY THE SAMPLE FUNCTIONS ONLY!!
 #include <utility>
 #include <typeinfo>
 
@@ -10,9 +10,9 @@
 #include "etl/String.hpp"
 #include "Message.hpp"
 
-#define FUNCMAPSIZE        128      // size of the function map in bytes (temporary, arbitrary)
+#define FUNCMAPSIZE        128     // size of the function map in bytes (temporary, arbitrary)
 #define MAXFUNCNAMELENGTH  32      // max length of the function name (temporary, arbitrary)
-#define MAXARGLENGTH       32       // maximum argument byte string length
+#define MAXARGLENGTH       32      // maximum argument byte string length (temporary, arbitrary)
 
 /**
  * Implementation of the ST[08] function management service
@@ -21,7 +21,10 @@
  * ECSS-E-ST-70-41C, pages 157-159. Final implementation is dependent on subsystem requirements
  * which are, as of this writing, undefined yet.
  *
- * WARNING! Any string handling in this class involves non-null-terminated strings!
+ * Caveats:
+ * 1) Any string handling in this class involves **non-null-terminated strings**.
+ *
+ * You have been warned.
  *
  * @author Grigoris Pavlakis <grigpavl@ece.auth.gr>
  */
@@ -38,7 +41,8 @@ class FunctionManagementService {
 
 public:
 	/**
-	 * Constructs the function pointer index. All functions to be included shall be visible to it.
+	 * Constructs the function pointer index with all the necessary functions at initialization time
+	 * These functions need to be in scope.
 	 * @param None
 	 */
 	FunctionManagementService();
diff --git a/src/Services/FunctionManagementService.cpp b/src/Services/FunctionManagementService.cpp
index 313ee6d8..99d749f9 100644
--- a/src/Services/FunctionManagementService.cpp
+++ b/src/Services/FunctionManagementService.cpp
@@ -6,7 +6,6 @@ void dummy1(const String<MAXARGLENGTH> a) {
 	std::cout << a.c_str() << std::endl;
 }
 
-
 FunctionManagementService::FunctionManagementService() {
 	String<MAXFUNCNAMELENGTH> str("");
 	str.append("dummy1");
@@ -52,10 +51,7 @@ void FunctionManagementService::call(Message msg){
 	PointerMap::iterator iter = funcPtrIndex.find(name);
 	void(*selected)(String<MAXARGLENGTH>) = nullptr;
 
-	if (iter == funcPtrIndex.end()) {
-		std::cout << "ERROR: Malformed query." << std::endl;
-	}
-	else {
+	if (iter != funcPtrIndex.end()) {
 		selected = *iter->second;
 	}
 
@@ -67,6 +63,6 @@ void FunctionManagementService::call(Message msg){
 		return;
 	}
 
-	//  execute the function if there are no obvious flaws (defined in the standard, pg.158)
+	// execute the function if there are no obvious flaws (defined in the standard, pg.158)
 	selected(funcArgs);
 }
-- 
GitLab