ON_2dexMap Class Reference

#include <opennurbs_array.h>

Inheritance diagram for ON_2dexMap:
ON_SimpleArray< ON_2dex >

Public Member Functions

 ON_2dexMap ()
 
 ON_2dexMap (int capacity)
 
 ~ON_2dexMap ()
 
bool AddIndex (int i, int j)
 Adds and element (i,j). If there is already an entry with value (i,*), then no element is added. More...
 
const ON_2dex * Array () const
 
int Count () const
 
void Create (int count, int i0, int j)
 Creates an index map with the values (i0,j),...,(i0+count-1,j) More...
 
const ON_2dex * Find2dex (int i) const
 
int FindIndex (int i, int not_found_rc) const
 Searches for an element with a matching i and returns its j value. If no matching element is found, then not_found_rc is returned. More...
 
ON_2dex operator[] (int i) const
 
bool RemoveIndex (int i)
 If an element (i,*) exists, it is removed. If there is not an element with a matching i value, then false is returned. More...
 
void Reserve (size_t capacity)
 
bool SetIndex (int i, int j)
 Searches for an element (i,*) and sets its j value to j. If there is no element with a matching i, then false is returned. More...
 
void SetOrAddIndex (int i, int j)
 If an element (i,*) exists, its j value is set. Otherwise a new element with value (i,j) is added. More...
 

Constructor & Destructor Documentation

◆ ON_2dexMap() [1/2]

ON_2dexMap::ON_2dexMap ( )

◆ ON_2dexMap() [2/2]

ON_2dexMap::ON_2dexMap ( int  capacity)

◆ ~ON_2dexMap()

ON_2dexMap::~ON_2dexMap ( )

Member Function Documentation

◆ AddIndex()

bool ON_2dexMap::AddIndex ( int  i,
int  j 
)

Adds and element (i,j). If there is already an entry with value (i,*), then no element is added.

Parameters
i[in]
i[in]
Returns
True if and element it added.

◆ Array()

const ON_2dex* ON_2dexMap::Array ( ) const

◆ Count()

int ON_2dexMap::Count ( ) const

◆ Create()

void ON_2dexMap::Create ( int  count,
int  i0,
int  j 
)

Creates an index map with the values (i0,j),...,(i0+count-1,j)

Parameters
count[in] number of elements
i0[in] i value of first element
j[in] j value for all elements

◆ Find2dex()

const ON_2dex* ON_2dexMap::Find2dex ( int  i) const

◆ FindIndex()

int ON_2dexMap::FindIndex ( int  i,
int  not_found_rc 
) const

Searches for an element with a matching i and returns its j value. If no matching element is found, then not_found_rc is returned.

Parameters
i[in] value of i to search for
not_found_rc[in] value to return if there is not a match.
Returns
j value

◆ operator[]()

ON_2dex ON_2dexMap::operator[] ( int  i) const

◆ RemoveIndex()

bool ON_2dexMap::RemoveIndex ( int  i)

If an element (i,*) exists, it is removed. If there is not an element with a matching i value, then false is returned.

Parameters
i[in]
Returns
True if the element was removed

◆ Reserve()

void ON_2dexMap::Reserve ( size_t  capacity)

◆ SetIndex()

bool ON_2dexMap::SetIndex ( int  i,
int  j 
)

Searches for an element (i,*) and sets its j value to j. If there is no element with a matching i, then false is returned.

Parameters
i[in]
j[in]
Returns
True if and element exists and was set.

◆ SetOrAddIndex()

void ON_2dexMap::SetOrAddIndex ( int  i,
int  j 
)

If an element (i,*) exists, its j value is set. Otherwise a new element with value (i,j) is added.

Parameters
i[in]
j[in]