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

Add missing underscores

parent cf00ec09
No related branches found
No related tags found
No related merge requests found
...@@ -42,22 +42,22 @@ ...@@ -42,22 +42,22 @@
* Usage of the include() function: * Usage of the include() function:
* *
* @code * @code
* void foo(String<MAXARGLENGTH> b) { * void foo(String<MAX_ARG_LENGTH> b) {
* std::cout << "SPAAAACE!" << std::endl; * std::cout << "SPAAAACE!" << std::endl;
* } * }
* *
* void bar(String<MAXARGLENGTH> b) { * void bar(String<MAX_ARG_LENGTH> b) {
* std::cout << "I HAZ A CUBESAT THAT SNAPS PIX!" << std::endl; * std::cout << "I HAZ A CUBESAT THAT SNAPS PIX!" << std::endl;
* } * }
* *
* void baz(String<MAXARGLENGTH> b) { * void baz(String<MAX_ARG_LENGTH> b) {
* std::cout << "QWERTYUIOP" << std::endl; * std::cout << "QWERTYUIOP" << std::endl;
* } * }
* *
* FunctionManagementService::FunctionManagementService() { * FunctionManagementService::FunctionManagementService() {
* include(String<FUNCNAMELENGTH>("foo"), &foo); * include(String<FUNC_NAME_LENGTH>("foo"), &foo);
* include(String<FUNCNAMELENGTH>("bar"), &bar); * include(String<FUNC_NAME_LENGTH>("bar"), &bar);
* include(String<FUNCNAMELENGTH>("baz"), &baz); * include(String<FUNC_NAME_LENGTH>("baz"), &baz);
* } * }
*/ */
...@@ -97,11 +97,11 @@ public: ...@@ -97,11 +97,11 @@ public:
* TC [8,1] message. After inclusion it returns an unneeded int signalling insertion success * TC [8,1] message. After inclusion it returns an unneeded int signalling insertion success
* (0) or failure (2). These returns are there for testing purposes only. * (0) or failure (2). These returns are there for testing purposes only.
* *
* @param funcName the function's name. Max. length is MAXFUNCNAMELENGTH bytes. * @param funcName the function's name. Max. length is FUNC_NAME_LENGTH bytes.
* @param ptr pointer to a function of void return type and a MAXARGLENGTH-lengthed byte * @param ptr pointer to a function of void return type and a MAX_ARG_LENGTH-lengthed byte
* string as argument (which contains the actual arguments of the function) * string as argument (which contains the actual arguments of the function)
*/ */
int include(String<FUNCNAMELENGTH> funcName, void(*ptr)(String<MAXARGLENGTH>)); int include(String<FUNC_NAME_LENGTH> funcName, void(*ptr)(String<MAX_ARG_LENGTH>));
}; };
#endif //ECSS_SERVICES_FUNCTIONMANAGEMENTSERVICE_HPP #endif //ECSS_SERVICES_FUNCTIONMANAGEMENTSERVICE_HPP
...@@ -9,13 +9,13 @@ int FunctionManagementService::call(Message& msg) { ...@@ -9,13 +9,13 @@ int FunctionManagementService::call(Message& msg) {
ErrorHandler::assertInternal(msg.messageType == 1 && msg.serviceType == 8, ErrorHandler::assertInternal(msg.messageType == 1 && msg.serviceType == 8,
ErrorHandler::InternalErrorType::UnacceptablePacket); ErrorHandler::InternalErrorType::UnacceptablePacket);
uint8_t funcName[FUNCNAMELENGTH]; // the function's name uint8_t funcName[FUNC_NAME_LENGTH]; // the function's name
uint8_t funcArgs[MAXARGLENGTH]; // arguments for the function uint8_t funcArgs[MAX_ARG_LENGTH]; // arguments for the function
msg.readString(funcName, FUNCNAMELENGTH); msg.readString(funcName, FUNC_NAME_LENGTH);
msg.readString(funcArgs, MAXARGLENGTH); msg.readString(funcArgs, MAX_ARG_LENGTH);
if (msg.dataSize > FUNCNAMELENGTH + MAXARGLENGTH) { if (msg.dataSize > FUNC_NAME_LENGTH + MAX_ARG_LENGTH) {
/** /**
* @todo Send failed start of execution (too long message) * @todo Send failed start of execution (too long message)
*/ */
...@@ -23,9 +23,9 @@ int FunctionManagementService::call(Message& msg) { ...@@ -23,9 +23,9 @@ int FunctionManagementService::call(Message& msg) {
} }
// locate the appropriate function pointer // locate the appropriate function pointer
String<FUNCNAMELENGTH> name(funcName); String<FUNC_NAME_LENGTH> name(funcName);
FunctionMap::iterator iter = funcPtrIndex.find(name); FunctionMap::iterator iter = funcPtrIndex.find(name);
void (*selected)(String<MAXARGLENGTH>); void (*selected)(String<MAX_ARG_LENGTH>);
if (iter != funcPtrIndex.end()) { if (iter != funcPtrIndex.end()) {
selected = *iter->second; selected = *iter->second;
...@@ -41,8 +41,8 @@ int FunctionManagementService::call(Message& msg) { ...@@ -41,8 +41,8 @@ int FunctionManagementService::call(Message& msg) {
return 0; return 0;
} }
int FunctionManagementService::include(String<FUNCNAMELENGTH> funcName, void(*ptr) int FunctionManagementService::include(String<FUNC_NAME_LENGTH> funcName, void(*ptr)
(String<MAXARGLENGTH>)) { (String<MAX_ARG_LENGTH>)) {
if (funcPtrIndex.full()) { if (funcPtrIndex.full()) {
/** /**
...@@ -51,7 +51,7 @@ int FunctionManagementService::include(String<FUNCNAMELENGTH> funcName, void(*pt ...@@ -51,7 +51,7 @@ int FunctionManagementService::include(String<FUNCNAMELENGTH> funcName, void(*pt
return 2; // arbitrary, for testing purposes return 2; // arbitrary, for testing purposes
} }
funcName.append(FUNCNAMELENGTH - funcName.length(), '\0'); funcName.append(FUNC_NAME_LENGTH - funcName.length(), '\0');
funcPtrIndex.insert(std::make_pair(funcName, ptr)); funcPtrIndex.insert(std::make_pair(funcName, ptr));
return 0; return 0;
......
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