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


C++ Nodes::end方法代码示例

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


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

示例1: connect

//----------------------------------------------------------------------
// Connecting a node
//----------------------------------------------------------------------
NodePtr LocalNode::connect( const NodeID& nodeID )
{
    EQASSERT( nodeID != NodeID::ZERO );
    EQASSERT( _state == STATE_LISTENING );

    Nodes nodes;
    getNodes( nodes );

    for( Nodes::const_iterator i = nodes.begin(); i != nodes.end(); ++i )
    {
        NodePtr peer = *i;
        if( peer->getNodeID() == nodeID && peer->isConnected( )) // early out
            return peer;
    }

    for( Nodes::const_iterator i = nodes.begin(); i != nodes.end(); ++i )
    {
        NodePtr peer = *i;
        NodePtr node = _connect( nodeID, peer );
        if( node.isValid( ))
            return node;
    }
        
    EQWARN << "Node " << nodeID << " connection failed" << std::endl;
    return 0;
}
开发者ID:MichaelVlad,项目名称:Equalizer,代码行数:29,代码来源:localNode.cpp

示例2: closure

bool TypeHierarchy::closure(Graph & gr,GI & gi,Nodes & vs,GI & gs,const TypeRef * t)
{	 
	if(gi == gr.end()) 
	{
		return false;
	};
	if(*(gi->first) == *t) 
	{
		for(Nodes::const_iterator i = vs.begin();i != vs.end();++i)
		{
			gs->second.insert(*i);
			//insert(vs.begin(),vs.end());
		};
		//gs->second.insert(vs.begin(),vs.end());
		return true;
	};

	for(Nodes::iterator n = gi->second.begin();n != gi->second.end();++n)
	{
		if(vs.find(*n) == vs.end())
		{
			vs.insert(*n);
			GI tmp = gr.find(*n);
			if(closure(gr,tmp,vs,gs,t)) return true;
		};
	};
	return false;
};
开发者ID:mdrichar,项目名称:POGDDL,代码行数:28,代码来源:typecheck.cpp

示例3: main

    int main()
    {
        boost::archive::text_oarchive oa(std::cout);
        using namespace Input::EMMA;
        Nodes nodes;
        nodes.address = "Mr.";
        nodes.country = "Puerto Mazarique";
        nodes.insert(nodes.end(), Node{"John", "Doe"});
        nodes.insert(nodes.end(), Node{"Jane", "Greenwalt"});
        nodes.insert(nodes.end(), Node{"Morgan", "Cheese"});
        nodes.insert(nodes.end(), Node{"Walton", "Whiz"});

        oa << nodes;
    }
开发者ID:CCJY,项目名称:coliru,代码行数:14,代码来源:main.cpp

示例4: checkDesired

static bool checkDesired(vpsc::Dim dim, const Nodes& nodes,
        const Rectangles& targets, const ResizeMap& resizeMap)
{
    for (Nodes::const_iterator i=nodes.begin();i!=nodes.end();++i) {
        const Node* v=*i;
        const unsigned id=v->id;
        const Rectangle* t=targets[id];
        ResizeMap::const_iterator j=resizeMap.find(id);
        if(j==resizeMap.end()) {
            COLA_ASSERT(approx_equals(v->var->desiredPosition,
                        t->getCentreD(dim)));
        }
    }
    for(ResizeMap::const_iterator j=resizeMap.begin();j!=resizeMap.end();++j) {
        const unsigned id=j->first;
        const ResizeInfo& ri=j->second;
        COLA_ASSERT(ri.orig->id==id);
        const Node *ln=ri.lhsNode, *cn=nodes[id], *rn=ri.rhsNode;
        COLA_ASSERT(ln->id==id);
        COLA_ASSERT(cn->id==id);
        COLA_ASSERT(rn->id==id);
        const Rectangle* t=targets[id];
        const double lp = t->getMinD(dim) + DW2,
                     cp = t->getCentreD(dim),
                     rp = t->getMaxD(dim) - DW2;
        COLA_ASSERT(approx_equals(lp,ln->var->desiredPosition));
        COLA_ASSERT(approx_equals(cp,cn->var->desiredPosition));
        COLA_ASSERT(approx_equals(rp,rn->var->desiredPosition));
    }
    return true;
}
开发者ID:SiteView,项目名称:NNMQT,代码行数:31,代码来源:resize.cpp

