Hi there, ( excuse my funny english :-)
I am to write ( re-re-rewrite/re-re-rethink like hell) yet another ncurses
based UI library. - Not the topic of my question though...
I am very well confortable with the drawing stuff and objects infrastructures...
Where I am stuck is about the object-to-object events relation.
Here below is a bit of code of the model I would want to create:
Code:
template < typename ClientClass, typename eventClass >
class ConnexionEvent{
...
public:
typedef int (ClientClass::*pCallbackT)(eventClass*);
pCallbackT method;
ConnexionEvent(pCallbackT classInstanceMethod, ...blah){
method = classInstanceMethod;
...blah
}
...
};
Notice the point:
Code:
...
typedef int (ClientClass::*pCallbackT)(eventClass*);
I sware this code compile without errors...
My limited knowledge of C++ template programming prevents me to implement a consistent container class to hold a list or map or whatever ; thus a common place into where I could retreive an instance of that ConnexionEvent<... , ...> node.
That is. My whish is to be able to call directly the client'method of the actual object instance for a particular event class...
I thought of a std::map<objclass*, void*, lessclass> containing ConnexionEvent<objclass,evclass> address as void*... I can't try it right now since my computer is now out of reach
BTW: I whish the gnu gcc C++ conceptors would/could implement something similar to the Trolltech's QT signal/slot ( moc ) so geniously straitforward mecanism
Tell me if it is impossible or if there are known solutions...
Thanks,
Bretzel