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


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

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


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

示例1: evaluate

void Step::evaluate(Node* context, NodeSet& nodes) const
{
    nodesInAxis(context, nodes);
    
    EvaluationContext& evaluationContext = Expression::evaluationContext();
    
    for (unsigned i = 0; i < m_predicates.size(); i++) {
        Predicate* predicate = m_predicates[i];

        NodeSet newNodes;
        if (!nodes.isSorted())
            newNodes.markSorted(false);

        evaluationContext.size = nodes.size();
        evaluationContext.position = 1;
        for (unsigned j = 0; j < nodes.size(); j++) {
            Node* node = nodes[j];

            Expression::evaluationContext().node = node;
            EvaluationContext backupCtx = evaluationContext;
            if (predicate->evaluate())
                newNodes.append(node);

            evaluationContext = backupCtx;
            ++evaluationContext.position;
        }

        nodes.swap(newNodes);
    }
}
开发者ID:FilipBE,项目名称:qtextended,代码行数:30,代码来源:XPathStep.cpp

示例2: evaluate

void Step::evaluate(EvaluationContext& evaluationContext, Node* context, NodeSet& nodes) const
{
    evaluationContext.position = 0;

    nodesInAxis(evaluationContext, context, nodes);

    // Check predicates that couldn't be merged into node test.
    for (unsigned i = 0; i < m_predicates.size(); i++) {
        Predicate* predicate = m_predicates[i].get();

        OwnPtrWillBeRawPtr<NodeSet> newNodes(NodeSet::create());
        if (!nodes.isSorted())
            newNodes->markSorted(false);

        for (unsigned j = 0; j < nodes.size(); j++) {
            Node* node = nodes[j];

            evaluationContext.node = node;
            evaluationContext.size = nodes.size();
            evaluationContext.position = j + 1;
            if (predicate->evaluate(evaluationContext))
                newNodes->append(node);
        }

        nodes.swap(*newNodes);
    }
}
开发者ID:335969568,项目名称:Blink-1,代码行数:27,代码来源:XPathStep.cpp

示例3: 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

示例4: evaluate

void Step::evaluate(Node* context, NodeSet& nodes) const
{
    EvaluationContext& evaluationContext = Expression::evaluationContext();
    evaluationContext.position = 0;

    nodesInAxis(context, nodes);

    // Check predicates that couldn't be merged into node test.
    for (unsigned i = 0; i < m_predicates.size(); i++) {
        Predicate* predicate = m_predicates[i].get();

        NodeSet newNodes;
        if (!nodes.isSorted())
            newNodes.markSorted(false);

        for (unsigned j = 0; j < nodes.size(); j++) {
            Node* node = nodes[j];

            evaluationContext.node = node;
            evaluationContext.size = nodes.size();
            evaluationContext.position = j + 1;
            if (predicate->evaluate())
                newNodes.append(node);
        }

        nodes.swap(newNodes);
    }
}
开发者ID:Igalia,项目名称:blink,代码行数:28,代码来源:XPathStep.cpp

示例5: constructCVM

void RegionGraph::constructCVM( const FactorGraph &fg, const std::vector<NodeSet> &cl) {
  using std::pair;

  DLOG(INFO) << "constructCVM called (" << fg.nrNodes() << " vars, " << fg.nrFactors() << " facs, " << cl.size() << " clusters)";

  // Retain only maximal clusters
  DLOG(INFO) << "  Constructing ClusterGraph";
  ClusterGraph cg( cl );
  DLOG(INFO) << "  Erasing non-maximal clusters";
  cg.eraseNonMaximal();

  // Create inner regions - first pass
  DLOG(INFO) << "  Creating inner regions (first pass)";
  std::set<NodeSet> betas;
  for( size_t alpha = 0; alpha < cg.nrClusters(); alpha++ )
    for( size_t alpha2 = alpha; (++alpha2) != cg.nrClusters(); ) {
      NodeSet intersection = cg.cluster(alpha) & cg.cluster(alpha2);
      if( intersection.size() > 0 )
        betas.insert( intersection );
    }

  // Create inner regions - subsequent passes
  DLOG(INFO) << "  Creating inner regions (next passes)";
  std::set<NodeSet> new_betas;
  do {
    new_betas.clear();
    for (std::set<NodeSet>::const_iterator gamma = betas.begin(); gamma != betas.end(); gamma++ )
      for (std::set<NodeSet>::const_iterator gamma2 = gamma; (++gamma2) != betas.end(); ) {
        NodeSet intersection = (*gamma) & (*gamma2);
        if( (intersection.size() > 0) && (betas.count(intersection) == 0) )
          new_betas.insert( intersection );
      }
    betas.insert(new_betas.begin(), new_betas.end());
  } while( new_betas.size() );

  // Create inner regions - final phase
  DLOG(INFO) << "  Creating inner regions (final phase)";
  std::vector<Region> irs;
  irs.reserve( betas.size() );
  for (std::set<NodeSet>::const_iterator beta = betas.begin(); beta != betas.end(); beta++ )
    irs.push_back( Region(*beta,0.0) );

  // Create edges
  DLOG(INFO) << "  Creating edges";
  std::vector<std::pair<size_t,size_t> > edges;
  for( size_t beta = 0; beta < irs.size(); beta++ )
    for( size_t alpha = 0; alpha < cg.nrClusters(); alpha++ )
      if( cg.cluster(alpha) >> irs[beta] )
        edges.push_back( pair<size_t,size_t>(alpha,beta) );

  // Construct region graph
  DLOG(INFO) << "  Constructing region graph";
  construct( fg, cg.clusters(), irs, edges );

  // Calculate counting numbers
  DLOG(INFO) << "  Calculating counting numbers";
  calcCVMCountingNumbers();

  DLOG(INFO) << "Done.";
}
开发者ID:ushadow,项目名称:pdbntk,代码行数:60,代码来源:region_graph.cpp

