FSM Macros | |
#define | FSM_MAXT 64 |
#define | FSM_Switch(fsm) |
#define | FSM_Transient(state) |
#define | FSM_Steady(state) |
#define | FSM_Enter(state) |
#define | FSM_Exit(state) |
#define | FSM_Goto(fsm, state) |
Watches | |
#define | WATCH(var) |
#define | LWATCH(var) |
Declaration macros | |
#define | Define_Network(NAME) |
#define | Define_Link(NAME, DELAY, ERROR, DATARATE) |
#define | Define_Function(NAME, ARGCOUNT) |
#define | Define_Function2(NAME, FUNCTION, ARGCOUNT) |
#define | Register_Class(CLASSNAME) |
Module declaration macros | |
#define | Define_Module(CLASSNAME) |
#define | Define_Module_Like(CLASSNAME, INTERFACENAME) |
#define | Module_Class_Members(CLASSNAME, BASECLASS, STACK) |
|
Registers a mathematical function that takes 0, 1, 2 or 3 double arguments and returns a double. The use of this macro allows the function to be used in expressions inside NED network descriptions. Commonly used <math.h> functions have Define_Function() lines in the OMNeT++ simulation kernel. |
|
Like Define_Function(), but takes three arguments, the second one being the pointer to the function. This macro allows registering a function with a different name than its implementation. |
|
Link type definition. The macro expands to the definition of a cLinkType object; the last three arguments are pointers to functions which dynamically create cPar objects an return their pointers. |
|
Announces the class as a module to OMNeT++ and couples it with the NED interface of the same name. The macro expands to the definition a cModuleType object. The NEDC compiler generates Define_Module() lines for all compound modules. However, it is the user's responsibility to put Define_Module() lines for all simple module types into one of the C++ sources. |
|
Similar to Define_Module(), except that it couples the class with the NED interface of the given name. This macro is used in connection with the 'like' phrase in NED. |
|
Network declaration macro. It can be found in code generated by the NEDC compiler. The use of this macro allows the creation of a network when only its name is available as a string. (Typically, the name of the network to be simulated is read from the configuration file.) The macro expands to the definition of a cNetworkType object. |
|
Within an FSM_Switch() case branch, declares code to be executed on entering the given state. No calls to FSM_Goto() are allowed within a state's Enter block.
|
|
Within an FSM_Switch() case branch, declares code to be executed on exiting the given state.
|
|
To be used in state exit code, to transition to another state. Uses stringize (state), so it only works correctly if 'state' is the enum name itself and not some variable that contains the state code.
|
|
After this many transitions without reaching a steady state we assume the FSM is in an infinite loop. |
|
Declares a steady state; to be used in enum which declares states. See example in FSM_Transient.
|
|
Implements a Finite State Machine. FSM state is stored in an object of type cFSM. There are two kinds of states: transient and steady. At each execution of the FSM_Switch() statement, the FSM transitions out of the current (steady) state, potentially undergoes a series of state changes to transient states, and arrives at another steady state. The actual FSM is embedded in an FSM_Switch(), which has cases for entering and leaving each state:
FSM_Switch(fsm) { case FSM_Exit(state1): //... break; case FSM_Enter(state1): //... break; case FSM_Exit(state2): //... break; case FSM_Enter(state2): //... break; //... } States are declared in enums, using the FSM_Transient() and FSM_Steady() macros. State transitions are done via calls to FSM_Goto(), which simply stores the new state in the cFSM object.
|
|
Declares a transient state; to be used in enum which declares states. Example:
enum { INIT = 0, SLEEP = FSM_Steady(1), ACTIVE = FSM_Steady(2), SEND = FSM_Transient(1), }; The numbers in parens must be unique within the state type and they are used for constructing numeric IDs for the states.
|
|
Like WATCH(), but may be executed more than once.
|
|
This macro facilitates the declaration of a simple module class, and it expands to the definition of mandatory member functions. (Currently only a constructor.) The macro is used like this:
class CLASSNAME : public cSimpleModule { Module_Class_Members(CLASSNAME,cSimpleModule,8192) virtual void activity(); }; |
|
Register class. This defines a factory object which makes it possible to create an object by the passing class name to the createOne() function. |
|
Enables int, long, double, char, etc. variables to be inspectable in Tkenv and to be included into the snapshot file. Example usage: int i; WATCH(i); The WATCH() macro expands to a dynamically created cWatch object, like this: new cWatch("i",i); The WATCH() macro must be executed exactly once for a variable, otherwise a new cWatch object is created every time. The alternative is LWATCH which works by creating a local variable. LWATCH expands to something like cWatch i__varshell("i",i);
|