tool/CommandGraph.cpp
branchstable-1.5
changeset 2421 bc2d4bf9cbe5
parent 1968 4f682084c643
child 2671 5d7a83195c80
equal deleted inserted replaced
2420:69056c46aa4d 2421:bc2d4bf9cbe5
    81     portMedia[EC_PORT_MII] = "MII";
    81     portMedia[EC_PORT_MII] = "MII";
    82     mediaWeights[EC_PORT_MII] = 1;
    82     mediaWeights[EC_PORT_MII] = 1;
    83 
    83 
    84     portMedia[EC_PORT_EBUS] = "EBUS";
    84     portMedia[EC_PORT_EBUS] = "EBUS";
    85     mediaWeights[EC_PORT_EBUS] = 5;
    85     mediaWeights[EC_PORT_EBUS] = 5;
    86     
    86 
    87     if (args.size()) {
    87     if (args.size()) {
    88         stringstream err;
    88         stringstream err;
    89         err << "'" << getName() << "' takes no arguments!";
    89         err << "'" << getName() << "' takes no arguments!";
    90         throwInvalidUsageException(err);
    90         throwInvalidUsageException(err);
    91     }
    91     }
   109         << "    edge [fontname=\"Helvetica\",fontsize=\"10\"]" << endl
   109         << "    edge [fontname=\"Helvetica\",fontsize=\"10\"]" << endl
   110         << endl
   110         << endl
   111         << "    master [label=\"EtherCAT\\nMaster\"]" << endl;
   111         << "    master [label=\"EtherCAT\\nMaster\"]" << endl;
   112 
   112 
   113     if (slaves.size()) {
   113     if (slaves.size()) {
   114         cout << "    master -- slave0"; 
   114         cout << "    master -- slave0";
   115         mi = portMedia.find(slaves.front().ports[0].desc);
   115         mi = portMedia.find(slaves.front().ports[0].desc);
   116         if (mi != portMedia.end())
   116         if (mi != portMedia.end())
   117             cout << "[label=\"" << mi->second << "\"]";
   117             cout << "[label=\"" << mi->second << "\"]";
   118 
   118 
   119         cout << endl;
   119         cout << endl;
   174             mi = portMedia.find(si->ports[i].desc);
   174             mi = portMedia.find(si->ports[i].desc);
   175             if (mi == portMedia.end() && next) {
   175             if (mi == portMedia.end() && next) {
   176                 /* Try medium of next-hop slave. */
   176                 /* Try medium of next-hop slave. */
   177                 mi = portMedia.find(next->ports[0].desc);
   177                 mi = portMedia.find(next->ports[0].desc);
   178             }
   178             }
   179             
   179 
   180             if (mi != portMedia.end())
   180             if (mi != portMedia.end())
   181                 cout << ",label=\"" << mi->second << "\"";
   181                 cout << ",label=\"" << mi->second << "\"";
   182 
   182 
   183             wi = mediaWeights.find(si->ports[i].desc);
   183             wi = mediaWeights.find(si->ports[i].desc);
   184             if (wi != mediaWeights.end())
   184             if (wi != mediaWeights.end())
   185                 cout << ",weight=\"" << wi->second << "\"";
   185                 cout << ",weight=\"" << wi->second << "\"";
   186             
   186 
   187             cout << "]" << endl;
   187             cout << "]" << endl;
   188         }
   188         }
   189 
   189 
   190         cout << endl;
   190         cout << endl;
   191     }
   191     }