SimReqHandlerBase Class Reference

A SimEventQueue callback for SimModule. More...

#include <Simulation/SimReqHandler.H>

Inheritance diagram for SimReqHandlerBase:
Inheritance graph
[legend]
Collaboration diagram for SimReqHandlerBase:
Collaboration graph
[legend]

List of all members.

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 SimReqHandlerClientclient () const =0
 Get the SimReqHandlerClient.
const SimModulereqsrc () 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 SimModuleitsReqSrc

Detailed Description

A SimEventQueue callback for SimModule.

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.


Constructor & Destructor Documentation

SimReqHandlerBase::SimReqHandlerBase ( SimReqHandlerClient smod,
const SimModule reqsource = 0 
)

Constructor.

Definition at line 44 of file SimReqHandler.C.

References SimReqHandlerClient::registerSimReqHandler().

SimReqHandlerBase::~SimReqHandlerBase (  )  [inline, virtual]

Destructor.

Definition at line 222 of file SimReqHandler.H.


Member Function Documentation

virtual SimReqHandlerClient* SimReqHandlerBase::client (  )  const [pure virtual]
virtual void SimReqHandlerBase::execute ( SimEventQueue q,
rutz::shared_ptr< SimReq > &  e 
) [pure virtual]

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 >.

virtual const std::type_info& SimReqHandlerBase::mtype (  )  const [pure virtual]

What's our underlying SimReqHandlerClient (usually SimModule) type?

Forbidden in the base class.

Implemented in SimReqHandler< Module, Req >.

Referenced by toString().

const SimModule * SimReqHandlerBase::reqsrc (  )  const [inline]

Get the desired req source, if any.

Definition at line 225 of file SimReqHandler.H.

virtual const std::type_info& SimReqHandlerBase::rtype (  )  const [pure virtual]

What's our underlying SimReq type?

Forbidden in the base class.

Implemented in SimReqHandler< Module, Req >.

Referenced by SimEventQueue::registerSimReqHandlerClient(), and toString().

std::string SimReqHandlerBase::toString (  )  const [inline]

Get some string description of ourselves, for printing/debug.

Definition at line 228 of file SimReqHandler.H.

References rutz::demangled_name(), mtype(), rtype(), and sformat().

Referenced by SimEventQueue::registerSimReqHandlerClient().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:25:23 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3