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


C++ NodeVector::push_back方法代码示例

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


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

示例1: InsertTriFaceCentroidNode

int InsertTriFaceCentroidNode(
    int ix0,
    int ix1,
    int ix2,
    NodeVector & vecNodes
) {
    double dX = (vecNodes[ix0].x + vecNodes[ix1].x + vecNodes[ix2].x) / 3.0;
    double dY = (vecNodes[ix0].y + vecNodes[ix1].y + vecNodes[ix2].y) / 3.0;
    double dZ = (vecNodes[ix0].z + vecNodes[ix1].z + vecNodes[ix2].z) / 3.0;

    // Project to sphere
    double dRadius = sqrt(dX*dX + dY*dY + dZ*dZ);

    dX /= dRadius;
    dY /= dRadius;
    dZ /= dRadius;

    // Index
    int ix = vecNodes.size();

    // Insert node
    vecNodes.push_back(Node(dX, dY, dZ));

    return ix;
}
开发者ID:bssrdf,项目名称:tempestremap,代码行数:25,代码来源:GenerateICOMesh.cpp

示例2: getDeclsFromNode

NodeVector SprFrontend::getDeclsFromNode(Node* n, Node*& baseExp) {
    NodeVector res;
    baseExp = nullptr;

    if (!Nest_computeType(n))
        return {};
    n = Nest_explanation(n);
    ASSERT(n);

    // Check if the node is a DeclExp, pointing to the actual references
    if (n->nodeKind == nkSparrowExpDeclExp) {
        baseExp = at(n->referredNodes, 0);
        res = NodeVector(n->referredNodes.beginPtr + 1, n->referredNodes.endPtr);
        return res;
    }

    // Check if this is a ModuleRef; if so, get the it's referred content (inner most package)
    if (n->nodeKind == nkSparrowExpModuleRef) {
        if (Nest_hasProperty(n, propResultingDecl))
            res = {Nest_getCheckPropertyNode(n, propResultingDecl)};
        return res;
    }

    // If the node represents a type, try to get the declaration associated with the type
    Type t = tryGetTypeValue(n);
    if (t && t.hasStorage()) {
        res.push_back(t.referredNode());
    }

    return res;
}
开发者ID:Sparrow-lang,项目名称:sparrow,代码行数:31,代码来源:DeclsHelpers.cpp

示例3: intersect

/**
 * Returns the intersection between the TypeSet and the other node. The other
 * node may also be a type set, in which case this function is called
 * recursively to resolve the intersect.
 */
NodePtr intersect(const TypeSet::Ptr& typeSet, const NodePtr& other)
{
	// Intersect all types in the type set with the other type.
	NodeVector newTypes;
	const NodeVector& types = typeSet->getTypes();
	for (NodeVector::const_iterator it = types.begin(); it != types.end(); it++) {
		NodePtr type = intersect(*it, other);
		if (type->isKindOf(kInvalidType)) continue; // skip if the intersect was impossible
		bool exists = false;
		for (NodeVector::iterator is = newTypes.begin(); is != newTypes.end(); is++) {
			if (equal(type, *is)) {
				exists = true;
				break;
			}
		}
		if (!exists) newTypes.push_back(type);
	}

	// Return the new type set if it contains multiple types, a single type if
	// there's only one left after the intersect, or InvalidType if the
	// intersect yielded no types in the set.
	if (newTypes.empty()) {
		return NodePtr(new InvalidType);
	} else if (newTypes.size() == 1) {
		return newTypes.front();
	} else {
		TypeSet::Ptr ts(new TypeSet);
		ts->setTypes(newTypes);
		return ts;
	}
}
开发者ID:fabianschuiki,项目名称:Maxwell,代码行数:36,代码来源:type.cpp

示例4: wrapFuncArgs

void InitRootTypes::wrapFuncArgs(NodeVector& args, const NodeVector& funcArgs)
{
	for (NodeVector::const_iterator it = funcArgs.begin(); it != funcArgs.end(); it++) {
		const FuncArg::Ptr& funcArg = FuncArg::from(*it);
		TupleTypeArg::Ptr arg(new TupleTypeArg);
		arg->setName(funcArg->getName());
		arg->setType(funcArg->getPossibleType());
		args.push_back(arg);
	}
}
开发者ID:fabianschuiki,项目名称:Maxwell,代码行数:10,代码来源:InitRootTypes.cpp

示例5: get_arguments

NodeVector Node::get_arguments()
{
    NodeVector result;
    for (auto& i : get_inputs())
    {
        {
            result.push_back(i.get_output().get_node());
        }
    }
    return result;
}
开发者ID:okhat,项目名称:ngraph,代码行数:11,代码来源:node.cpp

示例6: getDeclsFromNode