示例5: getNodeCandidates

Nodes NetworkManager::getNodeCandidates()
{
    Nodes result;

    while ( !depthSearcher->isExhausted() )
    {
        Elements elements = depthSearcher->getElementCandidates();
        cerr << "[NM]\tDepth search returned " << elements.size() << endl;

        for ( Elements::iterator i = elements.begin(); i != elements.end(); i++ )
        {
            Element * element = *i;
            if ( ! element->isNode() )
                continue;

            Node * node = (Node *) element;
            if ( rejectedNodes.find(node) != rejectedNodes.end() )
                continue;

            result.insert(node);
        }

        depthSearcher->increaseSearchSpace();

        if ( !result.empty() )
            break;
    }

    rejectedNodes.insert(result.begin(), result.end());
    cerr << "[NM]\tPrepared " << result.size() << " candidates" << endl;
    return result;
}
开发者ID:artacc,项目名称:DataCenters,代码行数:32,代码来源:networkManager.cpp

示例6: _findMasterNodeID

//---------------------------------------------------------------------------
// identifier master node mapping
//---------------------------------------------------------------------------
NodeID ObjectStore::_findMasterNodeID( const base::UUID& identifier )
{
    EQ_TS_NOT_THREAD( _commandThread );

    // OPT: look up locally first?
    Nodes nodes;
    _localNode->getNodes( nodes );
    
    // OPT: send to multiple nodes at once?
    for( Nodes::iterator i = nodes.begin(); i != nodes.end(); i++ )
    {
        NodePtr node = *i;
        EQLOG( LOG_OBJECTS ) << "Finding " << identifier << " on " << node
                             << std::endl;

        NodeFindMasterNodeIDPacket packet;
        packet.requestID = _localNode->registerRequest();
        packet.identifier = identifier;
        node->send( packet );

        NodeID masterNodeID = base::UUID::ZERO;
        _localNode->waitRequest( packet.requestID, masterNodeID );
        if( masterNodeID != base::UUID::ZERO )
        {
            EQLOG( LOG_OBJECTS ) << "Found " << identifier << " on "
                                 << masterNodeID << std::endl;
            return masterNodeID;
        }
    }

    return base::UUID::ZERO;
}
开发者ID:MichaelVlad,项目名称:Equalizer,代码行数:35,代码来源:objectStore.cpp

示例7: print

void Node::print(const string& connect)
{
   for (CNodeIter iter = m_nodes.begin(); iter != m_nodes.end(); ++iter) {
      Node* pNode    = *iter;
      CNodeIter next = iter;
      ++next;

      if (next != m_nodes.end()) {
         cout << connect << "+---" << pNode->name() << endl;
         pNode->print(connect + "|   ");
      } else {
         cout << connect << "\\---" << pNode->name() << endl;
         pNode->print(connect + "    ");
      }
   }
}
开发者ID:linuxsoftware,项目名称:tools,代码行数:16,代码来源:treeify.C

示例8: getAvailableNodeAssignments

void VirtualMachinesAssigner::getAvailableNodeAssignments(Element* element, std::map<Node*, std::vector<Node*> >& VMsOnNode, std::map<Node*, Assignment* >& vmAssignment, Assignment* assignment)
{
    Nodes::iterator nodesIt = network->getNodes().begin();
    Nodes::iterator nodesItEnd = network->getNodes().end();
    for ( ; nodesIt != nodesItEnd; ++nodesIt )
    {
        // inserting only vms with capacity less then the element's one
        VMsOnNode[*nodesIt] = std::vector<Node *>();

        // going through all other assigned requests
        RequestAssignment::iterator it = requestAssignment.begin();
        RequestAssignment::iterator itEnd = requestAssignment.end();
        for ( ; it != itEnd; ++it )
        {
            Nodes vms = it->second->GetAssigned(*nodesIt);
            Nodes::iterator vmIt = vms.begin();
            Nodes::iterator vmItEnd = vms.end();
            for ( ; vmIt != vmItEnd; ++vmIt )
            {
                VMsOnNode[*nodesIt].push_back(*vmIt);
                vmAssignment[*vmIt] = it->second;
            }
        }
    }
}
开发者ID:MargaritaShakhova,项目名称:DataCenters,代码行数:25,代码来源:virtualMachinesAssigner.cpp

