
Template class for SimEventQueue callbacks. More...
#include <Simulation/SimCallback.H>


Public Types | |
| typedef void(Module::* | Method )(SimEventQueue &, rutz::shared_ptr< Event > &) |
| Definition for the format and args of the called-back method. | |
Public Member Functions | |
| SimCallback (Module *mod, Method meth, const int priority=0, const SimEventQueueFlag flags=SEQ_UNMARKED|SEQ_MARK, const SimModule *eventsource=0) | |
| Constructor. | |
| virtual | ~SimCallback () |
| Destructor. | |
| virtual const std::type_info & | etype () const |
| What's our underlying SimEvent type? | |
| virtual const std::type_info & | mtype () const |
| What's our underlying SimCallbackClient (usually SimModule) type? | |
| virtual SimCallbackClient * | client () const |
| Get the SimCallbackClient. | |
| virtual void | execute (SimEventQueue &q, rutz::shared_ptr< SimEvent > &e) |
| Call the callback. | |
| template<class Module , class Event > | |
| SimCallback (Module *mod, SimCallback< Module, Event >::Method meth, const int priority, const SimEventQueueFlag flags, const SimModule *eventsource) | |
Template class for SimEventQueue callbacks.
Method 'meth' will be called by the SimEventQueue when a desired event is received. Typical usage is as follows:
in your .H:
// your class should inherit from at least SimCallbackClient, // typically it will inherit from SimModule which itself iherits // from SimCallbackClient: class MySimModule : public SimModule { ... private: // our method to run when SimEventX is posted to the queue, // will be called by SimEventQueue: void processX(SimEventQueue& q, rutz::shared_ptr<SimEventX>& e); // a hook by which we will let our SimEventQueue know about processX(): SimCallback<MySimModule, SimEventX> itsCBx;
in your .C, in the constructor of your class (which must be a SimCallbackClient derivative), in the initalizer list:
MySimModule::MySimModule() :
...
itsCBx(this, &MySimModule::processX),
...
{ ... }
and finally you also should implement MySimModule::processX().
Definition at line 155 of file SimCallback.H.
| typedef void(Module::* SimCallback< Module, Event >::Method)(SimEventQueue &, rutz::shared_ptr< Event > &) |
Definition for the format and args of the called-back method.
Definition at line 159 of file SimCallback.H.
| SimCallback< Module, Event >::SimCallback | ( | Module * | mod, | |
| Method | meth, | |||
| const int | priority = 0, |
|||
| const SimEventQueueFlag | flags = SEQ_UNMARKED|SEQ_MARK, |
|||
| const SimModule * | eventsource = 0 | |||
| ) | [inline] |
Constructor.
| SimCallback< Module, Event >::~SimCallback | ( | ) | [inline, virtual] |
Destructor.
Definition at line 273 of file SimCallback.H.
| SimCallbackClient * SimCallback< Module, Event >::client | ( | ) | const [inline, virtual] |
Get the SimCallbackClient.
Implements SimCallbackBase.
Definition at line 285 of file SimCallback.H.
| const std::type_info & SimCallback< Module, Event >::etype | ( | ) | const [inline, virtual] |
What's our underlying SimEvent type?
Implements SimCallbackBase.
Definition at line 277 of file SimCallback.H.
| void SimCallback< Module, Event >::execute | ( | SimEventQueue & | q, | |
| rutz::shared_ptr< SimEvent > & | e | |||
| ) | [inline, virtual] |
Call the callback.
Implements SimCallbackBase.
Definition at line 290 of file SimCallback.H.
References rutz::demangled_name(), and rutz::shared_ptr< T >::is_valid().
| const std::type_info & SimCallback< Module, Event >::mtype | ( | ) | const [inline, virtual] |
What's our underlying SimCallbackClient (usually SimModule) type?
Implements SimCallbackBase.
Definition at line 281 of file SimCallback.H.
1.6.3