00001 #ifndef CDBBDBSHARED_BTREE_NODE_HH
00002 #define CDBBDBSHARED_BTREE_NODE_HH
00003
00004
00005
00006
00007 #include "BdbUtil/Bdb.hh"
00008
00009
00010
00011
00012
00013
00014 class CdbBdbSBtreeDefaultOrder {
00015
00016 public:
00017
00018 enum { N = 2 };
00019 };
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056 template< class K,
00057 class ORDER = CdbBdbSBtreeDefaultOrder >
00058 class CdbBdbSBtreeNode {
00059
00060 public:
00061
00062
00063
00064
00065
00066 CdbBdbSBtreeNode( ) : parent(0), isLeaf(d_True), n(0) { }
00067 CdbBdbSBtreeNode( d_ULong p ) : parent(p), isLeaf(d_True), n(0) { }
00068
00069
00070
00071
00072 CdbBdbSBtreeNode( const CdbBdbSBtreeNode<K,ORDER>& theNode )
00073 {
00074 copySelf( theNode );
00075 }
00076
00077
00078
00079
00080
00081
00082 ~CdbBdbSBtreeNode( ) { }
00083
00084
00085
00086
00087 CdbBdbSBtreeNode<K,ORDER>& operator=( const CdbBdbSBtreeNode<K,ORDER>& theNode )
00088 {
00089 if( this != &theNode ) copySelf( theNode );
00090 return *this;
00091 }
00092
00093 private:
00094
00095
00096
00097
00098
00099 void copySelf( const CdbBdbSBtreeNode<K,ORDER>& theNode )
00100 {
00101 parent = theNode.parent;
00102 isLeaf = theNode.isLeaf;
00103 n = theNode.n;
00104 for( unsigned int i = 0; i <= 2 * ORDER::N; ++i ) child[i] = theNode.child[i];
00105 for( unsigned int i = 0; i < 2 * ORDER::N; ++i ) key [i] = theNode.key [i];
00106 }
00107
00108 public:
00109
00110
00111
00112 d_ULong parent;
00113
00114
00115
00116 d_ULong child[ 2 * ORDER::N + 1 ];
00117
00118
00119
00120 K key[ 2 * ORDER::N ];
00121
00122
00123
00124 d_Boolean isLeaf;
00125
00126
00127
00128
00129 d_Octet n;
00130 };
00131
00132 template< class ORDER,
00133 class K >
00134 std::ostream&
00135 operator<<( std::ostream& o,
00136 const CdbBdbSBtreeNode<K,ORDER>& theNode )
00137 {
00138 return o << theNode.parent;
00139 }
00140
00141 #endif // CDBBDBSHARED_BTREE_NODE_HH