#include <typeinfo>
#include "rutz/shared_ptr.h"
#include "rutz/demangle.h"
#include "Simulation/SimEventQueueFlag.H"
#include "Util/log.H"
#include "Util/sformat.H"
Go to the source code of this file.
Classes | |
class | SimReqHandlerBase |
A SimEventQueue callback for SimModule. More... | |
class | SimReqHandler< Module, Req > |
Template class for SimEventQueue requests. More... | |
Defines | |
#define | SIMREQHANDLER_DECLARE(classname, reqname) |
Macro to declare a SimReqHandler (use in your .H). | |
#define | SIMREQHANDLER_INIT(reqname,...) itsReqHandler##reqname(this, &itsSimReqClassTypeFor##reqname::handle##reqname, ## __VA_ARGS__ ) |
Init a SimReqHandler created by SIMREQHANDLER_DECLARE. |
Handle SimReq requests
Definition in file SimReqHandler.H.
#define SIMREQHANDLER_DECLARE | ( | classname, | |||
reqname | ) |
void handle##reqname(SimEventQueue& q, rutz::shared_ptr<reqname>& e); \ typedef classname itsSimReqClassTypeFor##reqname; \ SimReqHandler<classname, reqname> itsReqHandler##reqname;
Macro to declare a SimReqHandler (use in your .H).
This will declare a SimReqHandler called itsReqHandler[reqname] and a function called handle[reqname] which you will need to implement. For example:
is equivalent to:
void handleSimReqVCXfeatures(SimEventQueue& q, rutz::shared_ptr<SimReqVCXfeatures>& e); SimReqHandler<VisualCortex, SimReqVCXfeatures> itsReqHandlerSimReqVCXfeatures;
then make sure you use the macro SIMCALLBACK_INIT in your class constructor, and that you implement onSimReqInputFrame() somewhere in your .C file. In our example:
VisualCortex::VisualCortex(...) : ..., SIMREQHANDLER_INIT(SimReqVCXfeatures) { } void VisualCortex::handleSimReqVCXfeatures(SimEventQueue& q, rutz::shared_ptr<SimReqVCXfeatures>& e) { do_something(); }
Have a look at VisualCortex and other modules in src/Neuro for examples of usage.
Definition at line 207 of file SimReqHandler.H.
#define SIMREQHANDLER_INIT | ( | reqname, | |||
... | ) | itsReqHandler##reqname(this, &itsSimReqClassTypeFor##reqname::handle##reqname, ## __VA_ARGS__ ) |
Init a SimReqHandler created by SIMREQHANDLER_DECLARE.
Takes possible optional arguments which are the ones that have default values in the SimReqHandler constructor, namely: const SimModule* source = 0.
Definition at line 216 of file SimReqHandler.H.