#include <ctypes.h>
Inheritance diagram for cModuleInterface:
..) of a module type. cModuleInterfaces are used during network setup (and dynamic module creation) to add gates and parameters to the freshly created module object, and also to verify that module parameters set correctly.
cModuleInterfaces may be created either dynamically or by the NED compiler. In the latter case, the are the compiled form of NED declarations of simple modules. They are created in the following way:
1) starting point is the NED declarations of simple modules, e.g:
simple Generator parameters: ia_rate; gates: out: out; endsimple
2) the nedtool compiler translates the NED declaration into a ModuleInterface...End macro and places it into the _n.cc file.
ModuleInterface(Generator) Parameter("speed", Numeric) Gate( "out", Output) EndInterface
The above translates into cModuleInterface::DeclarationItem array by means of define macros.
3) When the program starts up, cModuleInterfaces are registered, and cModuleInterface constructor parses the array into an internal data structure.
4) When a module is created, the appropriate cModuleInterface object is looked up from the list, and the module's gates and parameters are created according to the description in the cModuleInterface object.
Public Member Functions | |
Constructors, destructor, assignment | |
cModuleInterface (const char *name) | |
cModuleInterface (const char *name, DeclarationItem *decltable) | |
cModuleInterface (const cModuleInterface &mi) | |
virtual | ~cModuleInterface () |
cModuleInterface & | operator= (const cModuleInterface &mi) |
Redefined cObject member functions. | |
virtual cPolymorphic * | dup () const |
Setting up a module interface manually | |
void | allocateGateDecls (int maxnumgates) |
void | allocateParamDecls (int maxnumparams) |
void | addGateDecl (const char *name, const char type, bool isvector=false) |
void | addParamDecl (const char *name, const char *types) |
Query on the module interface | |
int | numParams () |
int | findParam (const char *name) |
const char * | paramName (int k) |
const char * | paramType (int k) |
bool | isParamConst (int k) |
int | numGates () |
int | findGate (const char *name) |
const char * | gateName (int k) |
char | gateType (int k) |
bool | isGateVector (int k) |
Applying the interface to modules. | |
void | addParametersGatesTo (cModule *module) |
void | checkParametersOf (cModule *module) |
|
Constructor.
|
|
Constructor.
|
|
Copy constructor.
|
|
Destructor.
|
|
Add a gate declaration.
|
|
Add a parameter declaration.
|
|
Adds parameters and gates specified by the interface to the given module.
|
|
Make room for a given number of gate declarations.
|
|
Make room for a given number of parameter declarations.
|
|
Checks that the types of the module's parameters comply to the interface, and calls convertToConst() on the parameters declared as const in the interface.
|
|
Creates and returns an exact copy of this object. See cObject for more details. Reimplemented from cObject. |
|
Returns index of the given gate (0. .numGates()), or -1 if not found |
|
Returns index of the given param (0. .numParams()), or -1 if not found |
|
Returns the name of the kth gate.
|
|
Returns if the kth gate is input or output.
|
|
Returns if the kth gate is a gate vector.
|
|
Returns if the kth parameter is declarared to be
|
|
Returns the number of gates.
|
|
Returns the number of parameters.
|
|
Assignment operator. The name member doesn't get copied; see cObject's operator=() for more details. |
|
Returns the name of the kth parameter.
|
|
Returns the cPar types allowed for the kth parameter.
|