Omnet++ 5.0 和 INET 3.4
我想模拟一个基于 MAC 协议的 BMAC,但是网络拓扑中的节点具有不同的功能。所以我在 .h 文件中设置了一个名为role的枚举,并在 .cc 文件中添加了几个handlemsg
函数,
如下面的 MiXiM 中的代码
//in .cc file add
enum ROLES {
NODE_RECEIVER, // 0
NODE_SENDER, // 1
};
ROLES role;
//in .h flie add
void XXXMacLayer::handleSelfMsg(cMessage *msg) {
// Check role of this node
if (role == NODE_SENDER) {
handleSelfMsgSender(msg);
}
else {
handleSelfMsgReceiver(msg);
}
}
但是,有一个警告“成员'角色'没有在这个构造函数中初始化”
任何人都可以给我一些建议或一些例子来解决这个问题吗?提前致谢!