ON_UuidIndexList Class Reference

The ON_UuidList class provides a tool to efficiently maintain a list of uuid-index 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_UuidIndexList:
ON_SimpleArray< ON_UuidIndex >

Public Member Functions

 ON_UuidIndexList ()=default
 
 ON_UuidIndexList (size_t capacity)
 
 ON_UuidIndexList (const ON_UuidIndexList &src)
 
 ~ON_UuidIndexList ()=default
 
bool AddUuidIndex (ON_UUID uuid, int index, 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, int *index) const
 
bool FindUuidIndex (ON_UUID uuid, int 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_UuidIndexListoperator= (const ON_UuidIndexList &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-index 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_UuidIndexList() [1/3]

ON_UuidIndexList::ON_UuidIndexList ( )
default

◆ ON_UuidIndexList() [2/3]

ON_UuidIndexList::ON_UuidIndexList ( size_t  capacity)

◆ ~ON_UuidIndexList()

ON_UuidIndexList::~ON_UuidIndexList ( )
default

◆ ON_UuidIndexList() [3/3]

ON_UuidIndexList::ON_UuidIndexList ( const ON_UuidIndexList src)

Member Function Documentation

◆ AddUuidIndex()

bool ON_UuidIndexList::AddUuidIndex ( ON_UUID  uuid,
int  index,
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_UuidIndexList::Count ( ) const
Returns
Number of active uuids in the list.

◆ FindUuid() [1/2]

bool ON_UuidIndexList::FindUuid ( ON_UUID  uuid) const

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

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

◆ FindUuid() [2/2]

bool ON_UuidIndexList::FindUuid ( ON_UUID  uuid,
int *  index 
) const

◆ FindUuidIndex()

bool ON_UuidIndexList::FindUuidIndex ( ON_UUID  uuid,
int  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_UuidIndexList::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_UuidIndexList::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_UuidIndexList& ON_UuidIndexList::operator= ( const ON_UuidIndexList src)

◆ RemoveAll()

void ON_UuidIndexList::RemoveAll ( )

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

◆ RemoveUuid()

bool ON_UuidIndexList::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_UuidIndexList::Reserve ( size_t  capacity)