The ON_UuidList class provides a tool to efficiently maintain a list of uuids 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_UuidList:
ON_SimpleArray< ON_UUID >

Public Member Functions

 ON_UuidList ()
 
 ON_UuidList (int capacity)
 
 ON_UuidList (const ON_UuidList &src)
 
 ~ON_UuidList ()
 
bool AddUuid (ON_UUID uuid, bool bCheckForDupicates=true)
 Adds a uuid to the list. More...
 
const ON_UUIDArray () const
 
void Compact ()
 Makes the uuid list as efficent as possible in both search speed and memory usage. Use Compact() when a uuid list will be in use but is not likely to be modifed. A list that has been compacted can still be modified. More...
 
int Count () const
 
void Destroy ()
 Destroy list. If list will be reused, Empty() is more efficient. More...
 
void Empty ()
 Provides an efficient way to empty a list so that it can be used again. More...
 
bool FindUuid (ON_UUID uuid) const
 Determine if a uuid is in the list. More...
 
int GetUuids (ON_SimpleArray< ON_UUID > &uuid_list) const
 Append the uuids in this class to uuid_list. More...
 
ON_UuidListoperator= (const ON_UuidList &src)
 
bool Read (class ON_BinaryArchive &archive)
 Read the uuid list from an archive. More...
 
bool Read (class ON_BinaryArchive &archive, bool bSortAferRead)
 Read the uuid list from an archive. More...
 
void RemapUuids (const ON_SimpleArray< ON_UuidPair > &uuid_remap)
 This tool is used in rare situations when the object ids stored in the uuid list need to be remapped. More...
 
bool RemoveUuid (ON_UUID uuid)
 Removes a uuid from the list. More...
 
void Reserve (size_t capacity)
 
bool Write (class ON_BinaryArchive &archive) const
 Saves the uuid list in an archive. More...
 
bool Write (class ON_BinaryArchive &archive, bool bSortBeforeWrite) const
 Saves the uuid list in an archive. More...
 

Static Public Member Functions

static int CompareUuid (const ON_UUID *a, const ON_UUID *b)
 Fast uuid compare. Not necessarily the same as ON_UuidCompare(). More...
 

Detailed Description

The ON_UuidList class provides a tool to efficiently maintain a list of uuids 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_UuidList() [1/3]

ON_UuidList::ON_UuidList ( )

◆ ON_UuidList() [2/3]

ON_UuidList::ON_UuidList ( int  capacity)

◆ ~ON_UuidList()

ON_UuidList::~ON_UuidList ( )

◆ ON_UuidList() [3/3]

ON_UuidList::ON_UuidList ( const ON_UuidList src)

Member Function Documentation

◆ AddUuid()

bool ON_UuidList::AddUuid ( ON_UUID  uuid,
bool  bCheckForDupicates = true 
)

Adds a uuid to the list.

Parameters
uuid[in] id to add.
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 are going to have a large list 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.

◆ Array()

const ON_UUID* ON_UuidList::Array ( ) const
Returns
Array of uuids in the list. Sorted with respect to ON_UuidList::CompareUuid().

Calling AddUuid() may grow the dynamic array and make the pointer invalid.

◆ Compact()

void ON_UuidList::Compact ( )

Makes the uuid list as efficent as possible in both search speed and memory usage. Use Compact() when a uuid list will be in use but is not likely to be modifed. A list that has been compacted can still be modified.

◆ CompareUuid()

static int ON_UuidList::CompareUuid ( const ON_UUID a,
const ON_UUID b 
)
static

Fast uuid compare. Not necessarily the same as ON_UuidCompare().

◆ Count()

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

◆ Destroy()

void ON_UuidList::Destroy ( )

Destroy list. If list will be reused, Empty() is more efficient.

◆ Empty()

void ON_UuidList::Empty ( )

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

◆ FindUuid()

bool ON_UuidList::FindUuid ( ON_UUID  uuid) const

Determine if a uuid is in the list.

Returns
True if uuid is in the list.

◆ GetUuids()

int ON_UuidList::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.

◆ operator=()

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

◆ Read() [1/2]

bool ON_UuidList::Read ( class ON_BinaryArchive archive)

Read the uuid list from an archive.

Parameters
archive[in] archive to read from.
Returns
true if the read was successful.

◆ Read() [2/2]

bool ON_UuidList::Read ( class ON_BinaryArchive archive,
bool  bSortAferRead 
)

Read the uuid list from an archive.

Parameters
archive[in] archive to read from. bool bSortAfterRead - [in] True if ids should be sorted after the read so future lookups will be fast. False if the state of the sorted/unsorted bits that existed at write time should be preserved.
Returns
true if the read was successful.

◆ RemapUuids()

void ON_UuidList::RemapUuids ( const ON_SimpleArray< ON_UuidPair > &  uuid_remap)

This tool is used in rare situations when the object ids stored in the uuid list need to be remapped.

Parameters
uuid_remap[in] Is it critical that uuid_remap[] be sorted with respect to ON_UuidPair::CompareFirstUuid.

◆ RemoveUuid()

bool ON_UuidList::RemoveUuid ( ON_UUID  uuid)

Removes a uuid from the list.

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

◆ Reserve()

void ON_UuidList::Reserve ( size_t  capacity)

◆ Write() [1/2]

bool ON_UuidList::Write ( class ON_BinaryArchive archive) const

Saves the uuid list in an archive.

Parameters
archive[in] archive to write to.
Returns
true if write was successful.

◆ Write() [2/2]

bool ON_UuidList::Write ( class ON_BinaryArchive archive,
bool  bSortBeforeWrite 
) const

Saves the uuid list in an archive.

Parameters
archive[in] archive to write to.
bSortBeforeWrite[in] True if ids should be sorted before the write so future lookups will be fast. False if the current state of the sorted/unsorted bits should be preserved.
Returns
true if write was successful.