OMNeT++ Simulation Library  5.6.1
cModuleType Class Referenceabstract

#include <ccomponenttype.h>

Description

Abstract class for creating a module of a specific type.

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

Inheritance diagram for cModuleType:
cComponentType cNoncopyableOwnedObject cOwnedObject noncopyable cNamedObject cObject

Public Member Functions

Constructors, destructor, assignment
 cModuleType (const char *qname=nullptr)
 
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)
 
- Public Member Functions inherited from cComponentType
virtual std::string getNedSource () const =0
 
 cComponentType (const char *qname=nullptr)
 
virtual ~cComponentType ()
 
virtual const char * getFullName () const override
 
- Public Member Functions inherited from cNoncopyableOwnedObject
 cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true)
 
virtual cNoncopyableOwnedObjectdup () const override
 
virtual void parsimPack (cCommBuffer *buffer) const override
 
virtual void parsimUnpack (cCommBuffer *buffer) override
 
- Public Member Functions inherited from cOwnedObject
 cOwnedObject ()
 
 cOwnedObject (const char *name, bool namepooling=true)
 
 cOwnedObject (const cOwnedObject &obj)
 
virtual ~cOwnedObject ()
 
cOwnedObjectoperator= (const cOwnedObject &o)
 
virtual cObjectgetOwner () const override
 
virtual bool isOwnedObject () const override
 
virtual bool isSoftOwner () const
 
- Public Member Functions inherited from cNamedObject
 cNamedObject ()
 
 cNamedObject (const char *name, bool namepooling=true)
 
 cNamedObject (const cNamedObject &obj)
 
virtual ~cNamedObject ()
 
cNamedObjectoperator= (const cNamedObject &o)
 
virtual void setName (const char *s)
 
virtual const char * getName () const override
 
virtual void setNamePooling (bool b)
 
virtual bool getNamePooling ()
 
- Public Member Functions inherited from cObject
 cObject ()
 
 cObject (const cObject &other)
 
virtual ~cObject ()
 
virtual const char * getClassName () const
 
bool isName (const char *s) const
 
virtual std::string getFullPath () const
 
const cObjectgetThisPtr () const
 
virtual std::string str () const
 
virtual _OPPDEPRECATED std::string info () const
 
virtual _OPPDEPRECATED std::string detailedInfo () const
 
virtual void forEachChild (cVisitor *v)
 
cObjectfindObject (const char *name, bool deep=true)
 
void copyNotSupported () const
 

Static Public Member Functions

static cModuleTypefind (const char *qname)
 
static cModuleTypeget (const char *qname)
 
- Static Public Member Functions inherited from cComponentType
static cComponentTypefind (const char *qname)
 
static cComponentTypeget (const char *qname)
 
- Static Public Member Functions inherited from cOwnedObject
static long getTotalObjectCount ()
 
static long getLiveObjectCount ()
 
static void resetObjectCounters ()
 
static cDefaultListgetDefaultOwner ()
 

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)
 
- Protected Member Functions inherited from cObject
virtual void take (cOwnedObject *obj)
 
virtual void drop (cOwnedObject *obj)
 
void dropAndDelete (cOwnedObject *obj)
 

Constructor & Destructor Documentation

◆ cModuleType()

cModuleType ( const char *  qname = nullptr)

Constructor.

Member Function Documentation

◆ createModuleObject()

virtual cModule* createModuleObject ( )
protectedpure virtual

Creates the module object. To be defined in subclasses.

◆ addParametersAndGatesTo()

virtual void addParametersAndGatesTo ( cModule mod)
protectedpure 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.

◆ setupGateVectors()

virtual void setupGateVectors ( cModule mod)
protectedpure 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().

◆ buildInside()

virtual void buildInside ( cModule mod)
protectedpure 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().

◆ instantiateModuleClass()

cModule* 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.

◆ isNetwork()

virtual bool isNetwork ( ) const
pure virtual

Returns true if the module type was declared with the "network" keyword.

◆ isSimple()

virtual bool isSimple ( ) const
pure virtual

Returns true if this module type was declared as a simple module in the NED file, i.e. using the "simple" keyword.

◆ create() [1/2]

virtual cModule* 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.

◆ create() [2/2]

virtual cModule* 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.

◆ createScheduleInit()

virtual cModule* 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()

◆ find()

static cModuleType* find ( const char *  qname)
static

Finds a module type by fully qualified NED type name. Returns nullptr if not found.

◆ get()

static cModuleType* get ( const char *  qname)
static

Finds a module type by fully qualified NED type name. Throws an error if not found.


The documentation for this class was generated from the following file: