#define __COMMAND_CALLABLE_H
#include <string>
+#include <functional>
namespace command {
/**
* Callable behaviour class.
*/
- template<typename ArgumentType>
+ template<typename ParameterType>
class Callable {
protected:
/**
* Function handling user Arguments
*/
- void (*func)(ArgumentType);
+// void (*func)(ParameterType);
+ std::function<void(ParameterType)> func;
public:
/**
*
* @param function Function that will be invoked
*/
- Callable(void (*function)(ArgumentType))
+// Callable(void (*function)(ParameterType))
+// : func(function) {
+// }
+
+ Callable(std::function<void(ParameterType)> function)
: func(function) {
}
*
* @param value Value passed to program argument
*/
- void call(ArgumentType value) {
+ void call(ParameterType value) {
this->func(value);
}
};
/**
* Function handling user Arguments
*/
- void (*func)(void);
+// void (*func)(void);
+ std::function<void(void)> func;
public:
/**
*
* @param function Function that will be invoked
*/
- Callable(void (*function)(void))
+// Callable(void (*function)(void))
+// : func(function) {
+// }
+
+ Callable(std::function<void(void)> function)
: func(function) {
}
+
virtual ~Callable() { }
protected: