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


C++ NodeSet::begin方法代码示例

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


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

示例1: removeTrees

void State::removeTrees(const NodeSet& a_nodeSet)
{
	for (NodeSetConstIter iter = a_nodeSet.begin(); iter != a_nodeSet.end(); iter++)
	{
		removeTree(*iter);
	}
}
开发者ID:IdoBegun,项目名称:PAAV_Project,代码行数:7,代码来源:State.cpp

示例2: writeRadiosFile

void ConfigFileWriter::writeRadiosFile(std::string filename, NodeSet& ns)
{
    std::fstream out;
    out.open(filename.c_str(), std::fstream::out | std::fstream::trunc);

    NodeSet::iterator it =  ns.begin();
    while (it != ns.end())
    {
        EntityStruct* ent = (*it)->entity;
        int len = strlen((char*)ent->marking.markingData);
        if (len == 0 || len > 11)
        {
            it++;
            continue;
        }

        RadioStruct* radio = (*it)->radio;
        if (radio)
        {
            out << (*it)->NodeId << ", ";
            out << ent->marking << ", ";
            out << radio->radioIndex << ", ";
            out << radio->relativePosition << ", ";
            out << radio->radioSystemType ;
            out << std::endl;
        }
        it++;
    }
    out.close();
}
开发者ID:LXiong,项目名称:ccn,代码行数:30,代码来源:configFiles.cpp

示例3: functionGreaterEqual

void State::functionGreaterEqual(const string& a_name, int a_value)
{
	NodeSet* parentSet = getVariableNodes(a_name);
	if (parentSet == NULL)
	{
		error("State::functionGreaterEqual - variable " + a_name + " doesn't exist" , false);
		return;
	}
	NodeSet removedRoots;
	for (NodeSetConstIter iter = parentSet->begin(); iter != parentSet->end(); iter++)
	{
		if ((*iter) == NULL)
		{
			error("State::functionGreaterEqual - iterator for variable " + a_name + " is NULL", false);
			continue;
		}

		if ((*iter)->getMaxValue() < a_value)
		{
			debug("State::functionGreaterEqual - Adding " + a_name + "'s root to removedRoots set");
			removedRoots.insert((*iter)->getRoot());
			continue;
		}

		if ((*iter)->getMinValue() < a_value)
		{
			(*iter)->setMinValue(a_value);
		}
	}

	debug("State::functionGreaterEqual - removing trees");
	removeTrees(removedRoots);
}
开发者ID:IdoBegun,项目名称:PAAV_Project,代码行数:33,代码来源:State.cpp

示例4: deep

void
step(DhtRunner& dht, std::atomic_uint& done, std::shared_ptr<NodeSet> all_nodes, dht::InfoHash cur_h, unsigned cur_depth)
{
    std::cout << "step at " << cur_h << ", depth " << cur_depth << std::endl;
    done++;
    dht.get(cur_h, [all_nodes](const std::vector<std::shared_ptr<Value>>& /*values*/) {
        return true;
    }, [&,all_nodes,cur_h,cur_depth](bool, const std::vector<std::shared_ptr<Node>>& nodes) {
        all_nodes->insert(nodes.begin(), nodes.end());
        NodeSet sbuck {nodes.begin(), nodes.end()};
        if (not sbuck.empty()) {
            unsigned bdepth = sbuck.size()==1 ? 0u : InfoHash::commonBits((*sbuck.begin())->id, (*std::prev(sbuck.end()))->id);
            unsigned target_depth = std::min(159u, bdepth+3u);
            std::cout << cur_h << " : " << nodes.size() << " nodes; target is " << target_depth << " bits deep (cur " << cur_depth << ")" << std::endl;
            for (unsigned b = cur_depth ; b < target_depth; b++) {
                auto new_h = cur_h;
                new_h.setBit(b, 1);
                step(dht, done, all_nodes, new_h, b+1);
            }
        }
        done--;
        std::cout << done.load() << " operations left, " << all_nodes->size() << " nodes found." << std::endl;
        cv.notify_one();
    });
}
开发者ID:Andrew-Klaas,项目名称:opendht,代码行数:25,代码来源:dhtscanner.cpp

示例5: createButtons

	void ActionChoiceWindow::createButtons(
		ActionNode* actions, const CEGUI::Point& center, 
		float radius, float angle, float angleWidth)
	{
		PushButton* button = NULL;

		if (actions->isLeaf())
		{
			button = createButton(actions->getAction()->getName(), center);
		}
		else
		{
			if (actions->getGroup() != NULL)
			{
				button = createButton(actions->getGroup()->getName(), center);
			}
			
            const NodeSet children = actions->getChildren();
			float angleStep = angleWidth / (float)children.size();
			float ang = children.size()>1 ? angle - angleWidth : angle - 180;
			for (NodeSet::const_iterator iter = children.begin(); 
				iter != children.end(); iter++)
			{
				CEGUI::Point centerChild = getPositionOnCircle(center, radius, ang);
				createButtons(*iter, centerChild, radius, ang, 60);
				ang += angleStep;
			}
		}

		actions->setButton(button);
		if (button != NULL)
			mWindow->addChildWindow(button);		
	}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:33,代码来源:ActionChoiceWindow.cpp

示例6:

    void ActionChoiceWindow::ActionNode::getAllNodes(ActionNode* treeRoot, NodeSet& nodes)
	{
		nodes.insert(treeRoot);
		const NodeSet children = treeRoot->getChildren();
		
		for (NodeSet::const_iterator iter = children.begin(); iter != children.end(); iter++)
			getAllNodes(*iter, nodes);
	}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:8,代码来源:ActionChoiceWindow.cpp

示例7: RemovePlaceholdersVisitor

 explicit RemovePlaceholdersVisitor(AstNode* nodep) {
     iterate(nodep);
     for (NodeSet::const_iterator it = m_removeSet.begin();
          it != m_removeSet.end(); ++it) {
         AstNode* np = *it;
         np->unlinkFrBack();  // Without next
         np->deleteTree(); VL_DANGLING(np);
     }
 }
开发者ID:jeras,项目名称:verilator,代码行数:9,代码来源:V3Split.cpp

示例8: writeHostnameSection

void writeHostnameSection(std::ostream& out, NodeSet& ns)
{
    NodeSet::iterator it = ns.begin();
    while (it != ns.end())
    {
        out << "[" << (*it)->NodeId << "] HOSTNAME\t\""
            << (*it)->entity->marking.markingData << "\"" << std::endl;
        it++;
    }
    out << std::endl;
}
开发者ID:LXiong,项目名称:ccn,代码行数:11,代码来源:configFiles.cpp

示例9: generateYConstraints

/**
 * Prepares constraints in order to apply VPSC vertically to remove ALL overlap.
 */
int generateYConstraints(const int n, Rectangle** rs, Variable** vars, Constraint** &cs) {
	events=new Event*[2*n];
	int ctr=0,i,m;
	for(i=0;i<n;i++) {
		vars[i]->desiredPosition=rs[i]->getCentreY();
		Node *v = new Node(vars[i],rs[i],rs[i]->getCentreY());
		events[ctr++]=new Event(Open,v,rs[i]->getMinX());
		events[ctr++]=new Event(Close,v,rs[i]->getMaxX());
	}
	qsort((Event*)events, (size_t)2*n, sizeof(Event*), compare_events );
	NodeSet scanline;
	vector<Constraint*> constraints;
	for(i=0;i<2*n;i++) {
		Event *e=events[i];
		Node *v=e->v;
		if(e->type==Open) {
			scanline.insert(v);
			NodeSet::iterator i=scanline.find(v);
			if(i--!=scanline.begin()) {
				Node *u=*i;
				v->firstAbove=u;
				u->firstBelow=v;
			}
			i=scanline.find(v);
			if(++i!=scanline.end())	 {
				Node *u=*i;
				v->firstBelow=u;
				u->firstAbove=v;
			}
		} else {
			// Close event
			Node *l=v->firstAbove, *r=v->firstBelow;
			if(l!=NULL) {
				double sep = (v->r->height()+l->r->height())/2.0;
				constraints.push_back(new Constraint(l->v,v->v,sep));
				l->firstBelow=v->firstBelow;
			}
			if(r!=NULL) {
				double sep = (v->r->height()+r->r->height())/2.0;
				constraints.push_back(new Constraint(v->v,r->v,sep));
				r->firstAbove=v->firstAbove;
			}
			scanline.erase(v);
			delete v;
		}
		delete e;
	}
	delete [] events;
	cs=new Constraint*[m=constraints.size()];
	for(i=0;i<m;i++) cs[i]=constraints[i];
	return m;
}
开发者ID:step21,项目名称:inkscape-osx-packaging-native,代码行数:55,代码来源:generate-constraints.cpp

示例10: part_1

void part_1()
{
    // topological sort with an ordered set
    NodeSet roots;
    Graph children, parents;
    get_graphs("input.txt", children, parents, roots);
    stringstream res;
    while (!roots.empty()) {
        char n = *roots.begin();
        roots.erase(roots.begin());
        res << n;
        for (char m : children[n]) {
            parents[m].erase(n);
            if (parents[m].empty()) {
                roots.insert(m);
            }
        }
        children.erase(n);
    }

    cout << res.str() << endl;
}
开发者ID:amsa,项目名称:advent-of-code,代码行数:22,代码来源:solution.cpp

示例11: f

/** Get parsed fields.
 * Get fields stored below the given node.
 * @param node root node where to start searching
 * @return vector of field representations.
 */
std::vector<InterfaceField>
InterfaceParser::getFields(xmlpp::Node *node)
{
    vector<InterfaceField> result;
    NodeSet set = node->find("field");
    for (NodeSet::iterator i = set.begin(); i != set.end(); ++i) {
        InterfaceField f(&enum_constants);

        const Element * el = dynamic_cast<const Element *>(*i);
        if ( el ) {
            // valid element
            const Element::AttributeList& attrs = el->get_attributes();
            for(Element::AttributeList::const_iterator iter = attrs.begin(); iter != attrs.end(); ++iter) {
                const Attribute* attr = *iter;
                //std::cout << "  Attribute " << attr->get_name() << " = " << attr->get_value() << std::endl;
                f.setAttribute(attr->get_name(), attr->get_value());
            }
        } else {
            throw InterfaceGeneratorInvalidContentException("constant is not an element");
        }

        // Get field comment
        NodeSet nameset = (*i)->find("text()");
        if ( nameset.size() == 0 ) {
            throw InterfaceGeneratorInvalidContentException("no comment for field %s", f.getName().c_str());
        }
        const TextNode *comment_node = dynamic_cast<const TextNode *>(nameset[0]);
        if ( ! comment_node ) {
            throw InterfaceGeneratorInvalidContentException("comment node not text node for constant");
        }
        f.setComment(comment_node->get_content());

        //std::cout << "Field name: " << field_name << std::endl;
        try {
            f.valid();
            result.push_back(f);
        } catch ( fawkes::Exception &e ) {
            e.print_trace();
        }
    }
    for (vector<InterfaceField>::iterator i = result.begin(); i != result.end(); ++i) {
        for (vector<InterfaceField>::iterator j = i + 1; j != result.end(); ++j) {
            if ( (*i).getName() == (*j).getName() ) {
                throw InterfaceGeneratorAmbiguousNameException((*i).getName().c_str(), "field");
            }
        }
    }

    return result;
}
开发者ID:fuxiang90,项目名称:fawkes,代码行数:55,代码来源:parser.cpp

示例12: sort

  void sort(const DOMNode& node, 
            NodeSet& nodes, 
            ExecutionContext<string_type, string_adaptor>& context) const
  {
    if(!sort_)
    {
      if(!nodes.forward())
        nodes.to_document_order();
      return;
    }

    sort_->set_context(node, context);
    std::stable_sort(nodes.begin(), nodes.end(), SortP(*sort_));
  } // sort
