本文整理汇总了C++中Subscription::merge方法的典型用法代码示例。如果您正苦于以下问题:C++ Subscription::merge方法的具体用法?C++ Subscription::merge怎么用?C++ Subscription::merge使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Subscription
的用法示例。
在下文中一共展示了Subscription::merge方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: recomputeConsolidateSubsciptionList
void LocalNodeInfo::recomputeConsolidateSubsciptionList (void)
{
// TODO CHECK: I don't think the includes applies anymore, so I commented it
// In fact, even if the includes returns true,
// I still need to merge subscriptions in terms of priority, reliability, sequenced, etc
CRC * pCRC = new CRC();
pCRC->init();
for (StringHashtable<Subscription>::Iterator iterator = _consolidatedSubscriptions.getIterator(); !iterator.end(); iterator.nextElement()) {
pCRC->update ((const char *)iterator.getKey());
pCRC->update32 (iterator.getValue());
}
uint16 oldCRC = pCRC->getChecksum();
// Delete the current Consolidate Subscription List and compute a new one
_consolidatedSubscriptions.clear();
// For each client
for (UInt32Hashtable<SubscriptionList>::Iterator i = _localSubscriptions.getAllElements(); !i.end(); i.nextElement()) {
SubscriptionList *pSL = i.getValue();
if (pSL != NULL) {
// Get all its subscriptions
PtrLList<String> *pSubgroups = pSL->getAllSubscribedGroups();
for (String *pSubGroupName = pSubgroups->getFirst(); pSubGroupName != NULL; pSubGroupName = pSubgroups->getNext()) {
// For each group, get the subscription the client has
const char *pszGroupName = pSubGroupName->c_str();
Subscription *pClientSub = pSL->getSubscription (pszGroupName);
// And the subscription in the consolidate subscription list if any
Subscription *pSubInConsolidateList = _consolidatedSubscriptions.getSubscription (pszGroupName);
if (pSubInConsolidateList == NULL) {
_consolidatedSubscriptions.addSubscription (pszGroupName, pClientSub->clone());
}
else {
/*if (pClientSub->includes (pSubInConsolidateList)) {
_consolidatedSubscriptions.removeGroup (pszGroupName);
_consolidatedSubscriptions.addSubscription (pszGroupName, pClientSub->clone());
}
else {*/
pClientSub->merge (pSubInConsolidateList);
/*}*/
}
}
}
}
pCRC->reset();
for (StringHashtable<Subscription>::Iterator iterator = _consolidatedSubscriptions.getIterator(); !iterator.end(); iterator.nextElement()) {
pCRC->update ((const char *) iterator.getKey());
pCRC->update32 (iterator.getValue());
}
uint16 newCRC = pCRC->getChecksum();
if (oldCRC != newCRC) {
ui32SubscriptionStateSeqID++;
GroupSubscription *pSubscription = new GroupSubscription(); // Void subscription to respect method interface
_notifier.modifiedSubscriptionForPeer (_pszId, pSubscription);
}
}