当前位置: 首页>>代码示例>>C++>>正文


C++ Plug::assembly方法代码示例

本文整理汇总了C++中Plug::assembly方法的典型用法代码示例。如果您正苦于以下问题:C++ Plug::assembly方法的具体用法?C++ Plug::assembly怎么用?C++ Plug::assembly使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Plug的用法示例。


在下文中一共展示了Plug::assembly方法的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;
}
开发者ID:brs332,项目名称:openpower-mrw-old,代码行数:79,代码来源:mrwFSICommon.C


注:本文中的Plug::assembly方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。