示例6: filterChildElements

Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectTransitions(const std::string& event) {
	Arabica::XPath::NodeSet<std::string> enabledTransitions;

	NodeSet<std::string> states;
	for (unsigned int i = 0; i < _configuration.size(); i++) {
		if (isAtomic(_configuration[i]))
			states.push_back(_configuration[i]);
	}
	states.to_document_order();

#if 0
	std::cout << "Atomic states: " << std::endl;
	for (int i = 0; i < states.size(); i++) {
		std::cout << states[i] << std::endl << "----" << std::endl;
	}
	std::cout << std::endl;
#endif

	unsigned int index = 0;
	while(states.size() > index) {
		bool foundTransition = false;
		NodeSet<std::string> transitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", states[index]);
		for (unsigned int k = 0; k < transitions.size(); k++) {
			if (isEnabledTransition(transitions[k], event)) {
				enabledTransitions.push_back(transitions[k]);
				foundTransition = true;
				goto LOOP;
			}
		}
		if (!foundTransition) {
			Node<std::string> parent = states[index].getParentNode();
			if (parent) {
				states.push_back(parent);
			}
		}
LOOP:
		index++;
	}

	enabledTransitions = filterPreempted(enabledTransitions);

#if 0
	std::cout << "Enabled transitions: " << std::endl;
	for (int i = 0; i < enabledTransitions.size(); i++) {
		std::cout << DOMUtils::xPathForNode(enabledTransitions[i]) << std::endl;
	}
	std::cout << std::endl;
#endif

	return enabledTransitions;
}
开发者ID:mathiasjohanson,项目名称:uscxml,代码行数:51,代码来源:InterpreterDraft6.cpp

示例7: ATTR

Arabica::XPath::NodeSet<std::string> InterpreterDraft6::selectEventlessTransitions() {
	Arabica::XPath::NodeSet<std::string> enabledTransitions;

	NodeSet<std::string> states;
	for (unsigned int i = 0; i < _configuration.size(); i++) {
		if (isAtomic(_configuration[i]))
			states.push_back(_configuration[i]);
	}
	states.to_document_order();

#if 0
	std::cout << "Atomic States: ";
	for (int i = 0; i < atomicStates.size(); i++) {
		std::cout << ATTR(atomicStates[i], "id") << ", ";
	}
	std::cout << std::endl;
#endif

	unsigned int index = 0;
	while(states.size() > index) {
		bool foundTransition = false;
		NodeSet<std::string> transitions = filterChildElements(_nsInfo.xmlNSPrefix + "transition", states[index]);
		for (unsigned int k = 0; k < transitions.size(); k++) {
			if (!HAS_ATTR(transitions[k], "event") && hasConditionMatch(transitions[k])) {
				enabledTransitions.push_back(transitions[k]);
				foundTransition = true;
				goto LOOP;
			}
		}
		if (!foundTransition) {
			Node<std::string> parent = states[index].getParentNode();
			if (parent) {
				states.push_back(parent);
			}
		}
LOOP:
		index++;
	}

#if 0
	std::cout << "Enabled eventless transitions: " << std::endl;
	for (int i = 0; i < enabledTransitions.size(); i++) {
		std::cout << enabledTransitions[i] << std::endl << "----" << std::endl;
	}
	std::cout << std::endl;
#endif

	enabledTransitions = filterPreempted(enabledTransitions);
	return enabledTransitions;
}
开发者ID:mathiasjohanson,项目名称:uscxml,代码行数:50,代码来源:InterpreterDraft6.cpp

