Hi all. I have been stuck on this idea for days now. From my understanding, to call a member function by pointer, I will need two things: A pointer to the class and a pointer to the function. With that said, my two files are exeFunc.h and exeFunc.cpp Their code consist of:
exeFunc.h
exeFunc.cppCode:/* File: exeFunc.h Header file for exeFunc Library. */ #ifndef EXEFUNC_H #define EXEFUNC_H #include "mbed.h" #include "msExtensions.h" #include "cfExtensions.h" #include "GenericFunctionHandler.h" #include <map> #include <utility> class exeFunc { public: exeFunc(msExtensions &msExt, cfExtensions &cfExt); void _exeCallback(); private: void _splitFuncFromCmd(); void _attachCallback(); msExtensions &_msExt; cfExtensions &_cfExt; }; #endif
I already have my instantiated objects _msExt(msExt) and _cfExt(cfExt). I would like to use void exeFunc::_exeCallback() function as the function to finally execute the function from the object and the member function that were typed into the arguments of exeCallback(). For example, if I type _exeCallback(&_cfExt, &cfExtensions::checkConfigForFirstStart) that should execute the member function. That is the part that I am having a hard time with. What should I do to achieve this without using bind?Code:/* File: exeFunc.cpp Execute functions in other Sensor libraries/classes Constructor */ #include "mbed.h" #include "ConfigFile.h" #include "msExtensions.h" #include "cfExtensions.h" #include "exeFunc.h" #include <map> #include <string> using namespace std; exeFunc::exeFunc(msExtensions &msExt, cfExtensions &cfExt) : _msExt(msExt), _cfExt(cfExt) { } void exeFunc::_splitFuncFromCmd() { } void exeFunc::_exeCallback() { }



LinkBack URL
About LinkBacks


