ON_BoundingBoxCache Class Reference

#include <opennurbs_bounding_box.h>

Public Member Functions

 ON_BoundingBoxCache ()=default
 
 ON_BoundingBoxCache (const ON_BoundingBoxCache &)=default
 
 ~ON_BoundingBoxCache ()=default
 
void AddBoundingBox (const ON_BoundingBox &bbox, const ON_SHA1_Hash &hash)
 Add a bounding box that can be found from a hash value. More...
 
void AddBoundingBox (const ON_BoundingBoxAndHash &bbox_and_hash)
 
unsigned int BoundingBoxCount () const
 
bool GetBoundingBox (const ON_SHA1_Hash &hash, ON_BoundingBox &bbox) const
 Get a cached bounding box. More...
 
ON_BoundingBoxCacheoperator= (const ON_BoundingBoxCache &)=default
 
bool Read (class ON_BinaryArchive &archive)
 
void RemoveAllBoundingBoxes ()
 Removes all bounding boxes. More...
 
bool RemoveBoundingBox (const ON_SHA1_Hash &hash)
 Remove a bounding box that can be found from a hash value. More...
 
bool Write (class ON_BinaryArchive &archive) const
 

Constructor & Destructor Documentation

◆ ON_BoundingBoxCache() [1/2]

ON_BoundingBoxCache::ON_BoundingBoxCache ( )
default

◆ ~ON_BoundingBoxCache()

ON_BoundingBoxCache::~ON_BoundingBoxCache ( )
default

◆ ON_BoundingBoxCache() [2/2]

ON_BoundingBoxCache::ON_BoundingBoxCache ( const ON_BoundingBoxCache )
default

Member Function Documentation

◆ AddBoundingBox() [1/2]

void ON_BoundingBoxCache::AddBoundingBox ( const ON_BoundingBox bbox,
const ON_SHA1_Hash hash 
)

Add a bounding box that can be found from a hash value.

Parameters
bbox[in]
hash[in] A hash of the information needed to create this bounding box.

◆ AddBoundingBox() [2/2]

void ON_BoundingBoxCache::AddBoundingBox ( const ON_BoundingBoxAndHash bbox_and_hash)

◆ BoundingBoxCount()

unsigned int ON_BoundingBoxCache::BoundingBoxCount ( ) const
Returns
Number of cached boxes.

◆ GetBoundingBox()

bool ON_BoundingBoxCache::GetBoundingBox ( const ON_SHA1_Hash hash,
ON_BoundingBox bbox 
) const

Get a cached bounding box.

Parameters
hash[in]
bbox[out] If the hash identifies a bounding box in the cache, then that bounding box is returned. Otherwise ON_BoundingBox::NanBoundingBox is returned.
Returns
true - cached bounding box returned false - bounding box not in cache.

◆ operator=()

ON_BoundingBoxCache& ON_BoundingBoxCache::operator= ( const ON_BoundingBoxCache )
default

◆ Read()

bool ON_BoundingBoxCache::Read ( class ON_BinaryArchive archive)

◆ RemoveAllBoundingBoxes()

void ON_BoundingBoxCache::RemoveAllBoundingBoxes ( )

Removes all bounding boxes.

If the hash values you are using are correctly computed and include all information that the bouding box depends on, then you never need to remove bounding boxes. Unused ones will get removed as new ones are added. If the hash does not include all information required to compute the bounding boxes, then call RemoveAllBoundingBoxes() when the non-hashed information changes.

◆ RemoveBoundingBox()

bool ON_BoundingBoxCache::RemoveBoundingBox ( const ON_SHA1_Hash hash)

Remove a bounding box that can be found from a hash value.

Parameters
hash[in]
Returns
true - hash was in the cache and removed. false - hash was not in the cache.

If the hash values you are using are correctly computed and include all information that the bouding box depends on, then you never need to remove bounding boxes. Unused ones will get removed as new ones are added.

◆ Write()

bool ON_BoundingBoxCache::Write ( class ON_BinaryArchive archive) const