Abstract class for creating a module of a specific type.
A cModuleType object exist for each module type (simple or compound).
Public Member Functions | |
Constructors, destructor, assignment | |
cModuleType (const char *qname=nullptr) | |
Misc | |
virtual bool | isNetwork () const =0 |
virtual bool | isSimple () const =0 |
Public Member Functions inherited from cComponentType | |
cComponentType (const char *qname=nullptr) | |
virtual | ~cComponentType () |
virtual const char * | getFullName () const override |
virtual std::string | getNedSource () const =0 |
Public Member Functions inherited from cNoncopyableOwnedObject | |
cNoncopyableOwnedObject (const char *name=nullptr, bool namepooling=true) | |
virtual cNoncopyableOwnedObject * | dup () const override |
Public Member Functions inherited from cOwnedObject | |
cOwnedObject () | |
cOwnedObject (const char *name, bool namepooling=true) | |
cOwnedObject (const cOwnedObject &obj) | |
virtual | ~cOwnedObject () |
cOwnedObject & | operator= (const cOwnedObject &o) |
virtual cObject * | getOwner () const override |
virtual bool | isOwnedObject () const override |
Public Member Functions inherited from cNamedObject | |
cNamedObject () | |
cNamedObject (const char *name, bool namepooling=true) | |
cNamedObject (const cNamedObject &obj) | |
virtual | ~cNamedObject () |
cNamedObject & | operator= (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)=default | |
virtual | ~cObject () |
virtual const char * | getClassName () const |
bool | isName (const char *s) const |
virtual std::string | getFullPath () const |
virtual std::string | getClassAndFullName () const |
virtual std::string | getClassAndFullPath () const |
const cObject * | getThisPtr () const |
virtual std::string | str () const |
virtual std::ostream & | printOn (std::ostream &os) const |
virtual bool | isSoftOwner () const |
virtual void | forEachChild (cVisitor *v) |
cObject * | findObject (const char *name, bool deep=true) |
virtual cClassDescriptor * | getDescriptor () const |
void | copyNotSupported () const |
Module creation | |
virtual cModule * | create (const char *name, cModule *parentmod, int index=-1) |
virtual cModule * | createScheduleInit (const char *name, cModule *parentmod, int index=-1) |
static cModuleType * | find (const char *qname) |
static cModuleType * | get (const char *qname) |
Additional Inherited Members | |
Static Public Member Functions inherited from cComponentType | |
static cComponentType * | find (const char *qname) |
static cComponentType * | get (const char *qname) |
Static Public Member Functions inherited from cOwnedObject | |
static long | getTotalObjectCount () |
static long | getLiveObjectCount () |
static void | resetObjectCounters () |
static cSoftOwner * | getOwningContext () |
Protected Member Functions inherited from cObject | |
virtual void | take (cOwnedObject *obj) |
virtual void | drop (cOwnedObject *obj) |
void | dropAndDelete (cOwnedObject *obj) |
cModuleType | ( | const char * | qname = nullptr | ) |
Constructor.
|
pure virtual |
Returns true if the module type was declared with the "network" keyword.
|
pure virtual |
Returns true if this module type was declared as a simple module in the NED file, i.e. using the "simple" keyword.
Creates a submodule under the given parent module. If index is given, the module creates an element in a module vector; the module vector of the given name must already exist and must be sufficiently large (size>index).
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.
After creation, the module still needs to go through a setup of several steps before it is ready to use. The full process is the following:
cModule *module = create("foo", parentModule); [set parameters] module->finalizeParameters(); [connect gates] module->buildInside(); module->scheduleStart(simTime()); module->callInitialize();
As callInitialize() and some of the other functions perform the preceding steps if they are not yet done, the above code can be abbreviated to:
cModule *module = create("foo", parentModule); [set parameters] module->callInitialize();
|
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:
|
static |
Finds a module type by fully qualified NED type name. Returns nullptr if not found.
|
static |
Finds a module type by fully qualified NED type name. Throws an error if not found.