本文整理汇总了C++中NetworkAddress::split方法的典型用法代码示例。如果您正苦于以下问题:C++ NetworkAddress::split方法的具体用法?C++ NetworkAddress::split怎么用?C++ NetworkAddress::split使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NetworkAddress
的用法示例。
在下文中一共展示了NetworkAddress::split方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: clear
void NetworkAddressSet::clear(NetworkAddressSet &customerSet, bool verbose){
NetworkAddressSetOrder previousSetOrder=getOrder();
NetworkAddressSetOrder previousCustomerSetOrder=customerSet.getOrder();
this->sort(DESCENDING_PREFIX_LENGTH_ORDER);
customerSet.sort(DESCENDING_PREFIX_LENGTH_ORDER);
//first aggregate the sets
this->aggregate();
customerSet.aggregate();
//in order to remove or split larger blocks (smaller prefixLengths) reverse the customerSet
customerSet.sort(ASCENDING_PREFIX_LENGTH_ORDER);
NetworkAddressNode *customerCurrentNodePtr=customerSet.headNodePtr;
NetworkAddress * targetSubnetPtr;
bool deleted;
float i=0;
while(customerCurrentNodePtr!=0){
deleted=false;
targetSubnetPtr=customerCurrentNodePtr->subnetPtr;
NetworkAddressNode * currenNodePtr=this->headNodePtr;
NetworkAddress *candidateSubnetPtr;//the subnet to be deleted or splitted and partially deleted
//cout<<"Target :\n"<<*targetSubnetPtr<<endl;
while(currenNodePtr!=0){
candidateSubnetPtr=currenNodePtr->subnetPtr;
if(*candidateSubnetPtr==*targetSubnetPtr){//remove targetSubnetPtr
//cout<<"**********Candidate to be directly deleted"<<endl<<*candidateSubnetPtr<<endl;
delete removeNetworkAddress(*candidateSubnetPtr);
//cout<<"major set after removal\n"<<*this<<endl;
deleted=true;
break;
}
if(candidateSubnetPtr->subsumes(*targetSubnetPtr)){
//cout<<"major set before removal\n"<<*this<<endl;
//cout<<"Candidate to be extracted and deleted"<<endl<<*candidateSubnetPtr<<endl;
removeNetworkAddress(candidateSubnetPtr);
NetworkAddressSet * splittedSet=candidateSubnetPtr->split(targetSubnetPtr->getPrefixLength());
delete candidateSubnetPtr;
//cout<<"major set after removal\n"<<*this<<endl;
//cout<<"splitted set\n"<<*splittedSet<<endl;
splittedSet->removeNetworkAddress(*targetSubnetPtr);
//cout<<"splitted set after removal\n"<<*splittedSet<<endl;
splittedSet->aggregate();
//cout<<"splitted set after re-aggregate\n"<<*splittedSet<<endl;
NetworkAddressNode *tmp, *currentSplittedNodePtr=splittedSet->headNodePtr;
while(currentSplittedNodePtr!=0){
tmp=currentSplittedNodePtr;
currentSplittedNodePtr=currentSplittedNodePtr->nextNodePtr;
insert(tmp->subnetPtr);
delete tmp;
}
delete splittedSet;
//cout<<"major set after addition\n"<<*this<<endl;
deleted=true;
break;
}
currenNodePtr=currenNodePtr->nextNodePtr;
}
if(deleted==false){
cout<<"ITOM Warning: Can NOT clear subnet"<<*(customerCurrentNodePtr->subnetPtr->getHumanReadableRepresentation())<<endl;
}
if(verbose){
cout<<(++i/customerSet.size)*100<<" % of customer set has been processed"<<endl;
}
customerCurrentNodePtr=customerCurrentNodePtr->nextNodePtr;
}
customerSet.sort(previousCustomerSetOrder);
this->sort(previousSetOrder);
}