NodeVector SprFrontend::getDeclsFromNode(Node* n, Node*& baseExp)
{
    NodeVector res;
    baseExp = nullptr;
    
    n->computeType();
    n = n->explanation();
    ASSERT(n);

    // The node may contain a DeclExp, pointing to the actual references
    Node*const* declExpPtr = n->getPropertyNode(propRefDecls);
    DeclExp* declExp = declExpPtr ? static_cast<DeclExp*>(*declExpPtr) : nullptr;

    if ( declExp )
    {
        baseExp = declExp->baseExp();
        res = declExp->decls();
        return res;
    }
    
    // If the node represents a type, try to get the declaration associated with the type
    Type* t = tryGetTypeValue(n);
    if ( t )
    {
        // If we have a Type as base, try a constructor/concept call
        if ( t->hasStorage() )
        {
            res.push_back(static_cast<StorageType*>(t)->classDecl());
        }
        else if ( t->typeId() == Type::typeConcept )
        {
            res.push_back((Node*) static_cast<ConceptType*>(t)->concept());
        }
        else
            t = nullptr;
    }
    
    return res;
}
开发者ID:stefan0x53,项目名称:sparrow,代码行数:39,代码来源:DeclsHelpers.cpp

示例7: intersect

// todo: presorted jumplists
NodeVector intersect(NodeVector a, NodeVector b) {
	NodeVector c;
	NodeVector::iterator it;
	for(it = a.begin(); it != a.end(); ++it)
		if (contains(b, *it))
//			c.insert(*it);
			c.push_back(*it);
//	for (int i=0; i < a.size(); i++) {
//		Node* n=a[0];
//		if (contains(b, n)) c.push_back(n);
//	}
    return c;
}
开发者ID:nagyistoce,项目名称:netbase,代码行数:14,代码来源:util.cpp

示例8: gatherImplAccessors

void GenImplicitAccessors::gatherImplAccessors(const NodePtr& node, NodeVector& into)
{
	// Gather getters and setters.
	if (node->isKindOf(kImplAccessor)) {
		into.push_back(node);
	}

	// Gather accessors of the children.
	const NodeVector& children = node->getChildren();
	for (NodeVector::const_iterator it = children.begin(); it != children.end(); it++) {
		gatherImplAccessors(*it, into);
	}
}
开发者ID:fabianschuiki,项目名称:Maxwell,代码行数:13,代码来源:GenImplicitAccessors.cpp

示例9: get_users

NodeVector Node::get_users() const
{
    NodeVector result;

    for (size_t i = 0; i < get_output_size(); ++i)
    {
        for (auto input : get_output_inputs(i))
        {
            result.push_back(input->get_node());
        }
    }

    return result;
}
开发者ID:okhat,项目名称:ngraph,代码行数:14,代码来源:node.cpp

示例10: copyUnique

/**
 * Copies the entries of the input vector of types to the output vector,
 * omitting duplicate types. Useful for TypeSet and UnionType simplification.
 */
void copyUnique(const NodeVector& input, NodeVector& output)
{
	for (NodeVector::const_iterator it = input.begin(); it != input.end(); it++) {
		bool exists = false;
		for (NodeVector::iterator is = output.begin(); is != output.end(); is++) {
			if (equal(*it, *is)) {
				exists = true;
				break;
			}
		}
		if (!exists) output.push_back(*it);
	}
	assert(output.size() <= input.size());
	assert(output.empty() == input.empty());
}
开发者ID:fabianschuiki,项目名称:Maxwell,代码行数:19,代码来源:type.cpp

示例11: report

void BronKerbosch::report(const BitSet& R)
{
  NodeVector clique;
  for (size_t i = 0; i < R.size(); ++i)
  {
    if (R[i])
    {
      if (g_verbosity >= VERBOSE_DEBUG)
      {
        std::cerr << " " << _g.id(_bitToNode[i]);
      }
      clique.push_back(_bitToNode[i]);
    }
  }
  _cliques.push_back(clique);
  if (g_verbosity >= VERBOSE_DEBUG)
    std::cerr << std::endl;
}
开发者ID:melkebir,项目名称:bronkerbosch,代码行数:18,代码来源:bronkerbosch.cpp

示例12: InsertSubNode