示例8: 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

示例9: if

 /**
  * Gets the spelling alternatives to the specified query terms.
  * Returns a map with term as key and an Alternative object as value for each query term
  */
 std::map<std::string, Alternative> getAlternatives() {
     if (!_alternatives.empty())
         return _alternatives;
     _alternatives.clear();
     NodeSet alternatives = doc->FindFast("cps:reply/cps:content/alternatives_list/alternatives", true);
     for (unsigned int i = 0; i < alternatives.size(); i++) {
         Node *el = alternatives[i]->getFirstChild();
         Alternative alt;
         while (el != NULL) {
         	std::string name = el->getName();
             if (name == "to")
                 alt.to = el->getContent();
             else if (name == "count")
                 alt.count = atoi(el->getContentPtr());
             else if (name == "word") {
                 Alternative::Word w;
                 w.count = atoi(el->getAttribute("count")->getContentPtr());
                 w.h = atof(el->getAttribute("h")->getContentPtr());
                 w.idif = atof(el->getAttribute("idif")->getContentPtr());
                 w.cr = atof(el->getAttribute("cr")->getContentPtr());
                 w.content = el->getContent();
                 alt.words.push_back(w);
             }
             el = el->getNextSibling();
         }
         _alternatives[alt.to] = alt;
     }
     return _alternatives;
 }
开发者ID:clusterpoint,项目名称:cpp-client-api,代码行数:33,代码来源:AlternativesResponse.hpp

示例10: throw

   // ----------------------------------------------------------------------
   bool
   LocalizationNeighborhood::
   is_sound( void )
      const throw()
   {
      NodeSet temp = ref_nodes();
      temp.insert( sounds_.begin(), sounds_.end() );

      // if there is no info about ref-nodes of the anchors, ignore this
      // check return true anyway
      if ( anchor_cnt() > 0 && temp.size() == 0 )
         return true;

//TODO: Dimension anpassen !!!!
      return (int)temp.size() >= 3;
   }
开发者ID:MarcStelzner,项目名称:shawn,代码行数:17,代码来源:localization_neighborhood.cpp

示例11: getTargetStates

void InterpreterDraft6::microstep(const Arabica::XPath::NodeSet<std::string>& enabledTransitions) {
#if VERBOSE
	std::cout << "Transitions: ";
	for (int i = 0; i < enabledTransitions.size(); i++) {
		std::cout << ((Element<std::string>)getSourceState(enabledTransitions[i])).getAttribute("id") << " -> " << std::endl;
		NodeSet<std::string> targetSet = getTargetStates(enabledTransitions[i]);
		for (int j = 0; j < targetSet.size(); j++) {
			std::cout << "    " << ((Element<std::string>)targetSet[j]).getAttribute("id") << std::endl;
		}
	}
	std::cout << std::endl;
#endif

	// --- MONITOR: beforeMicroStep ------------------------------
	for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
		try {
			(*monIter)->beforeMicroStep(shared_from_this());
		}
		USCXML_MONITOR_CATCH_BLOCK(beforeMicroStep)
	}

	exitStates(enabledTransitions);

	monIter_t monIter;
	for (int i = 0; i < enabledTransitions.size(); i++) {
		Element<std::string> transition(enabledTransitions[i]);

		// --- MONITOR: beforeTakingTransitions ------------------------------
		for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
			try {
				(*monIter)->beforeTakingTransition(shared_from_this(), transition, (i + 1 < enabledTransitions.size()));
			}
			USCXML_MONITOR_CATCH_BLOCK(beforeTakingTransitions)
		}

		executeContent(transition);

		// --- MONITOR: afterTakingTransitions ------------------------------
		for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
			try {
				(*monIter)->afterTakingTransition(shared_from_this(), transition, (i + 1 < enabledTransitions.size()));
			}
			USCXML_MONITOR_CATCH_BLOCK(afterTakingTransitions)
		}
	}

	enterStates(enabledTransitions);

	// --- MONITOR: afterMicroStep ------------------------------
	for(monIter_t monIter = _monitors.begin(); monIter != _monitors.end(); monIter++) {
		try {
			(*monIter)->afterMicroStep(shared_from_this());
		}
		USCXML_MONITOR_CATCH_BLOCK(afterMicroStep)
	}

}
开发者ID:mathiasjohanson,项目名称:uscxml,代码行数:57,代码来源:InterpreterDraft6.cpp

