本文整理汇总了C++中Ports::IsBound方法的典型用法代码示例。如果您正苦于以下问题:C++ Ports::IsBound方法的具体用法?C++ Ports::IsBound怎么用?C++ Ports::IsBound使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ports
的用法示例。
在下文中一共展示了Ports::IsBound方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
Ports Ports::operator+( Ports pP) {
//take union of ports
//conditions: ports with the same name must have the same interface
//a port can be bound to one edge only.
Ports RetVal;
//Get the set of ports of the right hand side
std::map<std::string,Interface> P = GetValue();
std::map<std::string,Interface>::iterator It;
for(It = P.begin(); It != P.end();It++) {
//If the right hand side also has the same port width the same interface
if ( pP.HasPort(It->first) && It->second == pP[It->first]) {
//add the interface to the set of ports to return
RetVal.AddPort(It->first,It->second);
//Bound the port to the edge (notice that if the two ports
//are bound to two different edges, the user is notified but the
//port will be bounded to the edge of the right hand side
if ( this->IsBound(It->first)) {
RetVal.BoundTo(It->first,BoundTo(It->first));
}
if ( pP.IsBound(It->first)) {
RetVal.BoundTo(It->first,pP.BoundTo(It->first));
}
}
//if the interafaces are different then return the empty set of ports
//this should be fixed by returning the empty interface instead
else if ( pP.HasPort(It->first) && It->second != pP[It->first] ) {
return Ports();
}
//if the right hand side does not have this port
//add the port to the return value directly
else if ( ! pP.HasPort(It->first) ) {
RetVal.AddPort(It->first,It->second);
if ( this->IsBound(It->first)) {
RetVal.BoundTo(It->first,BoundTo(It->first));
}
}
}
//add all the ports in the right hand side that are not
//in the left hand side
P = pP.GetValue();
for(It = P.begin(); It != P.end();It++) {
if ( ! HasPort(It->first) ) {
RetVal.AddPort(It->first,It->second);
if ( pP.IsBound(It->first)) {
RetVal.BoundTo(It->first,pP.BoundTo(It->first));
}
}
}
return RetVal;
}
示例2: GetValue
Ports Ports::operator-( Ports pP) {
//Return the intersection
Ports RetVal;
//Get the set of ports of the left hand side
std::map<std::string,Interface> P = GetValue();
std::map<std::string,Interface>::iterator It;
for(It = P.begin(); It != P.end();It++) {
//if the port is in also in the right hand side and
//if the interface is the same
//add the port to the return value
if ( pP.HasPort(It->first) && It->second == pP[It->first]) {
RetVal.AddPort(It->first,It->second);
//if are both bound to the same edge then bound it
//otherwise don't
if ( IsBound(It->first) && pP.IsBound(It->first) && (BoundTo(It->first) == pP.BoundTo(It->first))) {
RetVal.BoundTo(It->first,BoundTo(It->first) );
}
}
}
return RetVal;
}