#include <LIBTable.h>
List of all members.
Detailed Description
Member Function Documentation
void LIBTable::handleMessage |
( |
cMessage * |
msg | ) |
[protected, virtual] |
void LIBTable::initialize |
( |
int |
stage | ) |
[protected, virtual] |
int LIBTable::installLibEntry |
( |
int |
inLabel, |
|
|
std::string |
inInterface, |
|
|
const LabelOpVector & |
outLabel, |
|
|
std::string |
outInterface, |
|
|
int |
color |
|
) |
| [virtual] |
Referenced by RSVP::commitResv(), LDP::processLABEL_MAPPING(), LDP::processLABEL_REQUEST(), and LDP::updateFecListEntry().
{
if (inLabel == -1)
{
LIBEntry newItem;
newItem.inLabel = ++maxLabel;
newItem.inInterface = inInterface;
newItem.outLabel = outLabel;
newItem.outInterface = outInterface;
newItem.color = color;
lib.push_back(newItem);
return newItem.inLabel;
}
else
{
for (unsigned int i = 0; i < lib.size(); i++)
{
if (lib[i].inLabel != inLabel)
continue;
lib[i].inInterface = inInterface;
lib[i].outLabel = outLabel;
lib[i].outInterface = outInterface;
lib[i].color = color;
return inLabel;
}
ASSERT(false);
return 0;
}
}
virtual int LIBTable::numInitStages |
( |
| ) |
const [inline, protected, virtual] |
void LIBTable::readTableFromXML |
( |
const cXMLElement * |
libtable | ) |
[protected, virtual] |
Referenced by initialize().
{
ASSERT(libtable);
ASSERT(!strcmp(libtable->getTagName(), "libtable"));
checkTags(libtable, "libentry");
cXMLElementList list = libtable->getChildrenByTagName("libentry");
for (cXMLElementList::iterator it=list.begin(); it != list.end(); it++)
{
const cXMLElement& entry = **it;
checkTags(&entry, "inLabel inInterface outLabel outInterface color");
LIBEntry newItem;
newItem.inLabel = getParameterIntValue(&entry, "inLabel");
newItem.inInterface = getParameterStrValue(&entry, "inInterface");
newItem.outInterface = getParameterStrValue(&entry, "outInterface");
newItem.color = getParameterIntValue(&entry, "color", 0);
cXMLElementList ops = getUniqueChild(&entry, "outLabel")->getChildrenByTagName("op");
for (cXMLElementList::iterator oit=ops.begin(); oit != ops.end(); oit++)
{
const cXMLElement& op = **oit;
const char *val = op.getAttribute("value");
const char *code = op.getAttribute("code");
ASSERT(code);
LabelOp l;
if (!strcmp(code, "push"))
{
l.optcode = PUSH_OPER;
ASSERT(val);
l.label = atoi(val);
ASSERT(l.label > 0);
}
else if (!strcmp(code, "pop"))
{
l.optcode = POP_OPER;
ASSERT(!val);
}
else if (!strcmp(code, "swap"))
{
l.optcode = SWAP_OPER;
ASSERT(val);
l.label = atoi(val);
ASSERT(l.label > 0);
}
else
ASSERT(false);
newItem.outLabel.push_back(l);
}
lib.push_back(newItem);
ASSERT(newItem.inLabel > 0);
if (newItem.inLabel > maxLabel)
maxLabel = newItem.inLabel;
}
}
void LIBTable::removeLibEntry |
( |
int |
inLabel | ) |
[virtual] |
bool LIBTable::resolveLabel |
( |
std::string |
inInterface, |
|
|
int |
inLabel, |
|
|
LabelOpVector & |
outLabel, |
|
|
std::string & |
outInterface, |
|
|
int & |
color |
|
) |
| [virtual] |
Member Data Documentation
The documentation for this class was generated from the following files: