//number of nodes as would return vector.size() void SkeletonGraph::CreateGraphFromSkeleton(SkeletonMatchNode* root, int numOfNodes) { FreeNodes(); nodes.reserve(numOfNodes); for (int i = 0; i < numOfNodes; i++) { SkeletonGraphNode* node = new SkeletonGraphNode(i); nodes.push_back(node); } deque<SkeletonMatchNode*> queue; queue.push_back(root); int id = 0; while (!queue.empty()) { SkeletonMatchNode* sklNode = queue.front(); queue.pop_front(); nodes[id]->point = sklNode->point; nodes[id]->oldID = sklNode->oldID; //edges are not oriented and parent would handle parent edge so we add only child edges for (int i = 0; i < sklNode->nodes.size(); i++) { GraphEdge ge = GraphEdge(sklNode->betweenNodes[i], sklNode->dists[i]); ge.oldIDs = sklNode->oldIDs[i]; ge.positions = sklNode->positions[i]; ge.fromId = sklNode->id; ge.toId = sklNode->nodes[i]->id; CreateEdge(sklNode->id, sklNode->nodes[i]->id, ge); queue.push_back(sklNode->nodes[i]); } id++; } CollectBranchNodes(); }
void CTopClauses::Free() { if (m_FirstNode != NULL) { FreeNodes(m_FirstNode); m_FirstNode = NULL; } }
void ReleaseNames( void ) /******************************/ /* Free list of names. */ { IterateNodelist( NameNodes, ReleaseNamelist, NULL ); FreeNodes( NameNodes ); }
bool STG_StartParsing(const char* inname, const char* outname) { g_allocNodes.resize(128); g_inname = inname; bool done = false; while(!done) { NextToken(); if(STG_TOK_EOF == g_nextToken) done = true; if(STG_TOK_STRUCT == g_nextToken) { if(g_root) { printf("STG_StartParsing: multiple top-level structs in '%s', abort.\n", inname); return false; } if(!(g_root = ParseStruct())) return false; } } // add proxy name for root assert("" == g_root->name); g_root->name = "state"; STG_ComputeChildIndices(g_root); STG_WriteStateDesc(g_root, outname); FreeNodes(); return true; }
void TRI_FreeContextAql (TRI_aql_context_t* const context) { TRI_ASSERT(context != NULL); LOG_TRACE("freeing context"); // release all scopes TRI_FreeScopesAql(context); FreeStrings(context); FreeNodes(context); // free parameter names hash TRI_DestroyAssociativePointer(&context->_parameters._names); // free collection names TRI_DestroyAssociativePointer(&context->_collectionNames); FreeCollections(context); // free parameter values TRI_FreeBindParametersAql(context); TRI_DestroyAssociativePointer(&context->_parameters._values); // free parser/lexer TRI_FreeParserAql(context->_parser); // free statement list TRI_FreeStatementListAql(context->_statements); // free error struct TRI_DestroyErrorAql(&context->_error); TRI_Free(TRI_UNKNOWN_MEM_ZONE, context); }
/*----------*/ void FreeTree(TTree *tree) { if (tree) { DisposeTreeNodes(tree); free(tree); } FreeNodes(); } /* FreeTree */
void CTopClauses::FreeNodes(CClauseNode* node) { for (size_t i = 0; i < node->m_outNodes.size(); i++) { if (!node->m_outNodes[i].m_bNodeDeleted) FreeNodes(node->m_outNodes[i].m_pNode); } for (size_t i = 0; i < node->m_inNodes.size(); i++) { for (size_t j = 0; j < node->m_inNodes[i].m_pNode->m_outNodes.size(); j++) { if (node->m_inNodes[i].m_pNode->m_outNodes[j].m_pNode == node) node->m_inNodes[i].m_pNode->m_outNodes[j].m_bNodeDeleted = true; } } node->Free(); delete node; }
// // 释放场景管理器 // VOID CSceneManager::Free(VOID) { // // 1. 释放数据流 // m_stream.Free(); // // 2. 清空根节点 // m_pRootNode->DetachAllNode(); m_pRootNode->DetachAllEntity(); // // 3. 释放节点集合 // FreeNodes(); // // 4. 释放实体集合 // FreeEntities(m_meshs); FreeEntities(m_skins); FreeEntities(m_effects); FreeEntities(m_halos); FreeEntities(m_lights); // // 5. 释放其他模块 // m_pLightGrid->Free(); m_pOctreeCulling->Free(); m_pOcclusionCulling->Free(); m_physics.DestroyScene(); // // 6. 初始化 // Init(); }
/** * @brief * Destructor */ VisContainer::~VisContainer() { // Free all nodes FreeNodes(); // Destroy the query SceneQuery *pSceneQuery = m_pQueryHandler->GetElement(); if (pSceneQuery) pSceneQuery->GetSceneContainer().DestroyQuery(*pSceneQuery); delete m_pQueryHandler; { // Destroy all containers Iterator<VisContainer*> cIterator = m_mapContainers.GetIterator(); while (cIterator.HasNext()) delete cIterator.Next(); } { // Destroy all portals Iterator<VisPortal*> cIterator = m_mapPortals.GetIterator(); while (cIterator.HasNext()) delete cIterator.Next(); } }
void freeCurrentThreadLocalData() { CallTempStructNode* pNode = (CallTempStructNode*)GET_THREAD_LOCAL_DATA(); FreeNodes(pNode); SET_THREAD_LOCAL_DATA(NULL); }
void destroyThreadLocal(void* data) { FreeNodes((CallTempStructNode*)data); }
SkeletonGraph::~SkeletonGraph(void) { FreeNodes(); }
void FreeList(LINKEDLIST *list) { FreeNodes (list, 1); return; }
void FreeList(LIST *list) { FreeNodes(list, 0); return; }