EPONImplementationforOMNet++
0.8Beta
|
A simple module to configure all the services in a scenario and their parameters. More...
#include <ServiceConfig.h>
Public Member Functions | |
ServiceConfig () | |
virtual int | getLowPriorityService () |
Return the index of the service with the minimum priority. | |
virtual int | getHighPriorityService () |
Return the index of the service with the maximum priority. | |
Public Attributes | |
SrvList | srvs |
Protected Member Functions | |
virtual void | initialize () |
Read the configuration (parameters from the .ini file) and initialize the srvs members. | |
virtual void | handleMessage (cMessage *msg) |
Currently dummy... |
A simple module to configure all the services in a scenario and their parameters.
This module is accessible from any other module that needs this information, so we avoid declaring the same thing again and again.
Usually it is going to be accessed by the queue modules that need to take under consideration the service names and priorities. If there is no such module, the default values are going to be applied.
15-Feb-2011: Keep the services sorted by priority
{}
int ServiceConfig::getHighPriorityService | ( | ) | [virtual] |
int ServiceConfig::getLowPriorityService | ( | ) | [virtual] |
void ServiceConfig::handleMessage | ( | cMessage * | msg | ) | [protected, virtual] |
Currently dummy...
{ // IDEA: - Dynamic Service registration... // probably useless though... delete msg; }
void ServiceConfig::initialize | ( | ) | [protected, virtual] |
Read the configuration (parameters from the .ini file) and initialize the srvs members.
{ // Get the parameters cStringTokenizer tok(par("services").stringValue()); std::vector<string> services=tok.asVector(); cStringTokenizer tok2(par("srvPrior").stringValue()); std::vector<double> sp=tok2.asDoubleVector(); cStringTokenizer tok3(par("vlanMap").stringValue()); std::vector<int> vlanmap=tok3.asIntVector(); cStringTokenizer tok4(par("msrPerFlow").stringValue()); std::vector<double> msrs=tok4.asDoubleVector(); cStringTokenizer tok5(par("mrrPerFlow").stringValue()); std::vector<double> mrrs=tok5.asDoubleVector(); if (sp.size() != services.size() || sp.size() != vlanmap.size() || sp.size() != msrs.size() ||sp.size() != mrrs.size() ) error("ServiceConfig: You must configure a priority, a vlan and an MSR-MRR for each service. \n - Vlan ID" " 0 means no vlan (native) \n - MSR -1 means unlimited service \n - MRR -1 means we don't care"); // Initialize the map for (uint32_t i=0; i<sp.size(); i++){ SrvItem sit; sit.name = services[i]; sit.priority = sp[i]; sit.vlan = vlanmap[i]; sit.msr = msrs[i]; sit.mrr = mrrs[i]; srvs.push_back(sit); } char buf[50]; sprintf(buf, "%d Services", (int)srvs.size()); getDisplayString().setTagArg("t",0,buf); std::sort(srvs.begin(), srvs.end()); WATCH_VECTOR(srvs); }