示例12: mergeComponentAndNeighbors

NodeSet IndSetExtBySeparators::mergeComponentAndNeighbors(
		const NodeSet& component, const NodeSet& compNeighbors) {

	// neighbors and comp nodes are different sets
	vector<Node> mergedComp(compNeighbors.size() + component.size());

	for (unsigned int i = 0; i < component.size(); i++) {

		mergedComp[i] = component[i];
	}

	for (unsigned int i = 0; i < compNeighbors.size(); i++) {

		mergedComp[i + component.size()] = compNeighbors[i];
	}

	return mergedComp;

}
开发者ID:NofarCarmeli,项目名称:TreeDecompositionEnumeration,代码行数:19,代码来源:IndSetExtBySeparators.cpp

示例13: assign

void XPathDataModel::assign(const NodeSet<std::string>& key,
                            const NodeSet<std::string>& value,
                            const Element<std::string>& assignElem) {
    if (key.size() == 0)
        return;
    if (value.size() == 0 || !value[0])
        return;

    for (size_t i = 0; i < key.size(); i++) {
        switch (key[i].getNodeType())
        case Node_base::ELEMENT_NODE: {
        assign(Element<std::string>(key[i]), value, assignElem);
        break;
        default:
//			std::cout << key[i].getNodeType() << std::endl;
            ERROR_EXECUTION_THROW("Unsupported node type for assign");
            break;
        }
    }
}
开发者ID:juehv,项目名称:uscxml,代码行数:20,代码来源:XPathDataModel.cpp

示例14: _route_xml

void Server::_route_xml(int fd,vector<shared_ptr<Document> > docs) {
  Node::PrefixNsMap pnm;
  pnm["psxml"]="http://www.psxml.org/PSXML-0.1";
  for(unsigned int i = 0; i < docs.size(); i++) {
    shared_ptr<Document> doc = docs[i];
    Element * root = doc->get_root_node();
    // deal with subscribes
    if(root->get_name() == "Subscribe") {
      NodeSet subs = doc->get_root_node()->find(
        "/psxml:Subscribe/psxml:XPath",pnm);
      list<XPathExpression> exps;
      for(unsigned int i =0; i < subs.size(); i++) {
        Element * sub = dynamic_cast<Element*>(subs[i]);
        assert(sub != NULL);
        ustring exp(sub->get_attribute("exp")->get_value());
        NodeSet nss = sub->find("./psxml:Namespace",pnm);
        Node::PrefixNsMap prefix_map;
        XPathExpression xpath;
        xpath.expression = exp;
        for(unsigned int j = 0; j < nss.size(); j++) {
          Element * ns = dynamic_cast<Element*>(nss[j]);
          assert(ns != NULL);
          ustring pf(ns->get_attribute("prefix")->get_value());
          prefix_map[pf] = ns->get_child_text()->get_content();
        }
        xpath.ns = prefix_map;
	exps.push_back(xpath);
      }
      bool foreign = (_foreign_connections.count(fd) > 0); 
      _engine.subscribe(fd,exps,foreign);
      // if our aggregate subscriptions have changed (non-foreign)
      // we tell the other psxmld servers!
      if(!foreign)
        _update_foreign_subscriptions();
    }
    // find any data publishes
    _engine.publish( root->find("/psxml:Publish/*",pnm), _protocols);
  }
}
开发者ID:davidhinkes,项目名称:psxml,代码行数:39,代码来源:Server.cpp

示例15: getFacets

 /**
  * Returns the map of facets where key is path for facet and value as vector of terms for this facet
  */
 std::map<std::string, std::vector<std::string> > getFacets() {
     if (!_facets.empty())
         return _facets;
     NodeSet ns = doc->FindFast("facet", true);
     for (unsigned int i = 0; i < ns.size(); i++) {
     	std::list<Node *> terms = ns[i]->getChildren("term");
     	std::string path = ns[i]->getAttribute("path")->getValue();
         for (std::list<Node *>::iterator it = terms.begin(); it != terms.end(); it++) {
             _facets[path].push_back((*it)->getContent());
         }
     }
     return _facets;
 }
开发者ID:clusterpoint,项目名称:cpp-client-api,代码行数:16,代码来源:ListFacetsResponse.hpp


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