英文:
How to get submodule names of a module in the Omnet++ and the Inet
问题
如何通过C++代码在Omnet++和Inet中获取模块的子模块名称?
除了上述问题,还可以了解如何以树形视图的方式获取子模块的名称以及它们之间的关系?
谢谢
英文:
How to get submodule names of a module in the Omnet++ and the Inet by C++ code?
In addition to the above question, it would be nice to know how to get the names of the submodules in a tree view with their relationships to each other?
Thanks
答案1
得分: 1
使用getSubmoduleNames()
可以获取所有子模块的名称。根据OMNeT++ Simulation Library的说明:
> 返回模块的子模块和子模块向量的名称,包括零大小的子模块向量。
英文:
To get the names of all submodules one may use getSubmoduleNames()
. According to OMNeT++ Simulation Library it:
> Returns the names of the module's submodules and submodule vectors, including zero-size submodule vectors.
答案2
得分: 1
API文档可以帮助你。你在问题中几乎已经找到答案了。如果使用cModule
类的getSubmoduleNames()
方法,可以返回子模块名称。你可以将其与getSubmodule()
和其他相关方法结合使用来实现完整的树遍历。
英文:
The API documentation helps you. You almost figured out in the question. The submodule names can be returned by the getSubmoduleNames()
method if the cModule
class. You can combine that with getSubmodule()
and other related methods to implement a full tree walk.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论