ModuleAccess.cc File Reference

#include "ModuleAccess.h"

Functions

bool isNode (cModule *mod)
cModule * findModuleWherever (const char *name, cModule *from)
cModule * findModuleWhereverInNode (const char *name, cModule *from)
cModule * findModuleSomewhereUp (const char *name, cModule *from)


Function Documentation

cModule* findModuleSomewhereUp ( const char *  name,
cModule *  from 
)

Find a module with given name, and "closest" to module "from".

Operation: gradually rises in the module hierarchy, and looks for a submodule of the given name.

00062 {
00063     cModule *mod = NULL;
00064     for (cModule *curmod=from; !mod && curmod; curmod=curmod->getParentModule())
00065         mod = curmod->getSubmodule(name);
00066     return mod;
00067 }

cModule* findModuleWherever ( const char *  name,
cModule *  from 
)

Find a module with given name, and "closest" to module "from".

Operation: gradually rises in the module hierarchy, and searches recursively among all submodules at every level.

00042 {
00043     cModule *mod = NULL;
00044     for (cModule *curmod=from; !mod && curmod; curmod=curmod->getParentModule())
00045         mod = findSubmodRecursive(curmod, name);
00046     return mod;
00047 }

cModule* findModuleWhereverInNode ( const char *  name,
cModule *  from 
)

Find a module with given name, and "closest" to module "from".

Operation: gradually rises in the module hierarchy up to the module, and searches recursively among all submodules at every level.

Referenced by ModuleAccess< ICMP >::get(), and ModuleAccess< ICMP >::getIfExists().

00050 {
00051     cModule *mod = NULL;
00052     for (cModule *curmod=from; curmod; curmod=curmod->getParentModule())
00053     {
00054         mod = findSubmodRecursive(curmod, name);
00055         if (mod || isNode(curmod))
00056             break;
00057     }
00058     return mod;
00059 }

bool isNode ( cModule *  mod  )  [inline]

Referenced by findModuleWhereverInNode().

00022 {
00023     cProperties *props = mod->getProperties();
00024     return props && props->getAsBool("node");
00025 }


Generated on Fri Mar 20 18:51:17 2009 for INET Framework for OMNeT++/OMNEST by  doxygen 1.5.5