Open CASCADE Technology
7.2.0
|
#include <NCollection_UBTreeFiller.hxx>
Data Structures | |
struct | ObjBnd |
Structure of pair (object, bnd box) More... | |
Public Types | |
typedef NCollection_UBTree< TheObjType, TheBndType > | UBTree |
UBTree algorithm. More... | |
typedef TYPENAME UBTree::TreeNode | UBTreeNode |
Public Member Functions | |
NCollection_UBTreeFiller (UBTree &theTree, const Handle< NCollection_BaseAllocator > &theAlloc=0L, const Standard_Boolean isFullRandom=Standard_True) | |
void | Add (const TheObjType &theObj, const TheBndType &theBnd) |
Adds a pair (theObj, theBnd) to my sequence. More... | |
Standard_Integer | Fill () |
void | Reset () |
Standard_Integer | CheckTree (Standard_OStream &theStream) |
~NCollection_UBTreeFiller () | |
This class is used to fill an UBTree in a random order. The quality of a tree is much better (from the point of view of the search time) if objects are added to it in a random order to avoid adding a chain of neerby objects one following each other.
This class collects objects to be added, and then add them to the tree in a random order.
typedef NCollection_UBTree<TheObjType, TheBndType> NCollection_UBTreeFiller< TheObjType, TheBndType >::UBTree |
UBTree algorithm.
typedef TYPENAME UBTree::TreeNode NCollection_UBTreeFiller< TheObjType, TheBndType >::UBTreeNode |
|
inline |
Constructor.
theTree | Tree instance that is to be filled. |
theAlloc | Allocator for the Filler data. |
isFullRandom | Takes effect when the number of items is large (order of 50,000). When it is True, the code uses the maximal randomization allowing a better balanced tree. If False, the randomization/tree balance are worse but the tree filling is faster due to better utilisation of CPU L1/L2 cache. |
|
inline |
Destructor. Fills the tree with accumulated items if they have not been passed by a previous call of method Fill().
|
inline |
Adds a pair (theObj, theBnd) to my sequence.
Standard_Integer NCollection_UBTreeFiller< TheObjType, TheBndType >::CheckTree | ( | Standard_OStream & | theStream | ) |
Check the filled tree for the total number of items and the balance outputting these results to ostream.
Standard_Integer NCollection_UBTreeFiller< TheObjType, TheBndType >::Fill | ( | ) |
Fills the tree with the objects from my sequence. This method clears the internal buffer of added items making sure that no item would be added twice.
|
inline |
Remove all data from Filler, partculary if the Tree no more needed so the destructor of this Filler should not populate the useless Tree.