Open CASCADE Technology 7.8.0
Data Structures | Public Types | Public Member Functions
NCollection_UBTreeFiller< TheObjType, TheBndType > Class Template Reference

#include <NCollection_UBTreeFiller.hxx>

Data Structures

struct  ObjBnd
 Structure of pair (object, bnd box) More...
 

Public Types

typedef NCollection_UBTree< TheObjType, TheBndTypeUBTree
 UBTree algorithm.
 
typedef 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.
 
Standard_Integer Fill ()
 
void Reset ()
 
Standard_Integer CheckTree (Standard_OStream &theStream)
 
 ~NCollection_UBTreeFiller ()
 

Detailed Description

template<class TheObjType, class TheBndType>
class NCollection_UBTreeFiller< TheObjType, TheBndType >

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.

Member Typedef Documentation

◆ UBTree

UBTree algorithm.

◆ UBTreeNode

Constructor & Destructor Documentation

◆ NCollection_UBTreeFiller()

Constructor.

Parameters
theTreeTree instance that is to be filled.
theAllocAllocator for the Filler data.
isFullRandomTakes 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.

◆ ~NCollection_UBTreeFiller()

Destructor. Fills the tree with accumulated items if they have not been passed by a previous call of method Fill().

Member Function Documentation

◆ Add()

void NCollection_UBTreeFiller< TheObjType, TheBndType >::Add ( const TheObjType theObj,
const TheBndType theBnd 
)
inline

Adds a pair (theObj, theBnd) to my sequence.

◆ CheckTree()

Check the filled tree for the total number of items and the balance outputting these results to std::ostream.

Returns
the tree size (the same value is returned by method Fill()).

◆ 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.

Returns
the number of objects added to the tree.

◆ Reset()

Remove all data from Filler, partculary if the Tree no more needed so the destructor of this Filler should not populate the useless Tree.


The documentation for this class was generated from the following file: