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


C++ Ports::IsBound方法代码示例

本文整理汇总了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;
}
开发者ID:alessandro-pinto,项目名称:commsynth,代码行数:52,代码来源:Ports.cpp

示例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;
}
开发者ID:alessandro-pinto,项目名称:commsynth,代码行数:21,代码来源:Ports.cpp


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