SimReqHandler< Module, Req > Class Template Reference

Template class for SimEventQueue requests. More...

#include <Simulation/SimReqHandler.H>

Inheritance diagram for SimReqHandler< Module, Req >:
Inheritance graph
[legend]
Collaboration diagram for SimReqHandler< Module, Req >:
Collaboration graph
[legend]

List of all members.

Public Types

typedef void(Module::* Method )(SimEventQueue &, rutz::shared_ptr< Req > &)
 Definition for the format and args of the called-back method.

Public Member Functions

 SimReqHandler (Module *mod, Method meth, const SimModule *reqsource=0)
 Constructor.
virtual ~SimReqHandler ()
 Destructor.
virtual const std::type_info & rtype () const
 What's our underlying SimReq type?
virtual const std::type_info & mtype () const
 What's our underlying SimReqHandlerClient (usually SimModule) type?
virtual SimReqHandlerClientclient () const
 Get the SimReqHandlerClient.
virtual void execute (SimEventQueue &q, rutz::shared_ptr< SimReq > &e)
 Call the callback.
template<class Module , class Req >
 SimReqHandler (Module *mod, SimReqHandler< Module, Req >::Method meth, const SimModule *source)

Detailed Description

template<class Module, class Req>
class SimReqHandler< Module, Req >

Template class for SimEventQueue requests.

Method 'meth' will be called by the SimEventQueue when a desired requesr is triggered. Typical usage is as follows:

in your .H:

  // your class should inherit from at least SimReqHandlerClient,
  // typically it will inherit from SimModule which itself iherits
  // from SimReqHandlerClient:
  class MySimModule : public SimModule {
  ...
  private:
  // our method to run when SimReqX is posted to the queue,
  // will be called by SimEventQueue:
  void processX(SimEventQueue& q, rutz::shared_ptr<SimReqX>& e);

  // a hook by which we will let our SimEventQueue know about processX():
  SimReqHandler<MySimModule, SimReqX> itsRHx;

in your .C, in the constructor of your class (which must be a SimReqHandlerClient derivative), in the initalizer list:

  MySimModule::MySimModule() :
  ...
  itsRHx(this, &MySimModule::processX),
  ...
  { ... }

and finally you also should implement MySimModule::processX().

Definition at line 144 of file SimReqHandler.H.


Member Typedef Documentation

template<class Module, class Req>
typedef void(Module::* SimReqHandler< Module, Req >::Method)(SimEventQueue &, rutz::shared_ptr< Req > &)

Definition for the format and args of the called-back method.

Definition at line 148 of file SimReqHandler.H.


Constructor & Destructor Documentation

template<class Module, class Req>
SimReqHandler< Module, Req >::SimReqHandler ( Module *  mod,
Method  meth,
const SimModule reqsource = 0 
) [inline]

Constructor.

template<class Module , class Req >
SimReqHandler< Module, Req >::~SimReqHandler (  )  [inline, virtual]

Destructor.

Definition at line 242 of file SimReqHandler.H.


Member Function Documentation

template<class Module , class Req >
SimReqHandlerClient * SimReqHandler< Module, Req >::client (  )  const [inline, virtual]

Get the SimReqHandlerClient.

Implements SimReqHandlerBase.

Definition at line 254 of file SimReqHandler.H.

template<class Module , class Req >
void SimReqHandler< Module, Req >::execute ( SimEventQueue q,
rutz::shared_ptr< SimReq > &  e 
) [inline, virtual]

Call the callback.

Implements SimReqHandlerBase.

Definition at line 259 of file SimReqHandler.H.

References rutz::demangled_name(), and rutz::shared_ptr< T >::is_valid().

template<class Module , class Req >
const std::type_info & SimReqHandler< Module, Req >::mtype (  )  const [inline, virtual]

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

Implements SimReqHandlerBase.

Definition at line 250 of file SimReqHandler.H.

template<class Module , class Req >
const std::type_info & SimReqHandler< Module, Req >::rtype (  )  const [inline, virtual]

What's our underlying SimReq type?

Implements SimReqHandlerBase.

Definition at line 246 of file SimReqHandler.H.


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