I am using Arduino C++11
I want to create and execute a dynamically function pointer list from different instantiated class members. A function holding the dynamic list of funtion pointerns is called in the main program. I have tried several solutions, but I am stuck.
I hope the the framework below is sufficient documentation. If not please let me know.
class base {
// base class for holding global static functions. Shall not be instatited.
// if necessary, change class to namespace or struct.
private:
friend class class_inp;
friend class class_out;
static void base_add_funtion_pointer_from_instatiated_class_member
(/* function pointer upddate_event_control() */) {
// what do do?
}
public:
static void execute_dynamic_list_of_instatiated_function_pointers() {
// how to do it?
}
};
Two class with identical functions to call
class class_inp : public base {
public:
class_inp (bool eventSwitch) {
base_add_funtion_pointer_from_instatiated_class_member
(/* function pointer from upddate_event_control() */);
}
void upddate_event_control();
};
class class_out : public base {
public:
class_out (/* arguments*/) {
base_add_funtion_pointer_from_instatiated_class_member
(/* function pointer from upddate_event_control() */);
}
void upddate_event_control();
};
Main program
class_inp inp;
class_out out;
// Arduino main
void loop() {
base::execute_dynamic_list_of_instatiated_function_pointers();
delay(1); // waith 1 millisecond
}