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


C++ CreateNode函数代码示例

本文整理汇总了C++中CreateNode函数的典型用法代码示例。如果您正苦于以下问题:C++ CreateNode函数的具体用法?C++ CreateNode怎么用?C++ CreateNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: CreateNode

// we do not register the parent node; we  register only the children
CTrieNodeBuild* CMorphAutomatBuilder::AddSuffix(CTrieNodeBuild* pParentNodeNo, const char* WordForm)
{
	// save current char
	BYTE RelationChar = (BYTE)*WordForm;
	WordForm++;

	//  adding new node child
	CTrieNodeBuild* pChildNode = CreateNode();
	 
	//  adding the rest of the suffix 
	if (*WordForm)
		AddSuffix(pChildNode, WordForm); 

	// making it final
	if (*WordForm == 0)
		pChildNode->SetFinal( true ) ;

	//  replace or register (the children should be already registered)
	pChildNode = ReplaceOrRegister(pChildNode);
		

	//  adding this child to the parent
	{
		assert (!pParentNodeNo->m_bRegistered);
		pParentNodeNo->AddChild(pChildNode, m_Alphabet2Code[RelationChar]);
	}
	return 	pChildNode;
};
开发者ID:dkrotx,项目名称:gogo_lemmatizer,代码行数:29,代码来源:MorphAutomBuilder.cpp

示例2: CreateVoidList

Node *create_scene_city_bmap() {

	// casita3/house01
	// casa5/wachhaus
	// dom/dom

	Node * aux;
	list *gObj_list;
	Node *myNode;
	static trfm3D TT;

	gObj_list = CreateVoidList();

	AddLast(gObj_list, SceneRegisterGObject( "./obj/casita3/", "house01.obj"));
	AddLast(gObj_list, SceneRegisterGObject( "./obj/casa5/", "wachhaus.obj"));
	AddLast(gObj_list, SceneRegisterGObject( "./obj/dom/", "dom.obj"));

	aux = create_city(500, gObj_list);

	SetTransTrfm3D(&TT, 0, -5, 00);
	//SetTransTrfm3D(&TT, 0, 0, 0);
	myNode = CreateNode("root");
	SetTrfmNode(myNode, &TT);
	//SetShaderNode(myNode, SceneFindShader("pervertex"));
	SetShaderNode(myNode, SceneFindShader("perfragment"));
	AttachNodeScene(myNode);
	AttachNode(myNode, aux);

	aux = create_floor_city( "./obj/floor/", "cityfloor_grass.obj");
	SetShaderNode(aux, SceneFindShader("bump"));
	AttachNode(myNode, aux); // takes ownership
	return aux;
}
开发者ID:xetxeberria,项目名称:VEV2,代码行数:33,代码来源:scenes.c

示例3: _defaultTypeName

/* static */
bool
PxrUsdMayaTranslatorUtil::CreateTransformNode(
        const UsdPrim& usdPrim,
        MObject& parentNode,
        const PxrUsdMayaPrimReaderArgs& args,
        PxrUsdMayaPrimReaderContext* context,
        MStatus* status,
        MObject* mayaNodeObj)
{
    static const MString _defaultTypeName("transform");

    if (not usdPrim or not usdPrim.IsA<UsdGeomXformable>()) {
        return false;
    }

    if (not CreateNode(usdPrim,
                       _defaultTypeName,
                       parentNode,
                       context,
                       status,
                       mayaNodeObj)) {
        return false;
    }

    // Read xformable attributes from the UsdPrim on to the transform node.
    UsdGeomXformable xformable(usdPrim);
    PxrUsdMayaTranslatorXformable::Read(xformable, *mayaNodeObj, args, context);

    return true;
}
开发者ID:400dama,项目名称:USD,代码行数:31,代码来源:translatorUtil.cpp

示例4: ClearBuildNodes

void CMorphAutomatBuilder::InitTrie()
{
	ClearBuildNodes();
	m_pRoot = CreateNode();
	ClearRegister();
	
};
开发者ID:dkrotx,项目名称:gogo_lemmatizer,代码行数:7,代码来源:MorphAutomBuilder.cpp

示例5: ReadString