示例9: PrintNodes

 static void PrintNodes(std::ostream &str, const Nodes &nodes)
 {
     for (typename Nodes::const_iterator i = nodes.begin(); i != nodes.end(); i++)
     {
         PrintSimplex(str, (*i)->simplex);
     }
 }
开发者ID:pbrendel,项目名称:AccSub,代码行数:7,代码来源:Utils.hpp

示例10: Compute

    static void Compute(Nodes &nodes, AccSubAlgorithm accSubAlgorithm, AccTest *accTest)
    {
#ifdef ACCSUB_TRACE
        Timer::TimeStamp("ComputationsParallelOMP start");
        Timer::Time start = Timer::Now();
        if (accSubAlgorithm == AccSubAlgorithm::AccSubIG)
        {
            std::cout<<"using AccSubIG"<<std::endl;
        }
        else
        {
            std::cout<<"using AccSubST"<<std::endl;
        }
#endif
        #pragma omp parallel for
        for (typename Nodes::iterator i = nodes.begin(); i != nodes.end(); i++)
        {
            ComputationsLocal<PartitionGraph>::CreateIncidenceGraph(*i, accSubAlgorithm, accTest);
#ifdef ACCSUB_TRACE
            Timer::TimeStamp("incidence graph calculated");
#endif
        }
#ifdef ACCSUB_TRACE
        Timer::TimeStamp("ComputationsParallelOMP end");
        Timer::TimeFrom(start, "total distributed computations");
#endif
    }
开发者ID:pbrendel,项目名称:AccSub,代码行数:27,代码来源:ComputationsParallelOMP.hpp

示例11: pt

const set<const TypeRef *> & TypeHierarchy::leaves(PTypeRef & t)
{
	static Nodes empty;

	GI gi = leafNodes.find(&t);
	if(gi != leafNodes.end()) 
	{
		return (gi->second);
	};
	
	gi = downGraph.find(&t);
	if(gi == downGraph.end()) return empty;
	Nodes ns;
	PTypeRef pt(0);
	closure(downGraph,gi,ns,gi,&pt);
	Nodes ms;
	for(Nodes::const_iterator i = ns.begin();i != ns.end();++i)
	{
		Nodes xs;
		gi = downGraph.find(*i);
		closure(downGraph,gi,xs,gi,&pt);
		if(xs.empty()) ms.insert(*i);
	};
	leafNodes[downGraph.find(&t)->first] = ms;
	return leafNodes[downGraph.find(&t)->first];
};
开发者ID:mdrichar,项目名称:POGDDL,代码行数:26,代码来源:typecheck.cpp

示例12: _stopNodes

