当前位置: 首页>>代码示例>>C++>>正文


C++ Subscription::printInfo方法代码示例

本文整理汇总了C++中Subscription::printInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ Subscription::printInfo方法的具体用法?C++ Subscription::printInfo怎么用?C++ Subscription::printInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Subscription的用法示例。


在下文中一共展示了Subscription::printInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: printWorldStateInfo

int TopologyWorldState::printWorldStateInfo (void) 
{
    // Prints information about local node, like subscriptions, alive neighbors, dead peers, etc
    _m.lock (141);
    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "=========================================================================\n");
    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     PRINT WORLD STATE INFO\n");
    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     Node id: %s\n", _pDisService->getNodeId());
    if ((_pLocalNodeInfo->getConsolidatedSubscriptions())->getCount() == 0) {
        checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     No subscribed groups\n");
    } else {
        _pLocalNodeInfo->printAllSubscribedGroups();
        // Print subscribing clients
        checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     SUBSCRIBING CLIENTS:\n");
        DArray<uint16> *pSubClients = _pLocalNodeInfo->getAllSubscribingClients();
        for (int j = 0; j <= pSubClients->getHighestIndex(); j++) {
            checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     SUB CLIENT N.%d:\n", (*pSubClients)[j]);
            SubscriptionList *pSubsForClient = _pLocalNodeInfo->getSubscriptionListForClient ((*pSubClients)[j]);
            _pLocalNodeInfo->releaseLocalNodeInfo();
            if (pSubsForClient && pSubsForClient->getCount() != 0) {
                for (StringHashtable<Subscription>::Iterator i = pSubsForClient->getIterator(); !i.end(); i.nextElement()) {
                    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     SUBSCRIPTION:\n");
                    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     groupname %s\n", i.getKey());
                    Subscription *pS = i.getValue();
                    pS->printInfo();                
                }
            }
        }
        // Print local consolidated subscriptions
        checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     LOCAL CONSOLIDATED SUBSCRIPTIONS:\n");
        SubscriptionList *pSubscriptions = _pLocalNodeInfo->getConsolidatedSubscriptions();
        for (StringHashtable<Subscription>::Iterator i = pSubscriptions->getIterator(); !i.end(); i.nextElement()) {
            checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     SUBSCRIPTION:\n");
            checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     groupname %s\n", i.getKey());
            Subscription *pS = i.getValue();
            pS->printInfo();   
        }
    }
    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "-------------------------------------------------------------------------\n");
    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     %d ACTIVE NEIGHBORS\n", _pLocalNodeInfo->getCount());
    for (StringHashtable<Thing>::Iterator iNeighbors = _pLocalNodeInfo->getAllElements(); !iNeighbors.end(); iNeighbors.nextElement()) {
        checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "-------------------------------------------------------------------------\n");
        RemoteNodeInfo *pRNI = (RemoteNodeInfo *) iNeighbors.getValue();
        pRNI->printRemoteNodeInfo();
    }
    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "-------------------------------------------------------------------------\n");
    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "     %d DEAD PEERS\n", _deadPeers.getCount());
    for (StringHashtable<RemoteNodeInfo>::Iterator iDead = _deadPeers.getAllElements(); !iDead.end(); iDead.nextElement()) {
        checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "-------------------------------------------------------------------------\n");
        RemoteNodeInfo *pRNI = (RemoteNodeInfo *) iDead.getValue();
        pRNI->printRemoteNodeInfo();
    }
    checkAndLogMsg ("TopologyWorldState::printWorldStateInfo", Logger::L_Info, "=========================================================================\n");
    _m.unlock (141);
    return 0;
}
开发者ID:fpoltronieri,项目名称:nomads,代码行数:55,代码来源:TopologyWorldState.cpp


注:本文中的Subscription::printInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。