本文整理汇总了C++中NodeVector::size方法的典型用法代码示例。如果您正苦于以下问题:C++ NodeVector::size方法的具体用法?C++ NodeVector::size怎么用?C++ NodeVector::size使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NodeVector
的用法示例。
在下文中一共展示了NodeVector::size方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
template<class NodeVector> void FileSystem::debugPrintNodes(NodeVector nodes) {
if( debug) {
unsigned int ix;
NodeInfo* node;
for (ix = 0; ix < nodes.size(); ++ix) {
node = nodes.at(ix);
cout << "Node: " << node->getName()
<< "\t\tSize: " << node->getSize()
<< "\tModify: " << node->getModifyTime()
<< "\tPath: " << node->getPath()
<< "\tSimilars: ";
vector<NodeInfo*>::iterator it;
vector<NodeInfo*> nodes = node->getSimilar();
for(it=nodes.begin(); it != nodes.end(); ++it) {
cout << (*it)->getPath() << ", ";
}
cout << endl;
}
}
}
示例2:
boost::optional<ParentObject> SetpointManagerMixedAir_Impl::parent() const {
NodeVector nodes = getObject<ModelObject>().getModelObjectSources<Node>();
if (nodes.size() == 1u) {
return nodes[0];
}
return boost::none;
}
示例3: mergeVectors
void mergeVectors(NodeVector* some, NodeVector more) { // bool keep destination unmodified=TRUE
// return std::set_union(some,&more);
for (int i=0; i < more.size(); i++) {
if (!contains(*some, (Node*) more[i], false))
// if (std::find(some->begin(), some->end(), more[i]) == some->end())// NOT contains x yet
some->push_back(more[i]);
}
}
示例4: ngraph_error
shared_ptr<Node> op::Constant::copy_with_new_args(const NodeVector& new_args) const
{
if (new_args.size() != 0)
{
throw ngraph_error("Incorrect number of new arguments");
}
return make_shared<Constant>(m_element_type, m_shape, m_data);
}
示例5: ngraph_error
shared_ptr<Node> op::Cos::copy_with_new_args(const NodeVector& new_args) const
{
if (new_args.size() != 1)
{
throw ngraph_error("Incorrect number of new arguments");
}
return make_shared<Cos>(new_args.at(0));
}
示例6: ngraph_error
shared_ptr<Node> op::OneHot::copy_with_new_args(const NodeVector& new_args) const
{
if (new_args.size() != 1)
{
throw ngraph_error("Incorrect number of new arguments");
}
return make_shared<OneHot>(new_args.at(0), m_shape, m_one_hot_axis);
}
示例7: ngraph_error
shared_ptr<Node> op::Min::copy_with_new_args(const NodeVector& new_args) const
{
if (new_args.size() != 1)
{
throw ngraph_error("Incorrect number of new arguments");
}
return make_shared<Min>(new_args.at(0), m_reduction_axes);
}
示例8: ngraph_error
shared_ptr<Node> op::GetOutputElement::copy_with_new_args(const NodeVector& new_args) const
{
if (new_args.size() != 1)
{
throw ngraph_error("Incorrect number of new arguments");
}
return make_shared<GetOutputElement>(new_args.at(0), m_n);
}
示例9: contains
bool contains(NodeVector& all, Node& node, bool fuzzy) {
// if(!fuzzy)
// return contains2(all,&node);
for (int i=0; i < all.size(); i++) {
if ((Node*) all[i] == &node) return true;
if (fuzzy && eq(all[i], &node)) return true;
}
return false;
}
示例10: depthFirstMap
vector<Algorithm*> Network::innerVisibleAlgorithms(Algorithm* algo) {
NetworkNode* visibleNetworkRoot = visibleNetwork<NetworkNode>(algo);
vector<Algorithm*> algos = depthFirstMap(visibleNetworkRoot, returnAlgorithm);
NodeVector nodes = depthFirstSearch(visibleNetworkRoot);
for (int i=0; i<(int)nodes.size(); i++) delete nodes[i];
return algos;
}
示例11: equal
/**
* Returns true if both qualified types %a and %b are equivalent, i.e. have the
* same members, interfaces, ranges and native type equivalents.
*/
bool equal(const QualifiedType::Ptr& a, const QualifiedType::Ptr& b)
{
// Treat the trivial cases where the number of fields does not match.
const NodeVector& membersA = a->getMembers(), membersB = b->getMembers();
if (membersA.size() != membersB.size()) return false;
const NodeVector& funcsA = a->getFuncs(), funcsB = b->getFuncs();
if (funcsA.size() != funcsB.size()) return false;
// Check each member separately.
for (NodeVector::const_iterator ia = membersA.begin(), ib = membersB.begin(); ia != membersA.end() && ib != membersB.end(); ia++, ib++) {
const QualifiedTypeMember::Ptr& memberA = QualifiedTypeMember::needFrom(*ia), memberB = QualifiedTypeMember::needFrom(*ib);
if (memberA->getName() != memberB->getName())
return false;
if (!equal(memberA->getType(), memberB->getType()))
return false;
}
// TODO: do the same for interface stuff.
return true;
}
示例12: snapshotItem
Node* XPathResult::snapshotItem(unsigned long index, ExceptionCode& ec)
{
if (resultType() != UNORDERED_NODE_SNAPSHOT_TYPE && resultType() != ORDERED_NODE_SNAPSHOT_TYPE) {
ec = TYPE_ERR;
return 0;
}
NodeVector nodes = m_value.toNodeVector();
if (index >= nodes.size())
return 0;
return nodes[index].get();
}
示例13: singleNodeValue
Node* XPathResult::singleNodeValue(ExceptionCode& ec) const
{
if (resultType() != ANY_UNORDERED_NODE_TYPE && resultType() != FIRST_ORDERED_NODE_TYPE) {
ec = TYPE_ERR;
return 0;
}
NodeVector nodes = m_value.toNodeVector();
if (nodes.size () == 0)
return 0;
return nodes[0].get();
}
示例14: simplify
/**
* Simplifies the given TypeSet by removing duplicate types. If the resulting
* TypeSet contains only one type, that type is returned instead of the set.
*/
NodePtr simplify(const TypeSet::Ptr& input)
{
// Remove duplicate types.
NodeVector newTypes;
copyUnique(input->getTypes(), newTypes);
// Return either the new set or the only type left in the set, if there's one.
if (newTypes.size() == 1) {
return newTypes.front();
}
TypeSet::Ptr ts(new TypeSet);
ts->setTypes(newTypes);
return ts;
}
示例15: findAlgorithm
Algorithm* Network::findAlgorithm(const std::string& name) {
NodeVector nodes = depthFirstSearch(_visibleNetworkRoot);
for (NodeVector::iterator node = nodes.begin(); node != nodes.end(); ++node) {
if ((*node)->algorithm()->name() == name) return (*node)->algorithm();
}
ostringstream msg;
msg << "Could not find algorithm with name '" << name << "'. Known algorithms are: ";
if (!nodes.empty()) msg << '\'' << nodes[0]->algorithm()->name() << '\'';
for (int i=1; i<(int)nodes.size(); i++) {
msg << ", '" << nodes[i]->algorithm()->name() << '\'';
}
throw EssentiaException(msg);
}