本文整理汇总了C++中DataNode::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ DataNode::remove方法的具体用法?C++ DataNode::remove怎么用?C++ DataNode::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataNode
的用法示例。
在下文中一共展示了DataNode::remove方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: AODVrcvcode
//.........这里部分代码省略.........
ttSendMsg(1, nextHop, nwkmsg, 20*8); // 20 bytes
etime1 = 0.0001;;
}
updateExpiryTimer(d->routing_table, d->dataTimer, myID);
etime = etime1 + etime2;
break;
case RERR:
rerrmsg = (RERRMsg*) nwkmsg->msg;
intermed = nwkmsg->intermed;
if (VERBOSE) {
mexPrintf("Node#%d got an RERR from Node#%d for destination#%d\n", myID, intermed, rerrmsg->dest);
}
// Propagate RERR?
dest_entry = &(d->routing_table[rerrmsg->dest - 1]);
if (dest_entry->valid && dest_entry->nextHop == intermed) {
// Should send RERR to all nodes in precursor list (neighbors)
for (i=0; i<NBR_AODV; i++) {
if (dest_entry->prec[i]) {
// Node i+1 uses this node as next hop towards dest, send RERR
rerrmsg2 = new RERRMsg;
rerrmsg2->dest = dest_entry->dest;
rerrmsg2->destSeqNbr = dest_entry->destSeqNbr;
rerrmsg2->receiver = i+1;
d->RERRlist->appendNode(new DataNode(rerrmsg2, ""));
}
}
// Invalidate route
if (VERBOSE) {
mexPrintf("Node#%d invalidating route to Node#%d through Node#%d\n", myID, rerrmsg->dest, intermed);
}
dest_entry->valid = 0;
}
etime = 0.0001;;
break;
case HELLO:
hellomsg = (HelloMsg*) nwkmsg->msg;
intermed = nwkmsg->intermed;
//delete nwkmsg;
if (VERBOSE) {
mexPrintf("Time: %f Node#%d got a hello message from Node#%d\n", now, myID, hellomsg->dest);
}
// Update time stamp for last HELLO msg
d->dataHello->nbors[hellomsg->dest - 1] = 1;
d->dataHello->lastHello[hellomsg->dest - 1] = now;
etime = 0.0001;;
}
}
return etime;
case 2:
// Send next RERR, if any
dn = (DataNode*) d->RERRlist->getFirst();
if (dn != NULL) {
// Retrieve next RERR in list
rerrmsg = (RERRMsg*) dn->data;
dn->remove();
delete dn;
// Send RERR to receiver
nwkmsg = new GenericNwkMsg;
nwkmsg->type = RERR;
nwkmsg->intermed = myID;
nwkmsg->msg = rerrmsg;
if (VERBOSE) {
mexPrintf("Node#%d sending RERR to Node#%d\n", myID, rerrmsg->receiver);
}
ttSendMsg(1, rerrmsg->receiver, nwkmsg, 12*8); // 12 bytes
ttSleep(0.001);
return 0.0001;
} else {
return FINISHED;
}
case 3:
ttSetNextSegment(2);
return 0.0001;
}
return FINISHED; // to supress compilation warnings
}
示例2: hellocode
//.........这里部分代码省略.........
hellomsg->lifetime = DELETE_PERIOD;
nwkmsg = new GenericNwkMsg;
nwkmsg->type = HELLO;
nwkmsg->intermed = d->nodeID;
nwkmsg->msg = hellomsg;
ttSendMsg(1, 0, nwkmsg, 24);
}
// Determine local connectivity
for (k=0; k<NBR_AODV; k++) {
if (d->nbors[k]) {
// Node k is a neighbor
if (now - d->lastHello[k] > DELETE_PERIOD) {
mexPrintf("Node#%d lost connection to Node#%d\n", d->nodeID, k+1);
d->nbors[k] = 0; // remove from neighbor list
// Send RERRs
for (m=0; m<NBR_AODV; m++) {
// Find routes that use node k as next hop
if (d->routing_table[m].valid) {
if (d->routing_table[m].nextHop == k+1) {
// Should send RERR to all nodes in precursor list
for (n=0; n<NBR_AODV; n++) {
if (d->routing_table[m].prec[n]) {
// Node n uses this node as next hop towards node k
rerrmsg = new RERRMsg;
rerrmsg->dest = m + 1;
rerrmsg->destSeqNbr = d->routing_table[m].destSeqNbr;
rerrmsg->receiver = n + 1;