Polaris: BaseMapNode.h Source File

BaseMapNode.h

Go to the documentation of this file.
00001 ///
00002 ///
00003 /// \class BMNode 
00004 /// \brief The internal structure of Collection Map nodes
00005 /// \defgroup Polaris
00006 /// \ingroup Polaris
00007 ///  C++ VDL
00008 /// \see BMNode.h
00009 /// \see BaseMapNode.h
00010 ///
00011 /// \endcode
00012 /// \section Overview Overview
00013 /// The BMNode class defines the internal nodes of the Red/Black
00014 /// trees which are used to build all Maps and Databases in the
00015 /// Collection hiearchy.
00016 ///
00017 /// \endcode
00018 /// \section See See Also
00019 /// BaseMapRoot, Collection
00020 ///
00021 #ifndef _BASE_MAP_NODE_H
00022 #define _BASE_MAP_NODE_H
00023 ///
00024 #ifdef POLARIS_GNU_PRAGMAS
00025 #pragma interface
00026 #endif
00027 ///
00028 #include "../Listable.h"
00029 #include "Wrapper.h"
00030 ///
00031 union BMKey {           /// key union
00032     long    _keyval;    /// value of key
00033     void   *_keyptr;    /// pointer to key
00034 };
00035 ///
00036 enum BM_NODE_COLOR {   /// color of base map node
00037     RED   = 0,         /// node is colored red
00038     BLACK = 1          /// node is colored black
00039 };
00040 ///
00041 class BaseMapRoot;
00042 
00043 class BMNode : public Listable {
00044   public:  
00045     short           _color; ///< color of node
00046     short           _type;  ///< node type (nonroot or root)
00047     union {                 ///< anonymous pointer union
00048         BMNode      *_parent;///< pointer to parent node (if nonroot)
00049         BaseMapRoot *_map;   ///< pointer to map (if root)
00050     };
00051     BMNode         *_left;  ///< pointer to left child (sentinel if none)
00052     BMNode         *_right; ///< pointer to right child (sentinel if none)
00053     BMKey           _key;   ///< key union
00054     Wrapper        *_data;  ///< pointer to data
00055 
00056     BMNode();
00057     ~BMNode();
00058 
00059     virtual Listable       *listable_clone() const;
00060     ///< Required by Listable
00061  
00062     virtual void            print(ostream & o) const;
00063     ///< Required by Listable
00064 
00065 };
00066 
00067 #endif
 © 1995-2005 University of Illinois, Urbana-Champaign. All rights reserved.  Fri Mar 25 23:05:40 2005