@@ -93,24 +93,20 @@ enum LocType { locEqual, locLess, locGreat, locGreatEqual, locLessEqual };
9393// an indexed dynamic array without increase of algorithm calculation costs (this is one
9494// more classical B+ tree feature). This is also not done to improve tree performance a little
9595//
96- template <typename Value, typename Key = Value, typename Allocator = Firebird::MemoryPool,
97- typename KeyOfValue = DefaultKeyValue<Value>,
98- typename Cmp = DefaultComparator<Key> >
96+ template <typename Value, typename Key = Value,
97+ typename KeyOfValue = DefaultKeyValue<Value>,
98+ typename Cmp = DefaultComparator<Key> >
9999class BePlusTree
100100{
101101 static const FB_SIZE_T LEAF_COUNT = LEAF_PAGE_SIZE / sizeof (Value);
102102 static const FB_SIZE_T NODE_COUNT = NODE_PAGE_SIZE / sizeof (void *);
103103public:
104- explicit BePlusTree (Allocator *_pool)
105- : pool(_pool), level(0 ), defaultAccessor(this )
106- { }
107-
108- explicit BePlusTree (Allocator& _pool)
104+ explicit BePlusTree (Firebird::MemoryPool& _pool)
109105 : pool(&_pool), level(0 ), defaultAccessor(this )
110106 { }
111107
112- BePlusTree (Allocator * _pool, const BePlusTree& from)
113- : pool(_pool), level(0 ), defaultAccessor(this )
108+ BePlusTree (Firebird::MemoryPool& _pool, const BePlusTree& from)
109+ : pool(& _pool), level(0 ), defaultAccessor(this )
114110 {
115111 append (from);
116112 }
@@ -283,9 +279,6 @@ class BePlusTree
283279 }
284280
285281private:
286- BePlusTree (Allocator *_pool, void *rootPage) : pool(_pool), level(0 ),
287- root (new (rootPage) ItemList()), defaultAccessor(this ) {}
288-
289282 class NodeList ;
290283
291284 class ItemList : public SortedVector <Value, LEAF_COUNT, Key, KeyOfValue, Cmp>
@@ -641,22 +634,18 @@ class BePlusTree
641634 }; // class Accessor
642635
643636private:
644- Allocator* pool;
637+ Firebird::MemoryPool* const pool;
645638 int level;
646639 NodePtr root;
647640 Accessor defaultAccessor;
648641
649642 void _removePage (int level, NodePtr node);
650-
651- friend class MemoryPool ;
652- friend class NodeList ;
653- friend class Accessor ;
654643};
655644
656645// ************************ BePlusTree implementation ******************
657646
658- template <typename Value, typename Key, typename Allocator, typename KeyOfValue, typename Cmp>
659- bool BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp>::add(const Value& item, Accessor* accessor)
647+ template <typename Value, typename Key, typename KeyOfValue, typename Cmp>
648+ bool BePlusTree<Value, Key, KeyOfValue, Cmp>::add(const Value& item, Accessor* accessor)
660649{
661650 // Finish initialization of the tree if necessary
662651 if (!root)
@@ -894,8 +883,8 @@ bool BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp>::add(const Value& item,
894883 return true ;
895884}
896885
897- template <typename Value, typename Key, typename Allocator, typename KeyOfValue, typename Cmp>
898- void BePlusTree<Value, Key, Allocator, KeyOfValue, Cmp>::_removePage(const int nodeLevel, NodePtr node)
886+ template <typename Value, typename Key, typename KeyOfValue, typename Cmp>
887+ void BePlusTree<Value, Key, KeyOfValue, Cmp>::_removePage(const int nodeLevel, NodePtr node)
899888{
900889 NodeList *list;
901890 // Get parent and adjust the links
0 commit comments