Multidimention String vector as input

8 views
Skip to first unread message

Amr Abughazala

unread,
Nov 28, 2016, 8:19:47 AM11/28/16
to OMNeT++ Users
I managed to have one vector as input from omnetpp.ini as string and to be used as bool as per below,

//omnetpp.ini
**.setGate = "true false false false true false false"

//mynetwork.cc
bool GateDropTailQueue::gateState()
{
// reading input vector from omnetpp.ini
   
const char *vstr = par("setGate").stringValue();
    std
::vector<std::string> v = cStringTokenizer(vstr).asVector();

// work around to convert vector string to vector bool
   
bool mygate[6];

   
for (int x = 6; x>=0; x--){
       
if (v[x] == "true")
            mygate
[x] = true;
       
else mygate[x] = false;
   
};
...
}

I didn't find in Omnet++ manual any thing that allows me to have a multidimensional input as per below,

//omnetpp.ini
**.setGate = "true false false false true false false,
              false false false false false false false,
              true false false false true false false"

Any Ideas how to overcome this problem with a work around?

Amr Abughazala

unread,
Nov 28, 2016, 9:31:20 AM11/28/16
to OMNeT++ Users
Reply all
Reply to author
Forward
0 new messages