RINASim  October 2016
Documentation of framework for OMNeT++
Utils.h File Reference
#include <string>
#include <sstream>
#include <vector>
#include "omnetpp.h"

Go to the source code of this file.

Functions

std::vector< std::string > & split (const std::string &s, char delim, std::vector< std::string > &elems)
 
std::vector< std::string > split (const std::string &s, char delim)
 
std::string join (const std::vector< std::string > &elems, const unsigned int n, const char delim)
 
bool isPrefix (std::string prefix, std::string s)
 
void setPolicyDisplayString (cModule *mod, const char *str=nullptr)
 
void interconnectModules (cModule *m1, cModule *m2, std::string n1, std::string n2)
 
template<typename modType >
modType getRINAModule (cModule *curMod, int parentLevel, std::initializer_list< const char * > modPath, bool nullCheck=true)
 

Function Documentation

template<typename modType >
modType getRINAModule ( cModule *  curMod,
int  parentLevel,
std::initializer_list< const char * >  modPath,
bool  nullCheck = true 
)

A getModuleByPath wrapper accepting individual modules in the path as variables.

e.g. TMod* newMod = (TMod*)parentMod->getModuleByPath("^.^.a.b")

getRINAModule<TMod*>(parentMod, 2, {"a", "b"})

Template Parameters
targetmodule type
Parameters
curModstarting module
parentLevellevel of initial ascent into parent modules
modPathpath of modules to descent into
nullCheckcauses an exception to be thrown in case of module not present
Returns
pointer to the retrieved module

Definition at line 91 of file Utils.h.

void interconnectModules ( cModule *  m1,
cModule *  m2,
std::string  n1,
std::string  n2 
)

A convenience function for interconnecting two modules.

Parameters
m1first module
m2second module
n1first module gate name
n2second module gate name

Definition at line 79 of file Utils.cc.

Referenced by RMTModuleAllocator::addPort(), RA::bindMediumToRMT(), and RA::bindNM1FlowToRMT().

bool isPrefix ( std::string  prefix,
std::string  s 
)
std::string join ( const std::vector< std::string > &  elems,
const unsigned int  n,
const char  delim 
)
std::vector<std::string> split ( const std::string &  s,
char  delim 
)

Definition at line 42 of file Utils.cc.