void SkinnedMeshNode::SerializeIn( std::ifstream& stream )
{
	// 이미 앞에서 타입은 읽었다.
	unsigned short ver = 0;
	unsigned char count =0 ;

	//scene
	stream.read((char*)&ver,sizeof(ver));
	ReadString(stream,m_strNodeName);
	ReadString(stream,m_strParentName);
	ReadMatrix(stream,m_nodeTM);	
	stream.read((char*)&m_materialRefIndex,sizeof(m_materialRefIndex));
	stream.read((char*)&m_materialSubIndex,sizeof(m_materialSubIndex));
	stream.read((char*)&m_primitiveCount,sizeof(m_primitiveCount));
	stream.read((char*)&m_startIndex,sizeof(m_startIndex));
	ReadBool(stream,m_bInstancingEnable);
	// mesh
	SerializeInMesh(stream);

	// child	
	stream.read((char*)&count,sizeof(count));
	for ( int i=0 ; i<count ; i++ )
	{
		SCENETYPE type;
		stream.read((char*)&type,sizeof(type));
		cSceneNode* pNode = CreateNode(type);
		pNode->SetRootNode(m_pRootNode);
		pNode->SetParentNode(this);
		pNode->SetParentName(m_strNodeName.c_str());
		AttachChildNode(pNode);
		pNode->SerializeIn(stream);		
	}
}
开发者ID:ldw9981,项目名称:Rendering,代码行数:33,代码来源:SkinnedMeshNode.cpp

示例6: main

int main()
{
    struct timespec start, end;
    double cpu_time;
    LinkNode *head = CreateNode();
    assert((head->next != NULL && head->next->next !=NULL) && "no cycle");
    clock_gettime(CLOCK_REALTIME, &start);
    LinkNode *res = detectCycle(head);
    clock_gettime(CLOCK_REALTIME, &end);
    cpu_time = diff_in_second(start, end);
    //use print to check the list 
    /*printf("%d->%d->%d->%d->%d->%d->%d\n",head->data,
				    head->next->data,
				    head->next->next->data,
				    head->next->next->next->data,
				    head->next->next->next->next->data,
				    head->next->next->next->next->next->data,
				    head->next->next->next->next->next->next->data);*/
    if (res != NULL)
	//printf("result: n%d\n",res->data);
	printf("execution time: %.10lf sec\n", cpu_time);
    else
	printf("NULL\n");
    return 0;
}
开发者ID:vodkaice,项目名称:quiz,代码行数:25,代码来源:iterative.c

示例7: CL_BTreeNodeSpace

CL_HeapBTreeNodeSpace::CL_HeapBTreeNodeSpace (short order, const
                                              CL_GenericBTree& tree,
                                              CL_AbstractComparator& cmp)
: CL_BTreeNodeSpace (order, tree, cmp)
{
    _root = CreateNode();
}
开发者ID:ABratovic,项目名称:open-watcom-v2,代码行数:7,代码来源:gbtree.cpp

示例8: MakeStaticRamp

