【问题标题】:How to get the module connected to a gate?如何让模块连接到门?
【发布时间】:2014-12-25 18:28:58
【问题描述】:
在一个模块中,我可以得到一个cGate指针调用方法:
const cGate* cModule::gate ( const char * gatename, int index = -1)
但是一旦获得cGate 指针,我看不到一种方法来获取连接(输出)到门的关联模块。我也没有在cChannel 类中看到它。有什么办法吗?
【问题讨论】:
标签:
c++
simulation
omnet++
【解决方案1】:
检查cGate::getPathStartGate() 和cGate::getPathEndGate() 方法。根据连接的方向,这些将为您提供端点门(它甚至会跨越模块边界跟随连接,直到它在连接链的另一侧找到一个简单的模块)。
(cGate::getNextGate() 和 cGate::getPreviousGate() 只给出链上的下一个/上一个门)
一旦你从另一边获得cGate 对象,你就可以使用cGate::getOwnerModule() 获取模块