ON_UuidPtrList Class Reference

The ON_UuidList class provides a tool to efficiently maintain a list of uuid-pointer pairs and determine if a uuid is in the list. This class is based on the premise that there are no duplicate uuids in the list. More...

#include <opennurbs_array.h>

Inheritance diagram for ON_UuidPtrList:
ON_SimpleArray< ON_UuidPtr >

Public Member Functions

 ON_UuidPtrList ()=default
 
 ON_UuidPtrList (size_t capacity)
 
 ON_UuidPtrList (const ON_UuidPtrList &src)
 
 ~ON_UuidPtrList ()=default
 
bool AddUuidPtr (ON_UUID uuid, ON__UINT_PTR ptr, bool bCheckForDupicates=true)
 Adds a uuid-index pair to the list. More...
 
unsigned int Count () const
 
bool FindUuid (ON_UUID uuid) const
 Determine if an element with a uuid is in the list. More...
 
bool FindUuid (ON_UUID uuid, ON__UINT_PTR *ptr) const
 
bool FindUuidPtr (ON_UUID uuid, ON__UINT_PTR index) const
 Determine if a uuid-index pair is in the list. More...
 
unsigned int GetUuids (ON_SimpleArray< ON_UUID > &uuid_list) const
 Append the uuids in this class to uuid_list. More...
 
void ImproveSearchSpeed ()
 If you will perform lots of searches before the next change to the list, then calling ImproveSearchSpeed() will speed up the searches by culling removed objects and completely sorting the list so only a binary search is required. You may edit the list at any time after calling ImproveSearchSpeed(). If you are performing a few searches between edits, then excessive calling of ImproveSearchSpeed() may actually decrease overall program performance. More...
 
ON_UuidPtrListoperator= (const ON_UuidPtrList &src)
 
void RemoveAll ()
 Provides an efficient way to empty a list so that it can be used again. More...
 
bool RemoveUuid (ON_UUID uuid)
 Removes an element with a matching uuid from the list. More...
 
void Reserve (size_t capacity)
 

Detailed Description

The ON_UuidList class provides a tool to efficiently maintain a list of uuid-pointer pairs and determine if a uuid is in the list. This class is based on the premise that there are no duplicate uuids in the list.

Constructor & Destructor Documentation

◆ ON_UuidPtrList() [1/3]

ON_UuidPtrList::ON_UuidPtrList ( )
default

◆ ON_UuidPtrList() [2/3]

ON_UuidPtrList::ON_UuidPtrList ( size_t  capacity)

◆ ~ON_UuidPtrList()

ON_UuidPtrList::~ON_UuidPtrList ( )
default

◆ ON_UuidPtrList() [3/3]

ON_UuidPtrList::ON_UuidPtrList ( const ON_UuidPtrList src)

Member Function Documentation

◆ AddUuidPtr()

bool ON_UuidPtrList::AddUuidPtr ( ON_UUID  uuid,
ON__UINT_PTR  ptr,
bool  bCheckForDupicates = true 
)

Adds a uuid-index pair to the list.

Parameters
uuid[in] id to add. This uuid cannot be ON_max_uuid because ON_max_uuid is
bCheckForDupicates[in] if true, then the uuid is not added if it is already in the list. If you are certain that the uuid is not in the list and you have a have a large collection of uuids, then setting bCheckForDupicates=false will speed up the addition of uuids.
Returns
True if uuid was added. False if uuid was not added because it is already in the collection.

◆ Count()

unsigned int ON_UuidPtrList::Count ( ) const
Returns
Number of active uuids in the list.

◆ FindUuid() [1/2]

bool ON_UuidPtrList::FindUuid ( ON_UUID  uuid) const

Determine if an element with a uuid is in the list.

Parameters
ptr[out] if not nullptr and a matching uuid is found, then *ptr is set to the value of the m_ptr.
Returns
True if an element was found. Returns false if the uuid is not in the list.

◆ FindUuid() [2/2]

bool ON_UuidPtrList::FindUuid ( ON_UUID  uuid,
ON__UINT_PTR *  ptr 
) const

◆ FindUuidPtr()

bool ON_UuidPtrList::FindUuidPtr ( ON_UUID  uuid,
ON__UINT_PTR  index 
) const

Determine if a uuid-index pair is in the list.

Returns
True if the uuid-index pair is in the list. Returns false if the uuid-index pair is not in the list.

◆ GetUuids()

unsigned int ON_UuidPtrList::GetUuids ( ON_SimpleArray< ON_UUID > &  uuid_list) const

Append the uuids in this class to uuid_list.

Parameters
uuid_list[in/out]
Returns
Number of uuids added to uuid_list.

◆ ImproveSearchSpeed()

void ON_UuidPtrList::ImproveSearchSpeed ( )

If you will perform lots of searches before the next change to the list, then calling ImproveSearchSpeed() will speed up the searches by culling removed objects and completely sorting the list so only a binary search is required. You may edit the list at any time after calling ImproveSearchSpeed(). If you are performing a few searches between edits, then excessive calling of ImproveSearchSpeed() may actually decrease overall program performance.

◆ operator=()

ON_UuidPtrList& ON_UuidPtrList::operator= ( const ON_UuidPtrList src)

◆ RemoveAll()

void ON_UuidPtrList::RemoveAll ( )

Provides an efficient way to empty a list so that it can be used again.

◆ RemoveUuid()

bool ON_UuidPtrList::RemoveUuid ( ON_UUID  uuid)

Removes an element with a matching uuid from the list.

Parameters
uuid[in] id to remove
Returns
True if an element was removed. False if the uuid was not in the list.

◆ Reserve()

void ON_UuidPtrList::Reserve ( size_t  capacity)