Skip to content
Snippets Groups Projects
Commit cf00ec09 authored by Grigoris Pavlakis's avatar Grigoris Pavlakis Committed by kongr45gpen
Browse files

Add code review suggestions

parent d6321cac
No related branches found
No related tags found
No related merge requests found
......@@ -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 {
......
#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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment