The ON_UuidPairList class provides a tool to efficiently maintain a list of uuid 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_UuidPairList:
ON_SimpleArray< ON_UuidPair >

Public Member Functions

 ON_UuidPairList ()
 
 ON_UuidPairList (int capacity)
 
 ON_UuidPairList (const ON_UuidPairList &src)
 
 ~ON_UuidPairList ()
 
bool AddPair (ON_UUID id1, ON_UUID id2, bool bCheckForDupicates=true)
 Adds a uuid-index pair to the list. More...
 
int Count () const
 
void Empty ()
 Provides an efficient way to empty a list so that it can be used again. More...
 
bool FindId1 (ON_UUID id1, ON_UUID *id2=0) const
 Determine if an element with a uuid is in the list. More...
 
bool FindPair (ON_UUID id1, ON_UUID id2) const
 Determine if an id pair is in the list. More...
 
int GetId1s (ON_SimpleArray< ON_UUID > &uuid_list) const
 Append the value of the first id in each pair 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_UuidPairListoperator= (const ON_UuidPairList &src)
 
bool Read (class ON_BinaryArchive &archive)
 
bool RemovePair (ON_UUID id1)
 Removes an element with a matching id1 from the list. More...
 
bool RemovePair (ON_UUID id1, ON_UUID id2)
 Removes an element with a matching id pair from the list. More...
 
void Reserve (size_t capacity)
 
bool Write (class ON_BinaryArchive &archive) const
 

Static Public Attributes

static const ON_UuidPairList EmptyList
 

Detailed Description

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

ON_UuidPairList::ON_UuidPairList ( )

◆ ON_UuidPairList() [2/3]

ON_UuidPairList::ON_UuidPairList ( int  capacity)

◆ ~ON_UuidPairList()

ON_UuidPairList::~ON_UuidPairList ( )

◆ ON_UuidPairList() [3/3]

ON_UuidPairList::ON_UuidPairList ( const ON_UuidPairList src)

Member Function Documentation

◆ AddPair()

bool ON_UuidPairList::AddPair ( ON_UUID  id1,
ON_UUID  id2,
bool  bCheckForDupicates = true 
)

Adds a uuid-index pair to the list.

Parameters
id1[in] id to add.
id2[in] id to add.
bCheckForDupicates[in] if true, then the pair is not added if id1 is already in the list. If you are certain that the id1 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 the pair was added. False if the pair was not added because it is already in the collection.

You cannot add the pair value ( ON_max_uuid, ON_max_uuid ). This pair value is used to mark removed elements in the ON_UuidPairList[].

◆ Count()

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

◆ Empty()

void ON_UuidPairList::Empty ( )

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

◆ FindId1()

bool ON_UuidPairList::FindId1 ( ON_UUID  id1,
ON_UUID id2 = 0 
) const

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

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

◆ FindPair()

bool ON_UuidPairList::FindPair ( ON_UUID  id1,
ON_UUID  id2 
) const

Determine if an id pair is in the list.

Returns
True if the id pair is in the list. False if the id pair is not in the list.

◆ GetId1s()

int ON_UuidPairList::GetId1s ( ON_SimpleArray< ON_UUID > &  uuid_list) const

Append the value of the first id in each pair to uuid_list[].

Parameters
uuid_list[in/out]
Returns
Number of ids appended to uuid_list[].

◆ ImproveSearchSpeed()

void ON_UuidPairList::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_UuidPairList& ON_UuidPairList::operator= ( const ON_UuidPairList src)

◆ Read()

bool ON_UuidPairList::Read ( class ON_BinaryArchive archive)

◆ RemovePair() [1/2]

bool ON_UuidPairList::RemovePair ( ON_UUID  id1)

Removes an element with a matching id1 from the list.

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

◆ RemovePair() [2/2]

bool ON_UuidPairList::RemovePair ( ON_UUID  id1,
ON_UUID  id2 
)

Removes an element with a matching id pair from the list.

Parameters
id1[in]
id2[in]
Returns
True if an element was removed. False if the id pair does not appear in the list.

◆ Reserve()

void ON_UuidPairList::Reserve ( size_t  capacity)

◆ Write()

bool ON_UuidPairList::Write ( class ON_BinaryArchive archive) const

Member Data Documentation

◆ EmptyList

const ON_UuidPairList ON_UuidPairList::EmptyList
static