
#include <Simulation/SimReqHandler.H>
Inheritance diagram for SimReqHandlerBase:


This is the base class. We will then create template derived classes (see ModelParamBase and ModelParam for a similar idea). The basic idea here is that a SimModule should, at construction, declare a series of request handlers which SimEventQueue will automatically route when the appropriate SimReq objects are received by the queue. The standard C++ way of doing this typically would involve a callback class, and then derivatives of this, each one implementing the operator() in various ways (functor paradigm). However, this is not very convenient as typically the handler function would want to access the data members of its SimModule. Hence, we here use a different strategy, first declaring a function which is a member of SimModule and implements the actual code to be executed during callback, and second implementing a template "handler hook" whose role is just to connect that member function to the SimEventQueue. SimReqHandler is just the hook.
Definition at line 69 of file SimReqHandler.H.
Public Member Functions | |
| SimReqHandlerBase (SimReqHandlerClient *smod, const SimModule *reqsource=0) | |
| Constructor. | |
| virtual | ~SimReqHandlerBase () |
| Destructor. | |
| virtual const std::type_info & | rtype () const =0 |
| What's our underlying SimReq type? | |
| virtual const std::type_info & | mtype () const =0 |
| What's our underlying SimReqHandlerClient (usually SimModule) type? | |
| virtual SimReqHandlerClient * | client () const =0 |
| Get the SimReqHandlerClient. | |
| const SimModule * | reqsrc () const |
| Get the desired req source, if any. | |
| std::string | toString () const |
| Get some string description of ourselves, for printing/debug. | |
| virtual void | execute (SimEventQueue &q, rutz::shared_ptr< SimReq > &e)=0 |
| Execute the handler. | |
Protected Attributes | |
| const SimModule * | itsReqSrc |
|
||||||||||||
|
Constructor.
Definition at line 44 of file SimReqHandler.C. References SimReqHandlerClient::registerSimReqHandler(). |
|
|
Destructor.
Definition at line 51 of file SimReqHandler.C. |
|
|
Get the SimReqHandlerClient.
Implemented in SimReqHandler< Module, Req >. |
|
||||||||||||
|
Execute the handler. This will call the handler method on the req handler client, passing it the queue and the req. Implemented in SimReqHandler< Module, Req >. |
|
|
What's our underlying SimReqHandlerClient (usually SimModule) type? Forbidden in the base class. Implemented in SimReqHandler< Module, Req >. |
|
|
Get the desired req source, if any.
Definition at line 222 of file SimReqHandler.H. References itsReqSrc. |
|
|
What's our underlying SimReq type? Forbidden in the base class. Implemented in SimReqHandler< Module, Req >. Referenced by SimEventQueue::registerSimReqHandlerClient(). |
|
|
Get some string description of ourselves, for printing/debug.
Definition at line 225 of file SimReqHandler.H. References rutz::demangled_name(), and sformat(). Referenced by SimEventQueue::registerSimReqHandlerClient(). |
1.4.4