00001 /** @file 00002 00003 Private RecTree and RecTreeNode declarations 00004 00005 @section license License 00006 00007 Licensed to the Apache Software Foundation (ASF) under one 00008 or more contributor license agreements. See the NOTICE file 00009 distributed with this work for additional information 00010 regarding copyright ownership. The ASF licenses this file 00011 to you under the Apache License, Version 2.0 (the 00012 "License"); you may not use this file except in compliance 00013 with the License. You may obtain a copy of the License at 00014 00015 http://www.apache.org/licenses/LICENSE-2.0 00016 00017 Unless required by applicable law or agreed to in writing, software 00018 distributed under the License is distributed on an "AS IS" BASIS, 00019 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00020 See the License for the specific language governing permissions and 00021 limitations under the License. 00022 */ 00023 00024 #ifndef _P_REC_TREE_H_ 00025 #define _P_REC_TREE_H_ 00026 00027 #include "P_RecDefs.h" 00028 #include "P_RecUtils.h" 00029 #include "List.h" 00030 00031 class RecTree; 00032 00033 /************************************************************************* 00034 * 00035 * RecTreeNode 00036 * 00037 *************************************************************************/ 00038 class RecTreeNode 00039 { 00040 public: 00041 RecTreeNode(const char *name = NULL); 00042 ~RecTreeNode(); 00043 00044 RecRecord *record_ptr; 00045 RecTree *subtree_ptr; 00046 char *node_name; 00047 const char *var_name_ptr; 00048 int num_leaf; 00049 LINK(RecTreeNode, link); 00050 00051 void print(); 00052 }; 00053 00054 00055 /************************************************************************* 00056 * 00057 * RecTree 00058 * 00059 *************************************************************************/ 00060 class RecTree 00061 { 00062 public: 00063 RecTree(RecTreeNode *); 00064 ~RecTree(); 00065 00066 inline RecTreeNode *first() 00067 { 00068 return m_root.head; 00069 }; 00070 00071 inline RecTreeNode *last() 00072 { 00073 return m_root.tail; 00074 }; 00075 00076 inline RecTreeNode *next(RecTreeNode * current) 00077 { 00078 return (current->link).next; 00079 }; 00080 00081 void rec_tree_insert(const char *, const char *full_name = NULL); 00082 RecTree *rec_tree_get(char *); 00083 void rec_tree_get_list(char *, char ***, int *); 00084 00085 void print(); 00086 RecTreeNode *this_node; 00087 00088 private: 00089 void p_rec_tree_get_list(char *, char ***, int *); 00090 Queue<RecTreeNode> m_root; 00091 }; 00092 00093 #endif