本文整理汇总了C++中Plug::path方法的典型用法代码示例。如果您正苦于以下问题:C++ Plug::path方法的具体用法?C++ Plug::path怎么用?C++ Plug::path使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plug
的用法示例。
在下文中一共展示了Plug::path方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getCableConnPath
/**
* Returns the cable connector instance path for the side of the cable specified
* by i_type. If no cable, returns "".
*/
string FSISingleHopBus::getCableConnPath(FSISingleHopBus::bus_endpoint_type_t i_type)
{
string path;
Cable* cable = getCable();
//There's a hard way to do this, and an easy way. Knowing that so far all
//cables have been used to cross assemblies, the easy way is to just check for
//which end of the cable has an assembly that matches either the FSI source's
//or destination's. The hard way is to keep track of the cable connector
//instance in the bus path while walking the bus. We'll do the easy way.
if (cable)
{
string cableConnId, cableAssembly, endpointAssembly;
SystemEndpoint* endpoint;
Plug* cablePlug = NULL;
if (FSI_MASTER == i_type) endpoint = iv_master;
else endpoint = iv_slave;
endpointAssembly = endpoint->plug()->assembly().id + '-' + endpoint->plug()->assembly().position;
//First check if the source side of the cable has endpoint's assembly
cablePlug = cable->sourcePlug();
cableAssembly = cablePlug->assembly().id + '-' + cablePlug->assembly().position;
if (endpointAssembly == cableAssembly)
{
cableConnId = cable->element().getChildValue("source-connector-instance");
}
else
{
//Now try the target side
cablePlug = cable->targetPlug();
cableAssembly = cablePlug->assembly().id + '-' + cablePlug->assembly().position;
if (endpointAssembly == cableAssembly)
{
cableConnId = cable->element().getChildValue("target-connector-instance");
}
else
{
mrwLogger l;
l() << "Couldn't find a cable endpoint with same assembly as "
<< endpoint->getChipPath() << " for cable " << cable->element().getChildValue("name");
l.error();
}
}
//Now build the connector instance path
if (!cableConnId.empty())
{
//get the connector-instance, so we can build the instance path
XMLElement inst = cablePlug->card().findPath("connector-instances").find("connector-instance", "id", cableConnId);
if (!inst.empty())
{
string cid = inst.getChildValue("connector-id");
string pos = inst.getChildValue("position");
path = cablePlug->path() + "/" + cid + "-" + pos;
}
else
{
mrwLogger l;
l() << "Couldn't find connector instance element for ID " << cableConnId << " on " << cablePlug->path();
l.error();
}
}
}
return path;
}