Plugins/PointSprite/ParaViewPlugin/Qvis/DataNode.cpp
DataNode *
DataNode::GetNode(const vtkstd::string &key, DataNode *parentNode)
{
    DataNode *searchNode, *intermediate, *retval = 0;

    // Determine which node's children to search.        
    if(parentNode == 0)
        searchNode = this;
    else
        searchNode = parentNode;

    if(key == searchNode->Key)
        retval = searchNode;
    else if(searchNode->NodeType == INTERNAL_NODE)
    {
        if(searchNode->Length == 1)
        {
            DataNode *nodeArray = (DataNode *)(searchNode->Data);
            intermediate = GetNode(key, nodeArray);
            if(intermediate != 0)
            {
                retval = intermediate;
            }
        }
        else if(searchNode->Length > 1)
        {
            DataNode **nodeArray = (DataNode **)(searchNode->Data);

            for(int i = 0; i < searchNode->Length; ++i)
            {
                intermediate = GetNode(key, nodeArray[i]);
                if(intermediate != 0)
                {
                    retval = intermediate;
                       break;
                }
            }
        }
    }

    return retval;
}
// ****************************************************************************
// Method: DataNode::GetNode
//
// Purpose: 
//   Returns a pointer to the node having the specified key. If a
//   parentNode is supplied, then only the children of that node are
//   searched.
//
// Arguments:
//   key : The name of the node to look for.
//   parentNode : The root of the tree to search.
//
// Returns:    
//   A pointer to the node having the specified key, or 0 if the node
//   is not found.
//
// Programmer: Brad Whitlock
// Creation:   Thu Sep 28 12:07:56 PDT 2000
//
// Modifications:
//   
// ****************************************************************************
:GetNode
Purpose:
Returns a pointer to the node having the specified key. If a
parentNode is supplied, then only the children of that node are
searched.

key : The name of the node to look for.
parentNode : The root of the tree to search.

A pointer to the node having the specified key, or 0 if the node
is not found.

Brad Whitlock
Creation:   Thu Sep 28 12:07:56 PDT 2000


: GetNode Purpose : Returns a pointer to the node having the specified key . If a parentNode is supplied then only the children of that node are searched . key : The name of the node to look for . parentNode : The root of the tree to search . A pointer to the node having the specified key or 0 if the node is not found . Brad Whitlock Creation : Thu Sep 28 12 : 07 : 56 PDT 2000
DataNode *
DataNode::GetNode(const vtkstd::string &key, DataNode *parentNode)
{
    DataNode *searchNode, *intermediate, *retval = 0;
    if(parentNode == 0)
        searchNode = this;
    else
        searchNode = parentNode;
    if(key == searchNode->Key)
        retval = searchNode;
    else if(searchNode->NodeType == INTERNAL_NODE)
    {
        if(searchNode->Length == 1)
        {
            DataNode *nodeArray = (DataNode *)(searchNode->Data);
            intermediate = GetNode(key, nodeArray);
            if(intermediate != 0)
            {
                retval = intermediate;
            }
        }
        else if(searchNode->Length > 1)
        {
            DataNode **nodeArray = (DataNode **)(searchNode->Data);
            for(int i = 0; i < searchNode->Length; ++i)
            {
                intermediate = GetNode(key, nodeArray[i]);
                if(intermediate != 0)
                {
                    retval = intermediate;
                       break;
                }
            }
        }
    }
    return retval;
}
DataNode * DataNode :: GetNode ( const vtkstd :: string & key , DataNode * parentNode ) { DataNode * searchNode , * intermediate , * retval = 0 ; if ( parentNode == 0 ) searchNode = this ; else searchNode = parentNode ; if ( key == searchNode -> Key ) retval = searchNode ; else if ( searchNode -> NodeType == INTERNAL_NODE ) { if ( searchNode -> Length == 1 ) { DataNode * nodeArray = ( DataNode * ) ( searchNode -> Data ) ; intermediate = GetNode ( key , nodeArray ) ; if ( intermediate != 0 ) { retval = intermediate ; } } else if ( searchNode -> Length > 1 ) { DataNode * * nodeArray = ( DataNode * * ) ( searchNode -> Data ) ; for ( int i = 0 ; i < searchNode -> Length ; ++ i ) { intermediate = GetNode ( key , nodeArray [ i ] ) ; if ( intermediate != 0 ) { retval = intermediate ; break ; } } } } return retval ; }
Method: DataNode::GetNode
Purpose:
Returns a pointer to the node having the specified key.
Method : DataNode :: GetNode Purpose : Returns a pointer to the node having the specified key .
// Determine which node's children to search.        