int InsertSubNode(
    int ix0,
    int ix1,
    double alpha,
    NodeVector & vecNodes
) {
    double dDeltaX = (vecNodes[ix1].x - vecNodes[ix0].x);
    double dDeltaY = (vecNodes[ix1].y - vecNodes[ix0].y);
    double dDeltaZ = (vecNodes[ix1].z - vecNodes[ix0].z);
    double dCartLength =
        sqrt(dDeltaX*dDeltaX + dDeltaY*dDeltaY + dDeltaZ*dDeltaZ);

    double dGamma = acos(0.5 * dCartLength);
    double dTheta = acos(1.0 - 0.5 * dCartLength * dCartLength);
    double dAlphaTheta = alpha * dTheta;
    double dBeta = M_PI - dGamma - dAlphaTheta;

    alpha = sin(dAlphaTheta) / sin(dBeta) / dCartLength;

    double dX = vecNodes[ix0].x + (vecNodes[ix1].x - vecNodes[ix0].x) * alpha;
    double dY = vecNodes[ix0].y + (vecNodes[ix1].y - vecNodes[ix0].y) * alpha;
    double dZ = vecNodes[ix0].z + (vecNodes[ix1].z - vecNodes[ix0].z) * alpha;

    // Project to sphere
    double dRadius = sqrt(dX*dX + dY*dY + dZ*dZ);

    dX /= dRadius;
    dY /= dRadius;
    dZ /= dRadius;

    // Index
    int ix = vecNodes.size();

    // Insert node
    vecNodes.push_back(Node(dX, dY, dZ));

    return ix;
}
开发者ID:bssrdf,项目名称:tempestremap,代码行数:38,代码来源:GenerateICOMesh.cpp

示例13: handle


//.........这里部分代码省略.........
	}
//	bool get_topic=false;
	bool get_topic=true;
	bool sort=false;
	if (startsWith(q, "ee/")||startsWith(q, "ee ")) {
		q[2]=' ';
		get_topic=true;
	}
	if (startsWith(q, "entities/")) {
		q[8]=' ';
		get_topic=true;
//		verbosity=longer;
	}
	if(hasWord(q)) loadView(q);
    
    if(contains(q,"exclude")||contains(q,"include")){
        verbosity=normal;
        showExcludes=true;
    }
	p(q);
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!
	//
    NodeVector all = parse(q); // <<<<<<<< HANDLE QUERY WITH NETBASE!
    //
    // !!!!!!!!!!!!!!!!!!!!!!!!!!!

	autoIds=false;
    int size=(int)all.size();
    if(showExcludes){
        for (int i = 0; i < size; i++) {
        // todo : own routine!!!
        Node* node = (Node*) all[i];
        if(!contains(all,getAbstract(node->name)))
            all.push_back(getAbstract(node->name));
        N parent= getType(node);
        if(parent){
            if(!contains(all,parent))all.push_back(parent);
            N abs= getAbstract(parent->name);
            if(parent&&!contains(all,abs))all.push_back(abs);
        }
        }
        show(excluded);
    }
    
    const char* html_block="<!DOCTYPE html><html><head><META HTTP-EQUIV='CONTENT-TYPE' CONTENT='text/html; charset=UTF-8'/></head>"\
							"<body><div id='netbase_results'></div>\n<script>var results=";
    //    if((int)all.size()==0)Writeline("0");
	//	Writeline(conn,q);
	char buff[10000];

	bool use_json= format == json || format == js || format == html;
	if (format == xml && (startsWith(q,"select")||contains(q," where "))){Writeline(conn,query2(q));return 0;}
	if (format == xml)Writeline(conn, "<results>\n");
	if (format == html)Writeline(conn,html_block);
	if (use_json)Writeline(conn, "{\"results\":[\n");
	const char* statement_format_xml = "   <statement id='%d' subject=\"%s\" predicate=\"%s\" object=\"%s\" sid='%d' pid='%d' oid='%d'/>\n";
	const char* statement_format_text = "   $%d %s %s %s %d->%d->%d\n";
	const char* statement_format_json = "      { \"id\":%d, \"subject\":\"%s\", \"predicate\":\"%s\", \"object\":\"%s\", \"sid\":%d, \"pid\":%d, \"oid\":%d}";
	const char* statement_format_csv = "%d\t%s\t%s\t%s\t%d\t%d\t%d\n";
	const char* statement_format = 0;
	if (format == xml)statement_format = statement_format_xml;
	if (format == html)statement_format = statement_format_json;
	if (format == json)statement_format = statement_format_json;
	if (format == txt)statement_format = statement_format_text;
	if (format == csv)statement_format = statement_format_csv;
    
开发者ID:pi19404,项目名称:netbase,代码行数:66,代码来源:webserver.cpp

示例14: ReadModel

