本文整理汇总了C++中SubscriptionList::addFilterToGroup方法的典型用法代码示例。如果您正苦于以下问题:C++ SubscriptionList::addFilterToGroup方法的具体用法?C++ SubscriptionList::addFilterToGroup怎么用?C++ SubscriptionList::addFilterToGroup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SubscriptionList
的用法示例。
在下文中一共展示了SubscriptionList::addFilterToGroup方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: addFilter
int LocalNodeInfo::addFilter (uint16 ui16ClientId, const char *pszGroupName, uint16 ui16Tag)
{
_m.lock (301);
SubscriptionList *pSL = _localSubscriptions.get (ui16ClientId);
if (pSL == NULL) {
_m.unlock (301);
return -1;
}
if (pSL->addFilterToGroup (pszGroupName, ui16Tag) != 0) {
_m.unlock (301);
return -2;
}
bool bAddFilter = true;
// I can add the filter to the ConsolidatedSubscriptions only if every client subscribing that group has the filter too
for (UInt32Hashtable<SubscriptionList>::Iterator i = _localSubscriptions.getAllElements(); !i.end(); i.nextElement()) {
SubscriptionList *pSL = i.getValue();
Subscription *pS = pSL->getSubscription(pszGroupName);
switch (pS->getSubscriptionType()) {
case Subscription::GROUP_SUBSCRIPTION: {
if (!((GroupSubscription *)pS)->hasFilter(ui16Tag)) {
bAddFilter = false;
break;
}
break;
}
case Subscription::GROUP_TAG_SUBSCRIPTION: {
if (((GroupTagSubscription *)pS)->hasTag(ui16Tag)) {
bAddFilter = false;
break;
}
break;
}
case Subscription::GROUP_PREDICATE_SUBSCRIPTION :
bAddFilter = false;
break;
}
}
if (bAddFilter) {
_consolidatedSubscriptions.addFilterToGroup (pszGroupName, ui16Tag);
}
_m.unlock (301);
return 0;
}