Omnet++ 5.0 and INET 3.4
I want to simulate a MAC protocol base BMAC, however, nodes in the net topology have different function. So I set a enum called role in .h file and add several handlemsg function in .cc file
like below codes in the 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);
}
}
however, there is a warning "Member 'role' was not initialized in this
constructor"
Anyone can give me some advice or some examples to solve this problem?
Thanks in advance!