cModuleType Class Reference
[Internal classes]

Abstract class for creating a module of a specific type. More...

#include <ccomponenttype.h>

Inheritance diagram for cModuleType:
cComponentType cNoncopyableOwnedObject cOwnedObject noncopyable cNamedObject cObject

List of all members.

Public Member Functions

Constructors, destructor, assignment

 cModuleType (const char *qname=NULL)
Misc

virtual bool isNetwork () const =0
virtual bool isSimple () const =0
Module creation

virtual cModulecreate (const char *name, cModule *parentmod)
virtual cModulecreate (const char *name, cModule *parentmod, int vectorsize, int index)
virtual cModulecreateScheduleInit (const char *name, cModule *parentmod)

Static Public Member Functions

static cModuleTypefind (const char *qname)
static cModuleTypeget (const char *qname)

Protected Member Functions

virtual cModulecreateModuleObject ()=0
virtual void addParametersAndGatesTo (cModule *mod)=0
virtual void setupGateVectors (cModule *mod)=0
virtual void buildInside (cModule *mod)=0
cModuleinstantiateModuleClass (const char *classname)

Friends

class cModule

Detailed Description

Abstract class for creating a module of a specific type.

A cModuleType object exist for each module type (simple or compound).


Member Function Documentation

virtual void cModuleType::addParametersAndGatesTo ( cModule mod  )  [protected, pure virtual]

Adds parameters and gates to a newly created module object.

Gate vectors will be created with zero size, and a further call to setupGateVectors() will be needed once parameter values have been finalized.

virtual void cModuleType::buildInside ( cModule mod  )  [protected, pure virtual]

Creates and connects submodules of a newly created module object.

To be defined in subclasses. addParametersAndGatesTo() and setupGateVectors() must have been already called at this point.

NOTE: If you have an old simulation model that attempts to call this method directly, it is using an API call which has been DEPRECATED since OMNeT++ 2.3b1 -- please change the code to mod->buildInside().

virtual cModule* cModuleType::create ( const char *  name,
cModule parentmod,
int  vectorsize,
int  index 
) [virtual]

Creates a module to be an element of a module vector.

The last two arguments specify the vector size and the index of the new module within the vector.

virtual cModule* cModuleType::create ( const char *  name,
cModule parentmod 
) [virtual]

Creates a module which is not element of a module vector.

In addition to creating an object of the correct type, this function inserts the module into the simulation's data structure, and adds the parameters and gates specified in the NED declaration.

virtual cModule* cModuleType::createModuleObject (  )  [protected, pure virtual]

Creates the module object.

To be defined in subclasses.

virtual cModule* cModuleType::createScheduleInit ( const char *  name,
cModule parentmod 
) [virtual]

This is a convenience function to get a module up and running in one step.

First, the module is created using create() and buildInside(), then a starter message is created (for activity() modules only), then initialize() is called (mod->callInitialize()).

This method works for simple and compound modules alike. Not applicable if the module:

  • has parameters to be set
  • gate vector sizes to be set
  • gates to be connected before initialize()
static cModuleType* cModuleType::find ( const char *  qname  )  [static]

Finds a module type by fully qualified NED type name.

Returns NULL if not found.

Reimplemented from cComponentType.

static cModuleType* cModuleType::get ( const char *  qname  )  [static]

Finds a module type by fully qualified NED type name.

Throws an error if not found.

Reimplemented from cComponentType.

cModule* cModuleType::instantiateModuleClass ( const char *  classname  )  [protected]

Utility function: instantiates the given class, and tries to cast the result to cModule.

Raises an error if class was not found or could not be cast.

virtual void cModuleType::setupGateVectors ( cModule mod  )  [protected, pure virtual]

Sets gate vector sizes on the module.

This must be called AFTER all parameters have been set (see finalizeParameters()) because gate vector sizes may depend on parameter values; and it it must be invoked before connecting the gates and calling mod->buildInside().


The documentation for this class was generated from the following file:
Generated on Tue Dec 2 11:16:29 2014 for OMNeT++ Simulation Library by  doxygen 1.6.3