Main Page | Modules | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

Macros


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)

WATCH macros for STL container classes

#define WATCH_VECTOR(variable)
#define WATCH_PTRVECTOR(variable)
#define WATCH_LIST(variable)
#define WATCH_PTRLIST(variable)
#define WATCH_SET(variable)
#define WATCH_PTRSET(variable)
#define WATCH_MAP(m)
#define WATCH_PTRMAP(m)

WATCH macros

#define WATCH(variable)
#define WATCH_RW(variable)
#define WATCH_OBJ(variable)
#define WATCH_PTR(variable)

Declaration macros

#define Define_Network(NAME)
#define Define_Channel(NAME)
#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)


Define Documentation

#define Define_Channel NAME   ) 
 

Registers a channel type definition (cChannelType object).

#define Define_Function NAME,
ARGCOUNT   ) 
 

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.

#define Define_Function2 NAME,
FUNCTION,
ARGCOUNT   ) 
 

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.

#define Define_Module CLASSNAME   ) 
 

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.

#define Define_Module_Like CLASSNAME,
INTERFACENAME   ) 
 

Similar to Define_Module(), except that it couples the class with the NED interface of the given name.

While this macro continues to be supported, it is NOT RECOMMENDED because modules defined with it don't show up in documentation generated with opp_neddoc. One can use NED's like feature with the normal Define_Module() macro too, it doesn't require Define_Module_Like().

#define Define_Network NAME   ) 
 

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.

#define FSM_Enter state   ) 
 

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.

See also:
FSM_Switch

#define FSM_Exit state   ) 
 

Within an FSM_Switch() case branch, declares code to be executed on exiting the given state.

See also:
FSM_Switch

#define FSM_Goto fsm,
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.

See also:
FSM_Switch

#define FSM_MAXT   64
 

After this many transitions without reaching a steady state we assume the FSM is in an infinite loop.

#define FSM_Steady state   ) 
 

Declares a steady state; to be used in enum which declares states.

See example in FSM_Transient.

See also:
FSM_Transient, FSM_Switch

#define FSM_Switch fsm   ) 
 

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.

See also:
cFSM, FSM_Transient, FSM_Steady, FSM_Goto, FSM_Debug, FSM_Print

#define FSM_Transient state   ) 
 

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.

See also:
FSM_Steady, FSM_Switch

#define Module_Class_Members CLASSNAME,
BASECLASS,
STACK   ) 
 

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();
  };
 

#define Register_Class CLASSNAME   ) 
 

Register class.

This defines a factory object which makes it possible to create an object by the passing class name to the createOne() function. The class must be a subclass of cPolymorphic, otherwise a compile-time error will occur: "cannot convert..."

#define WATCH variable   ) 
 

Makes primitive types and types with operator<< inspectable in Tkenv.

See also WATCH_RW(), WATCH_PTR(), WATCH_OBJ(), WATCH_VECTOR(), WATCH_PTRVECTOR(), etc. macros.

#define WATCH_LIST variable   ) 
 

Makes std::lists inspectable in Tkenv.

See also WATCH_PTRLIST().

#define WATCH_MAP  ) 
 

Makes std::maps inspectable in Tkenv.

See also WATCH_PTRMAP().

#define WATCH_OBJ variable   ) 
 

Makes classes derived from cPolymorphic inspectable in Tkenv.

See also WATCH_PTR().

#define WATCH_PTR variable   ) 
 

Makes pointers to objects derived from cPolymorphic inspectable in Tkenv.

See also WATCH_OBJ().

#define WATCH_PTRLIST variable   ) 
 

Makes std::lists storing pointers inspectable in Tkenv.

See also WATCH_LIST().

#define WATCH_PTRMAP  ) 
 

Makes std::maps storing pointers inspectable in Tkenv.

See also WATCH_MAP().

#define WATCH_PTRSET variable   ) 
 

Makes std::sets storing pointers inspectable in Tkenv.

See also WATCH_SET().

#define WATCH_PTRVECTOR variable   ) 
 

Makes std::vectors storing pointers inspectable in Tkenv.

See also WATCH_VECTOR().

#define WATCH_RW variable   ) 
 

Makes types with operator<< and operator>> inspectable in Tkenv.

operator>> is used to enable changing the variable's value interactively.

#define WATCH_SET variable   ) 
 

Makes std::sets inspectable in Tkenv.

See also WATCH_PTRSET().

#define WATCH_VECTOR variable   ) 
 

Makes std::vectors inspectable in Tkenv.

See also WATCH_PTRVECTOR().


Generated on Thu Jan 12 16:01:41 2006 for OMNeT++/OMNEST Simulation Library by  doxygen 1.4.1