Implementation of MatrixCloudDelayer.
More...
#include <MatrixCloudDelayer.h>
Implementation of MatrixCloudDelayer.
See NED file for details.
◆ IdPair
◆ IdPairToDescriptorMap
◆ MatrixEntryPtrVector
◆ ~MatrixCloudDelayer()
| inet::MatrixCloudDelayer::~MatrixCloudDelayer |
( |
| ) |
|
|
protectedvirtual |
◆ calculateDropAndDelay()
| void inet::MatrixCloudDelayer::calculateDropAndDelay |
( |
const cMessage * |
msg, |
|
|
int |
srcID, |
|
|
int |
destID, |
|
|
bool & |
outDrop, |
|
|
simtime_t & |
outDelay |
|
) |
| |
|
overrideprotectedvirtual |
returns isDrop and delay for this msg
Reimplemented from inet::CloudDelayerBase.
127 outDrop = descriptor->dropPar->boolValue(
this);
128 outDelay = SIMTIME_ZERO;
130 outDelay = descriptor->delayPar->doubleValue(
this,
"s");
131 double datarate = descriptor->dataratePar->doubleValue(
this,
"bps");
132 ASSERT(outDelay >= 0);
133 ASSERT(datarate > 0.0);
134 simtime_t curTime = simTime();
135 if (curTime + outDelay < descriptor->lastSent)
136 outDelay = descriptor->lastSent - curTime;
138 const cPacket *pk =
dynamic_cast<const cPacket *
>(msg);
140 outDelay += pk->getBitLength() / datarate;
142 descriptor->lastSent = curTime + outDelay;
◆ getOrCreateDescriptor()
148 IdPair idPair(srcID, destID);
151 return &(it->second);
157 MatrixEntry *reverseMatrixEntry =
nullptr;
159 MatrixEntry *matrixEntry = elem;
160 if (matrixEntry->matches(src.c_str(), dest.c_str())) {
162 descriptor.delayPar = &matrixEntry->delayPar;
163 descriptor.dataratePar = &matrixEntry->dataratePar;
164 descriptor.dropPar = &matrixEntry->dropPar;
165 descriptor.lastSent = simTime();
166 if (matrixEntry->symmetric) {
167 if (reverseMatrixEntry)
168 throw cRuntimeError(
"Inconsistent xml config between '%s' and '%s' nodes (at %s and %s)",
169 src.c_str(), dest.c_str(), matrixEntry->entity->getSourceLocation(),
170 reverseMatrixEntry->entity->getSourceLocation());
171 IdPair reverseIdPair(destID, srcID);
173 rdescriptor = descriptor;
177 else if (!matrixEntry->symmetric && !reverseMatrixEntry && matrixEntry->matches(dest.c_str(), src.c_str())) {
179 reverseMatrixEntry = matrixEntry;
182 throw cRuntimeError(
"The 'traffic' xml entity not found for communication from '%s' to '%s' node", src.c_str(),
Referenced by calculateDropAndDelay().
◆ getPathOfConnectedNodeOnIfaceID()
| std::string inet::MatrixCloudDelayer::getPathOfConnectedNodeOnIfaceID |
( |
int |
id | ) |
|
|
protected |
returns path of connected node for the interface specified by 'id'
188 NetworkInterface *ie =
ift->getInterfaceById(
id);
190 throw cRuntimeError(
"The interface id=%i not found in interfacetable",
id);
193 cGate *connectedGate =
nullptr;
195 if ((gateId = ie->getNodeOutputGateId()) != -1)
196 connectedGate =
host->gate(gateId)->getPathEndGate();
197 else if ((gateId = ie->getNodeInputGateId()) != -1)
198 connectedGate =
host->gate(gateId)->getPathStartGate();
201 throw cRuntimeError(
"Interface '%s' (id=%i) not connected", ie->getFullName(),
id);
205 throw cRuntimeError(
"The connected node is unknown at interface '%s' (id=%i)", ie->getFullName(),
id);
207 return connNode->getFullPath();
Referenced by getOrCreateDescriptor().
◆ initialize()
| void inet::MatrixCloudDelayer::initialize |
( |
int |
stage | ) |
|
|
overrideprotectedvirtual |
Reimplemented from inet::CloudDelayerBase.
100 using namespace xmlutils;
106 ift.reference(
this,
"interfaceTableModule",
true);
107 cXMLElement *configEntity = par(
"config");
109 if (strcmp(configEntity->getTagName(),
"internetCloud"))
110 throw cRuntimeError(
"Cannot read internetCloud configuration, unaccepted '%s' entity at %s", configEntity->getTagName(),
111 configEntity->getSourceLocation());
113 const cXMLElement *parameterEntity =
getUniqueChild(configEntity,
"parameters");
114 cXMLElementList trafficEntities = parameterEntity->getChildrenByTagName(
"traffic");
115 for (
auto& trafficEntitie : trafficEntities) {
116 cXMLElement *trafficEntity = trafficEntitie;
117 MatrixEntry *matrixEntry =
new MatrixEntry(trafficEntity, defaultSymmetric);
◆ numInitStages()
| virtual int inet::MatrixCloudDelayer::numInitStages |
( |
| ) |
const |
|
inlineoverrideprotectedvirtual |
◆ host
| cModule* inet::MatrixCloudDelayer::host = nullptr |
|
protected |
◆ idPairToDescriptorMap
◆ ift
◆ matrixEntries
The documentation for this class was generated from the following files: