Open CASCADE Technology  6.9.1
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, 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 ()
 

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

template<class TheObjType , class TheBndType >
typedef NCollection_UBTree<TheObjType, TheBndType> NCollection_UBTreeFiller< TheObjType, TheBndType >::UBTree

UBTree algorithm.

template<class TheObjType , class TheBndType >
typedef TYPENAME UBTree::TreeNode NCollection_UBTreeFiller< TheObjType, TheBndType >::UBTreeNode

Constructor & Destructor Documentation

template<class TheObjType , class TheBndType >
NCollection_UBTreeFiller< TheObjType, TheBndType >::NCollection_UBTreeFiller ( UBTree theTree,
const Handle< NCollection_BaseAllocator > &  theAlloc = 0L,
const Standard_Boolean  isFullRandom = Standard_True 
)
inline

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.
template<class TheObjType , class TheBndType >
NCollection_UBTreeFiller< TheObjType, TheBndType >::~NCollection_UBTreeFiller ( )
inline

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

Member Function Documentation

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

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

template<class TheObjType , class TheBndType >
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.

Returns
the tree size (the same value is returned by method Fill()).
template<class TheObjType , class TheBndType >
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.

Returns
the number of objects added to the tree.
template<class TheObjType , class TheBndType >
void NCollection_UBTreeFiller< TheObjType, TheBndType >::Reset ( void  )
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.


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