33 std::vector<std::string> &
split(
const std::string &s,
char delim, std::vector<std::string> &elems) {
34 std::stringstream ss(s);
36 while (std::getline(ss, item, delim)) {
37 elems.push_back(item);
42 std::vector<std::string>
split(
const std::string &s,
char delim) {
43 std::vector<std::string> elems;
44 split(s, delim, elems);
48 std::string
join(
const std::vector<std::string> &elems,
const unsigned int n,
const char delim) {
50 char d[2] = {delim, 0};
52 for(
unsigned int i = 0; i < elems.size() && i<n; i++){
56 s.append(elems.at(i));
62 bool isPrefix(std::string prefix, std::string s) {
63 if(prefix.size() > s.size()) {
66 return std::mismatch(prefix.begin(), prefix.end(), s.begin()).first == prefix.end();
71 if (getEnvir()->isGUI())
73 cDisplayString& disp = mod->getDisplayString();
74 disp.setTagArg(
"t", 1,
"t");
75 disp.setTagArg(
"t", 0, (str ==
nullptr ? mod->getClassName() : str));
81 if (!m1->hasGate(n1.c_str()))
83 m1->addGate(n1.c_str(), cGate::INOUT,
false);
85 cGate* m1In = m1->gateHalf(n1.c_str(), cGate::INPUT);
86 cGate* m1Out = m1->gateHalf(n1.c_str(), cGate::OUTPUT);
88 if (!m2->hasGate(n2.c_str()))
90 m2->addGate(n2.c_str(), cGate::INOUT,
false);
92 cGate* m2In = m2->gateHalf(n2.c_str(), cGate::INPUT);
93 cGate* m2Out = m2->gateHalf(n2.c_str(), cGate::OUTPUT);
95 if (m2->getParentModule() == m1)
97 m1In->connectTo(m2In);
98 m2Out->connectTo(m1Out);
102 m1Out->connectTo(m2In);
103 m2Out->connectTo(m1In);
bool isPrefix(std::string prefix, std::string s)
std::vector< std::string > & split(const std::string &s, char delim, std::vector< std::string > &elems)
std::string join(const std::vector< std::string > &elems, const unsigned int n, const char delim)
void interconnectModules(cModule *m1, cModule *m2, std::string n1, std::string n2)
void setPolicyDisplayString(cModule *mod, const char *str)