SimCallback< Module, Event > Class Template Reference

Template class for SimEventQueue callbacks. More...

#include <Simulation/SimCallback.H>

Inheritance diagram for SimCallback< Module, Event >:
Inheritance graph
[legend]
Collaboration diagram for SimCallback< Module, Event >:
Collaboration graph
[legend]

List of all members.

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 SimCallbackClientclient () 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)

Detailed Description

template<class Module, class Event>
class SimCallback< Module, Event >

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.


Member Typedef Documentation

template<class Module, class Event>
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.


Constructor & Destructor Documentation

template<class Module, class Event>
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.

template<class Module , class Event >
SimCallback< Module, Event >::~SimCallback (  )  [inline, virtual]

Destructor.

Definition at line 273 of file SimCallback.H.


Member Function Documentation

template<class Module , class Event >
SimCallbackClient * SimCallback< Module, Event >::client (  )  const [inline, virtual]

Get the SimCallbackClient.

Implements SimCallbackBase.

Definition at line 285 of file SimCallback.H.

template<class Module , class Event >
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.

template<class Module , class Event >
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().

template<class Module , class Event >
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.


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