开发者ID:QuentinFiard,项目名称:arabica,代码行数:14,代码来源:xslt_sort.hpp

示例13: SomeFunction

void SomeFunction(DominatorMap &dominators, NodeSet &newDominators, ControlFlowNode *n, _Func func)
{
    newDominators.insert(n);

    if (!func(n).empty())
    {
        NodeSet result;
        bool first = true;
        for (ControlFlowNode *pred : func(n))
        {
            if (first)
            {
                result = dominators[pred];
                first = false;
            }
            else
            {
                NodeSet resultTemp;
                NodeSet &temp = dominators[pred];
                set_intersection(result.begin(), result.end(),
                    temp.begin(), temp.end(),
                    inserter(resultTemp, resultTemp.begin()),
                    std::less<ControlFlowNode*>()
                    );

                swap(resultTemp, result);
            }
        }

        for (ControlFlowNode *node : result)
        {
            newDominators.insert(node);
        }
    }
    // Now look at all the predecessors p of n. 
    // Add in the intersection of all those dominators for them.
}
开发者ID:OmerMor,项目名称:SCICompanion-1,代码行数:37,代码来源:TarjanAlgorithm.cpp

示例14: join

void State::join(const State& a_otherState)
{
	NodePairSet commonRoots;
	NodeSet myUniqueRoots;
	NodeSet otherUniqueRoots;

	debug("State::join - joining state: " + string(*this));
	debug("State::join - with state: " + string(a_otherState));

	divideTrees(a_otherState, commonRoots, myUniqueRoots, otherUniqueRoots);
	m_rootSet.clear();

	for (NodePairSetIter iter = commonRoots.begin(); iter != commonRoots.end(); iter++)
	{
		TreeNode* myTree = iter->first;
		TreeNode* otherTree = iter->second;

		myTree->join(otherTree);
		m_rootSet.insert(myTree);
	}

	for (NodeSetIter iter = myUniqueRoots.begin(); iter != myUniqueRoots.end(); iter++)
	{
		m_rootSet.insert(*iter);
	}

	for (NodeSetIter iter = otherUniqueRoots.begin(); iter != otherUniqueRoots.end(); iter++)
	{
		TreeNode* node = new TreeNode(*(*iter));
		m_rootSet.insert(node);
	}

	buildVariableMap();

	debug("State::join - joined state: " + string(*this));
}
开发者ID:IdoBegun,项目名称:PAAV_Project,代码行数:36,代码来源:State.cpp

示例15: removeCamera

void GraphicsContext::removeCamera(osg::Camera* camera)
{
    Cameras::iterator itr = std::find(_cameras.begin(), _cameras.end(), camera);
    if (itr != _cameras.end())
    {
        // find a set of nodes attached the camera that we are removing that isn't
        // shared by any other cameras on this GraphicsContext
        typedef std::set<Node*> NodeSet;
        NodeSet nodes;
        for(unsigned int i=0; i<camera->getNumChildren(); ++i)
        {
            nodes.insert(camera->getChild(i));
        }

        for(Cameras::iterator citr = _cameras.begin();
            citr != _cameras.end();
            ++citr)
        {
            if (citr != itr)
            {
                osg::Camera* otherCamera = *citr;
                for(unsigned int i=0; i<otherCamera->getNumChildren(); ++i)
                {
                    NodeSet::iterator nitr = nodes.find(otherCamera->getChild(i));
                    if (nitr != nodes.end()) nodes.erase(nitr);
                }
            }
        }

        // now release the GLobjects associated with these non shared nodes
        for(NodeSet::iterator nitr = nodes.begin();
            nitr != nodes.end();
            ++nitr)
        {
            const_cast<osg::Node*>(*nitr)->releaseGLObjects(_state.get());
        }

        // release the context of the any RenderingCache that the Camera has.
        if (camera->getRenderingCache())
        {
            camera->getRenderingCache()->releaseGLObjects(_state.get());
        }

        _cameras.erase(itr);

    }
}
开发者ID:PerhapsCaiv,项目名称:osg,代码行数:47,代码来源:GraphicsContext.cpp


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