本文整理汇总了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;
}
示例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;
};
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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 + " ");
}
}
}
示例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;
}
}
}
}
示例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);
}
}
示例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
}
示例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];
};
示例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;
}
}
示例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;
}
示例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;
}
示例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());
}