Exemplo n.º 1
0
void releaseBase(OppBase *base)
{
	if (NULL != base) {
		releaseNode(base->nonDealerRoot);
		releaseNode(base->dealerRoot);
	}
}
Exemplo n.º 2
0
void releaseNode(struct Node *node)
{
	if (NULL == node) return;
	
	releaseNode(node->leftChild);
	releaseNode(node->midChild);
	releaseNode(node->rightChild);
	releaseNode(node);
}
Exemplo n.º 3
0
/**
 * Releases the old node and then references the next node.
 *
 * Note: Make sure to call this until it returns NULL (so the last node is released properly) or
 * remember to release the node yourself if you don't iterate to the end.
 *
 * @return NULL if oldNode was the last node
 */
Node* NodeStoreServers::referenceNextNodeAndReleaseOld(Node* oldNode)
{
   uint16_t oldNodeID = oldNode->getNumID();

   releaseNode(&oldNode);

   return referenceNextNode(oldNodeID);
}
Exemplo n.º 4
0
void releaseNode(struct Node *node)
{
	if (NULL == node) return;

	int i;
	for(i=0; i<3; i++) 
		releaseNode(node->child[i]);
	free(node);
}
Exemplo n.º 5
0
/* =============================================================================
 * freeNode
 * =============================================================================
 */
static void
freeNode (node_t* n)
{
    if (n) {
        freeNode(n->l);
        freeNode(n->r);
        releaseNode(n);
    }
}
Exemplo n.º 6
0
ifun(void, releaseNode, TrieNode* node)
{
    if (node) {
        for (int i=0; i<MCTrieWidth; i++)
            if (node->childs[i])
                releaseNode(0, node->childs[i]);
        free(node);
    }
}
Exemplo n.º 7
0
void QuadTree::release()
{
	if (mRoot)
	{
		releaseNode(mRoot);
		delete mRoot;
		mRoot = NULL;
	}
}
Exemplo n.º 8
0
void GPUOctree::releaseNode(GPUTreeNode *node)
{
	if(!node) return;
	
	for(int i=0; i < 8; i++) releaseNode( node->child[i] );
			
	delete[] node->child;
	delete node;
}
Exemplo n.º 9
0
/* =============================================================================
 * rbtree_insert
 * -- Returns TRUE on success
 * =============================================================================
 */
bool_t
rbtree_insert (rbtree_t* r, void* key, void* val)
{
    node_t* node = getNode();
    node_t* ex = INSERT(r, key, val, node);
    if (ex != NULL) {
        releaseNode(node);
    }
    return ((ex == NULL) ? TRUE : FALSE);
}
Exemplo n.º 10
0
	//shutdown-- cleans up memory for the terrain quad tree
	void TerrainQuadTree::shutdown()
	{
		//recusivly release the quad tree data
		if (m_parentNode)
		{
			releaseNode(m_parentNode);
			delete m_parentNode;
			m_parentNode = NULL;
		}
	}
Exemplo n.º 11
0
/* =============================================================================
 * rbtree_update
 * -- Return FALSE if had to insert node first
 * =============================================================================
 */
bool_t
rbtree_update (rbtree_t* r, void* key, void* val)
{
    node_t* nn = getNode();
    node_t* ex = INSERT(r, key, val, nn);
    if (ex != NULL) {
        STF(ex, v, val);
        releaseNode(nn);
        return TRUE;
    }
    return FALSE;
}
Exemplo n.º 12
0
bool NodeStoreServers::updateLastHeartbeatT(uint16_t id)
{
   Node* node = referenceNode(id);
   if(!node)
      return false;

   node->updateLastHeartbeatT();

   releaseNode(&node);

   return true;
}
Exemplo n.º 13
0
/* =============================================================================
 * rbtree_delete
 * -- Returns TRUE if key exists
 * =============================================================================
 */
bool_t
rbtree_delete (rbtree_t* r, void* key)
{
    node_t* node = NULL;
    node = LOOKUP(r, key);
    if (node != NULL) {
        node = DELETE(r, node);
    }
    if (node != NULL) {
        releaseNode(node);
    }
    return ((node != NULL) ? TRUE : FALSE);
}
Exemplo n.º 14
0
	//releaseNode-- releases the passed in node
	//node- the node to be released
	void TerrainQuadTree::releaseNode(Node* node)
	{
		int i;


		// Recursively go down the tree and release the bottom nodes first.
		for (i = 0; i<4; i++)
		{
			if (node->nodes[i] != 0)
			{
				releaseNode(node->nodes[i]);
			}
		}

		// Release the vertex buffer for this node.
		if (node->vertexBuffer)
		{
			node->vertexBuffer->Release();
			node->vertexBuffer = 0;
		}

		// Release the index buffer for this node.
		if (node->indexBuffer)
		{
			node->indexBuffer->Release();
			node->indexBuffer = 0;
		}

		//Release the vertex array for this node
		if (node->vertexArray)
		{
			delete[] node->vertexArray;
			node->vertexArray = NULL;
		}

		// Release the four child nodes.
		for (i = 0; i<4; i++)
		{
			if (node->nodes[i])
			{
				delete node->nodes[i];
				node->nodes[i] = 0;
			}
		}



		return;

	}
Exemplo n.º 15
0
void QuadTree::releaseNode(TreeNode* node)
{
	if (node->hasChild)
	{
		for (int i = 0; i < 4; ++i)
		{
			releaseNode(node->nodes[i]);
		}
	}
	else
	{
		// Release node mesh
		if (node->mmesh)
		{
			node->mmesh->Release();
			node->mmesh = NULL;
		}

		// Delete node
		delete node;
		node = NULL;
	}
}
Exemplo n.º 16
0
NBBST<T, Threads>::~NBBST(){
    //Remove the three nodes created in the constructor
    releaseNode(root->left);
    releaseNode(root->right);
    releaseNode(root);
}
Exemplo n.º 17
0
fun(MCTrie, void, bye, voida)
{
    releaseNode(obj, obj->root);
    superbye(MCObject);
}
Exemplo n.º 18
0
void GPUOctree::release()
{
	if(m_root) releaseNode(m_root);
	if(m_dt) delete[] m_dt;
	if(m_idr) delete[] m_idr;
}