static void MakeStaticRamp(SceneManager* const sceneMgr, OgreNewtonWorld* const world, const Vector3& location, int rampMaterialID)
{
    Vector3 blockBoxSize (20.0f, 0.25f, 40.0f);
    dNewtonCollisionBox shape (world, blockBoxSize.x, blockBoxSize.y, blockBoxSize.z, m_all);

    // create a texture for using with this material
    Ogre::TexturePtr texture = Ogre::TextureManager::getSingleton().load("sand1b.jpg", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);

    // make a material to use with this mesh
    MaterialPtr renderMaterial = MaterialManager::getSingleton().create("ramp", ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
    renderMaterial->getTechnique(0)->getPass(0)->setLightingEnabled(true);
    renderMaterial->getTechnique(0)->getPass(0)->createTextureUnitState("sand1b.jpg");
    renderMaterial->setAmbient(0.2f, 0.2f, 0.2f);

    OgreNewtonMesh boxMesh (&shape);
    boxMesh.Triangulate();
    int materialId = boxMesh.AddMaterial(renderMaterial);
    boxMesh.ApplyBoxMapping (materialId, materialId, materialId);

    // create a manual object for rendering
    ManualObject* const object = boxMesh.CreateEntity(MakeName ("ramp"));
    MeshPtr mesh (object->convertToMesh (MakeName ("ramp")));

    //Matrix4 matrix (Matrix4::IDENTITY);
    Matrix4 matrix (Quaternion (Degree(-30.0f), Vector3 (0.0f, 0.0f, 1.0f)));
    matrix.setTrans (Vector3 (location.x, location.y, location.z));

    Entity* const ent = sceneMgr->createEntity(MakeName ("ramp"), mesh);
    SceneNode* const node = CreateNode (sceneMgr, ent, matrix.getTrans(), matrix.extractQuaternion());

    shape.SetMaterialId (rampMaterialID);
    new OgreNewtonDynamicBody (world, 0.0f, &shape, node, matrix);

    delete object;
}
开发者ID:Stuggy,项目名称:ogrenewton,代码行数:35,代码来源:MaterialScene.cpp

示例9: InsertNode

void InsertNode(char *ptr, TNode *root)
{

	int len = strlen(ptr);
	bool insert = false;
	TNode *temp;
	for(int i = 0; i <len; i++)
	{
		insert = DoNeedNewEntry(ptr[i], root);
		if(insert)
		{
			temp = CreateNode();
			temp->data = ptr[i];
			if(i+1 == len)
				temp->terminate = true;

			root->ptr[ptr[i] - 'a'] = temp;
			root = temp;
		}
		else
		{
			root = root->ptr[ptr[i] - 'a'];
		}
	}

}
开发者ID:rajnish-iitg,项目名称:C_Plus_Plus,代码行数:26,代码来源:UDictionary.cpp

示例10: TreeNode

 //前两参数是关联的,后三参数是关联的!
 TreeNode *CreateNode(vector<int>& preorder, int root_index, vector<int>& inorder, int low, int high)
 {
     TreeNode* p_node = new TreeNode(preorder[root_index]);
     int index = FindRootIndexFromInorder(inorder, low, high, preorder[root_index]);
     int left_len = index - low;
     int right_len = high - index;
     if(left_len > 0)
     {
         p_node->left = CreateNode(preorder, root_index+1, inorder, low, index-1);
     }
     if(right_len > 0)
     {
         p_node->right = CreateNode(preorder, root_index+1+left_len, inorder, index+1, high);
     }
     return p_node;
 }
开发者ID:try-your-best,项目名称:leetcode,代码行数:17,代码来源:construct_binary_tree_from_preorder_and_inorder.cpp

示例11: WriteString

    BOOL WriteString(
        LPCWSTR pszSection,
        LPCWSTR pszKey,
        LPCWSTR pszValue)
    {
        Node* pSection = GetNode(&m_pRoot, pszSection, (pszKey != NULL) ? CREATE_NODE : DELETE_NODE);
        if (pszKey == NULL)
            return TRUE;
        if (pSection == NULL)
            return FALSE;

        Node* pKey = GetNode(&pSection->pChild, pszKey, (pszValue != NULL) ? CREATE_NODE : DELETE_NODE);
        if (pszValue == NULL)
            return TRUE;
        if (pKey == NULL)
            return FALSE;

        Node* pValue = pKey->pChild;
        DWORD dwSize = sizeof(WCHAR) * wcslen(pszValue);
        if (pValue)
        {
            if (Equal(pValue, (LPCVOID)pszValue, dwSize))
                return TRUE;
            DestroyNode(pValue);
        }

        pKey->pChild = CreateNode((LPCVOID)pszValue, dwSize);
        if (pKey->pChild == NULL)
            return FALSE;

        return TRUE;
    }
开发者ID:Sathyaish,项目名称:Practice,代码行数:32,代码来源:inifile.cpp

示例12: BuildRandomTree

void BuildRandomTree(struct TreeNode *root,int nodeNum)
{
    srand(time(0));
    char branch[][2]= {"L","R"};
    char store[nodeNum][nodeNum];
    int mark[nodeNum][2];
    int Num[nodeNum];
    memset(store,0,sizeof(store));
    memset(mark,0,sizeof(mark));
    memset(Num,0,sizeof(Num));
    Num[0] = 1;
    int curNum = 1;
    for(curNum; curNum < nodeNum ; curNum++) {
        int num;
        do {
            num=rand()%nodeNum;
        } while(Num[num]);
        Num[num]=1;
        int LR=rand()%2;
        int randNode;
        do {
            randNode=rand()%curNum;
        } while(mark[randNode][LR]);
        mark[randNode][LR]=1;
        char newNode[nodeNum];
        memset(newNode,0,sizeof(newNode));
        strcpy(newNode,store[randNode]);
        strcat(newNode,branch[LR]);
        CreateNode(root,newNode,num);
        strcpy(store[curNum],newNode);
    }
}
开发者ID:pandaning,项目名称:quiz,代码行数:32,代码来源:recursive.c

示例13: InsertAtN

/* Function: Insert a new node with given data
 * Input:
 *    head: pointer to the start of linked list
 *    value: value to be stored in data field of new node
 *    N: position of node AFTER which new node should be inserted
 *       If N=0, then new node should be inserted in front (Special case)
 * Error: If invalid N, output error:
 *    ERROR: Node <N> does not exist 
 */
struct node* InsertAtN(struct node* head, int value, int N) {
    int i;
    struct node *tmp_node = head;
    struct node *cur_node = CreateNode();
    if(NULL == cur_node)
        return NULL;
    cur_node->next = NULL;
    cur_node->data = value;

    if(N == 0)
    {
        cur_node->next = head;
        head = cur_node;
    }

    for(i = 0; tmp_node != NULL && tmp_node->next != NULL && i < N-1; i++)
    {
        tmp_node = tmp_node->next;
    }

    if(i == N-1)
    {
        cur_node->next = tmp_node->next;
        tmp_node->next = cur_node;
    }
    else
    {
        printf("Node (N) doesn't exist");
        return NULL;
    }
	return head;
}
开发者ID:MO2013,项目名称:practice,代码行数:41,代码来源:node.c

示例14: DeleteAllChild

void CParentNode::Load( QDataStream& ar, SelectNode& sn, std::vector<SelectNode>& bracketSn, int isLeftBrLoad )
{
	DeleteAllChild();

	// load
	CNode::Load( ar, sn, bracketSn, isLeftBrLoad );

	CNode *pNode, *pPrev = NULL;

	ar >> m_nNumLine;
	ar >> m_nNumColumn;

	qint32 count;
	ar >> count;
	for( qint32 i = 0; i < count; i++ )
	{
		qint32 type;
		ar >> type;

		qint32 is_ext_node = 0;
		ar >> is_ext_node;

		pNode = CreateNode( type, is_ext_node );
		pNode->Load( ar, sn, bracketSn, isLeftBrLoad );

		pNode->SetParent( this );
		pNode->SetPrev( pPrev );
		if( pPrev )
			pPrev->SetNext( pNode );
		pPrev = pNode;
		m_children.push_back( pNode );
	}
}
开发者ID:Nilis640,项目名称:formulator-mathml,代码行数:33,代码来源:ni_parent.cpp

示例15: Log

btData * MiniNovaParser::Parse(string s) {
	if(s.find("request failed") == 0) {
		Log("FAILED TO CONNECT: ");
		return bd;
	}
	
	int count = 0;
	int pos = 0;
	int len = (int)s.length();
	pos = (int)s.find(" torrents", pos);
	if(pos < 0) {
		Log("Parse Error");
		//TRACE("Parser Error:\n");
		return bd;
	}
	len = (int)s.find("div id=\"footer\"", pos);
	TRACE("start: %d, len: %d\n", pos, len);
	while(pos < len && pos > 0) 
	{
		btData * newNode = CreateNode(s, &pos);
		if(bd == NULL) bd = newNode;
		else bd->AddNode(newNode);
		//TRACE("node:%s\n", newNode->ToString().c_str());
		count++;
	}

	char temp[16];
	itoa(count, temp, 10);
	char message[32];
	strcpy(message, "total count: ");
	strcat(message, temp);
	Log(message);

	return bd;
}
开发者ID:vdrive,项目名称:TrapperKeeper,代码行数:35,代码来源:MiniNovaParser.cpp


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