void ImdReader::ReadModel(const char *pszFilename) {
    CPLDebug( "OGR_ILI", "Reading model '%s'", pszFilename);

    CPLXMLNode* psRootNode = CPLParseXMLFile(pszFilename);
    if( psRootNode == NULL )
        return;
    CPLXMLNode *psSectionNode = CPLGetXMLNode( psRootNode, "=TRANSFER.DATASECTION" );
    if( psSectionNode == NULL )
        return;

    StrNodeMap oTidLookup; /* for fast lookup of REF relations */
    ClassesMap oClasses;
    NodeCountMap oAxisCount;
    NodeVector oArcLineTypes;
    const char *modelName;

    /* Fill TID lookup map and IliClasses lookup map */
    CPLXMLNode* psModel = psSectionNode->psChild;
    while( psModel != NULL )
    {
        modelName = CPLGetXMLValue( psModel, "BID", NULL );
        //CPLDebug( "OGR_ILI", "Model: '%s'", modelName);

        CPLXMLNode* psEntry = psModel->psChild;
        while( psEntry != NULL )
                {
            if (psEntry->eType != CXT_Attribute) //ignore BID
            {
                //CPLDebug( "OGR_ILI", "Node tag: '%s'", psEntry->pszValue);
                const char* psTID = CPLGetXMLValue( psEntry, "TID", NULL );
                if( psTID != NULL )
                    oTidLookup[psTID] = psEntry;


                if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Model") && !EQUAL(modelName, "MODEL.INTERLIS"))
                {
                    IliModelInfo modelInfo;
                    modelInfo.name = CPLGetXMLValue( psEntry, "Name", "OGR" );
                    modelInfo.version = CPLGetXMLValue( psEntry, "Version", "" );
                    modelInfo.uri = CPLGetXMLValue( psEntry, "At", "" );
                    modelInfos.push_back(modelInfo);
                    mainModelName = modelInfo.name; //FIXME: check model inheritance
                    //version = CPLGetXMLValue(psEntry, "iliVersion", "0"); //1 or 2.3

                    CPLXMLNode *psFormatNode = CPLGetXMLNode( psEntry, "ili1Format" );
                    if (psFormatNode != NULL)
                    {
                        psFormatNode = psFormatNode->psChild;
                        codeBlank = atoi(CPLGetXMLValue(psFormatNode, "blankCode", "95"));
                        codeUndefined = atoi(CPLGetXMLValue(psFormatNode, "undefinedCode", "64"));
                        codeContinue = atoi(CPLGetXMLValue(psFormatNode, "continueCode", "92"));
                    }
                }
                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.SubModel"))
                {
                    mainBasketName = CPLGetXMLValue(psEntry, "TID", "OGR");
                    mainTopicName = CPLGetXMLValue(psEntry, "Name", "OGR");
                }
                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Class") )
                {
                    CPLDebug( "OGR_ILI", "Class name: '%s'", psTID);
                    oClasses[psEntry] = new IliClass(psEntry, iliVersion, oTidLookup, oClasses, oAxisCount);
                }
            }
            psEntry = psEntry->psNext;
        }

        // 2nd pass: add fields via TransferElement entries & role associations
        psEntry = psModel->psChild;
        while( psEntry != NULL )
        {
            if (psEntry->eType != CXT_Attribute) //ignore BID
            {
                //CPLDebug( "OGR_ILI", "Node tag: '%s'", psEntry->pszValue);
                if( iliVersion == 1 && EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Ili1TransferElement"))
                {
                    const char* psClassRef = CPLGetXMLValue( psEntry, "Ili1TransferClass.REF", NULL );
                    const char* psElementRef = CPLGetXMLValue( psEntry, "Ili1RefAttr.REF", NULL );
                    int iOrderPos = atoi(CPLGetXMLValue( psEntry, "Ili1RefAttr.ORDER_POS", "0" ))-1;
                    IliClass* psParentClass = oClasses[oTidLookup[psClassRef]];
                    CPLXMLNode* psElementNode = oTidLookup[psElementRef];
                    psParentClass->AddFieldNode(psElementNode, iOrderPos);
                }
                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.TransferElement"))
                {
                    const char* psClassRef = CPLGetXMLValue( psEntry, "TransferClass.REF", NULL );
                    const char* psElementRef = CPLGetXMLValue( psEntry, "TransferElement.REF", NULL );
                    int iOrderPos = atoi(CPLGetXMLValue( psEntry, "TransferElement.ORDER_POS", "0" ))-1;
                    IliClass* psParentClass = oClasses[oTidLookup[psClassRef]];
                    CPLXMLNode* psElementNode = oTidLookup[psElementRef];
                    psParentClass->AddFieldNode(psElementNode, iOrderPos);
                }
                else if( EQUAL(psEntry->pszValue, "IlisMeta07.ModelData.Role"))
                {
                    const char* psRefParent = CPLGetXMLValue( psEntry, "Association.REF", NULL );
                    int iOrderPos = atoi(CPLGetXMLValue( psEntry, "Association.ORDER_POS", "0" ))-1;
                    IliClass* psParentClass = oClasses[oTidLookup[psRefParent]];
                    if (psParentClass)
                        psParentClass->AddRoleNode(psEntry, iOrderPos);
                }
//.........这里部分代码省略.........
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:101,代码来源:imdreader.cpp


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