void Config::_stopNodes()
{
    // wait for the nodes to stop, destroy entities, disconnect
    Nodes stoppingNodes;
    const Nodes& nodes = getNodes();
    for( Nodes::const_iterator i = nodes.begin(); i != nodes.end(); ++i )
    {
        Node* node = *i;
        const State state = node->getState();
        if( state != STATE_STOPPED && state != STATE_FAILED )
            continue;

        LBASSERT( !node->isActive() || state == STATE_FAILED );
        if( node->isApplicationNode( ))
            continue;

        co::NodePtr netNode = node->getNode();
        if( !netNode ) // already disconnected
            continue;

        LBLOG( LOG_INIT ) << "Exiting node" << std::endl;

        if( state == STATE_FAILED )
            node->setState( STATE_STOPPED );

        stoppingNodes.push_back( node );
        LBASSERT( netNode.isValid( ));

        netNode->send( fabric::CMD_SERVER_DESTROY_CONFIG )
                << getID() << LB_UNDEFINED_UINT32;
        netNode->send( fabric::CMD_CLIENT_EXIT );
    }

    // now wait that the render clients disconnect
    uint32_t nSleeps = 50; // max 5 seconds for all clients
    for( Nodes::const_iterator i = stoppingNodes.begin();
         i != stoppingNodes.end(); ++i )
    {
        Node*        node    = *i;
        co::NodePtr netNode = node->getNode();
        node->setNode( 0 );

        if( nSleeps )
            while( netNode->isConnected() && --nSleeps )
                lunchbox::sleep( 100 ); // ms

        if( netNode->isConnected( ))
        {
            co::LocalNodePtr localNode = getLocalNode();
            LBASSERT( localNode.isValid( ));

            LBWARN << "Forcefully disconnecting exited render client node"
                   << std::endl;
            localNode->disconnect( netNode );
        }

        LBLOG( LOG_INIT ) << "Disconnected node" << std::endl;
    }
}
开发者ID:hernando,项目名称:Equalizer,代码行数:59,代码来源:config.cpp

示例13: count_per_qid

int Test::count_per_qid(const Nodes& nodes, const Qid& qid) const
{
	int count = 0;
	for (Nodes::const_iterator ni = nodes.begin(); ni != nodes.end(); ++ni) {
		if (ni->qid == qid) ++count;
	}
	return count;
}
开发者ID:nrmnr,项目名称:auto_select_test,代码行数:8,代码来源:test.cpp

示例14: PrintAccSub

 static void PrintAccSub(std::ostream &str, const Nodes &nodes)
 {
     for (typename Nodes::const_iterator i = nodes.begin(); i != nodes.end(); i++)
     {
         if ((*i)->IsInAccSub())
         {
             PrintSimplex(str, *((*i)->simplex));
         }
     }
     str<<std::endl;
 }
开发者ID:pbrendel,项目名称:AccSub,代码行数:11,代码来源:Utils.hpp

示例15: split

void split() {
    Nodes nodes;
    Edges es;

    printf("test: bend2()\n");

    addNode(nodes,100,100,40,20);
    addNode(nodes,100,130,40,20);
    addNode(nodes,70,160,40,20);
    addNode(nodes,180,190,40,20);
    EdgePoints p1;
    addToPath(p1,nodes[0],EdgePoint::CENTRE);
    addToPath(p1,nodes[1],EdgePoint::BL);
    addToPath(p1,nodes[1],EdgePoint::TL);
    addToPath(p1,nodes[3],EdgePoint::CENTRE);
    es.push_back(new Edge(100,p1));

    EdgePoints p2;
    addToPath(p2,nodes[2],EdgePoint::CENTRE);
    addToPath(p2,nodes[3],EdgePoint::CENTRE);
    es.push_back(new Edge(50,p2));

    const size_t V = nodes.size();

    vpsc::Constraints cs;
    vpsc::Variables vs;
    getVariables(nodes,vs);
    { // scope for t, so that t gets destroyed before es

        TopologyConstraints t(vpsc::HORIZONTAL,nodes,es,vs,cs);
        writeFile(nodes,es,"split-0.svg");

        // test computeStress
        double stress=t.computeStress();
        printf("Stress=%f\n",stress);
        //assert(fabs(expectedStress-stress)<1e-4);

        valarray<double> g(V);
        cola::SparseMap h(V);
        for(unsigned i=1;i<5;i++) {
            g=0;
            h.clear();
            t.gradientProjection(g,h);
            stringstream ss;
            ss << "split-" << i << ".svg";
            writeFile(nodes,es,ss.str().c_str());
        }
    }

    for_each(nodes.begin(),nodes.end(),delete_node());
    for_each(es.begin(),es.end(),delete_object());
    for_each(cs.begin(),cs.end(),delete_object());
    for_each(vs.begin(),vs.end(),delete_object());
}
开发者ID:AidanDelaney,项目名称:adaptagrams,代码行数:54,代码来源:split.cpp


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