#include <opennurbs_array.h>
Public Member Functions | |
ON_ClassArray () ON_NOEXCEPT | |
construction //////////////////////////////////////////////////////// More... | |
ON_ClassArray (size_t) | |
ON_ClassArray (const ON_ClassArray< T > &) | |
Copy constructor. More... | |
virtual | ~ON_ClassArray () |
void | Append (const T &) |
void | Append (int, const T *) |
T & | AppendNew () |
array operations //////////////////////////////////////////////////// More... | |
T * | Array () |
const T * | Array () const |
T * | At (int) |
At(index) returns nullptr if index < 0 or index >= count. More... | |
T * | At (unsigned int) |
T * | At (ON__INT64) |
T * | At (ON__UINT64) |
const T * | At (int) const |
const T * | At (unsigned int) const |
const T * | At (ON__INT64) const |
const T * | At (ON__UINT64) const |
int | BinarySearch (const T *, int(*)(const T *, const T *)) const |
int | BinarySearch (const T *, int(*)(const T *, const T *), int) const |
int | Capacity () const |
int | Count () const |
query /////////////////////////////////////////////////////////////// More... | |
void | Destroy () |
void | EmergencyDestroy (void) |
emergency bailout /////////////////////////////////////////////////// More... | |
void | Empty () |
T * | First () |
const T * | First () const |
virtual bool | HeapSort (int(*)(const T *, const T *)) |
void | Insert (int, const T &) |
Insert called with a reference uses operator =. More... | |
T * | KeepArray () |
T * | Last () |
const T * | Last () const |
int | NewCapacity () const |
operator const T * () const | |
operator T* () | |
ON_ClassArray< T > & | operator= (const ON_ClassArray< T > &) |
Assignment operator. More... | |
T & | operator[] (int) |
T & | operator[] (unsigned int) |
T & | operator[] (ON__INT64) |
T & | operator[] (ON__UINT64) |
const T & | operator[] (int) const |
const T & | operator[] (unsigned int) const |
const T & | operator[] (ON__INT64) const |
const T & | operator[] (ON__UINT64) const |
bool | Permute (const int *) |
virtual bool | QuickSort (int(*)(const T *, const T *)) |
Sorts the array using the heap sort algorithm. More... | |
virtual T * | Realloc (T *, int) |
low level memory managment /////////////////////////////////////// More... | |
void | Remove () |
void | Remove (int) |
T * | Reserve (size_t) |
memory managment ///////////////////////////////////////////////// More... | |
void | Reverse () |
int | Search (const T *, int(*)(const T *, const T *)) const |
void | SetArray (T *) |
Do not use this version of SetArray(). Use the one that takes a pointer, count and capacity: SetArray(pointer,count,capacity) More... | |
void | SetArray (T *, int, int) |
Expert user tool to set the memory used by the dyanmic array. More... | |
T * | SetCapacity (size_t) |
void | SetCount (int) |
low level memory managment ////////////////////////////////////////// More... | |
void | Shrink () |
unsigned int | SizeOfArray () const |
unsigned int | SizeOfElement () const |
bool | Sort (ON::sort_algorithm sort_algorithm, int *, int(*)(const T *, const T *)) const |
Sort() fills in the index[] array so that array[index[i]] <= array[index[i+1]]. The array is not modified. More... | |
bool | Sort (ON::sort_algorithm sort_algorithm, int *, int(*)(const T *, const T *, void *), void *) const |
Sort() fills in the index[] array so that array[index[i]] <= array[index[i+1]]. The array is not modified. More... | |
void | Swap (int, int) |
unsigned int | UnsignedCount () const |
void | Zero () |
Protected Member Functions | |
void | ConstructDefaultElement (T *) |
void | DestroyElement (T &) |
void | Move (int, int, int) |
implimentation ////////////////////////////////////////////////////// More... | |
Protected Attributes | |
T * | m_a |
int | m_capacity |
int | m_count |
ON_ClassArray< T >::ON_ClassArray | ( | ) |
construction ////////////////////////////////////////////////////////
ON_ClassArray< T >::ON_ClassArray | ( | size_t | c | ) |
ON_ClassArray< T >::ON_ClassArray | ( | const ON_ClassArray< T > & | src | ) |
Copy constructor.
|
virtual |
void ON_ClassArray< T >::Append | ( | const T & | x | ) |
void ON_ClassArray< T >::Append | ( | int | count, |
const T * | p | ||
) |
T & ON_ClassArray< T >::AppendNew | ( | ) |
array operations ////////////////////////////////////////////////////
First destroy what's there ..
and then get a properly initialized element
T * ON_ClassArray< T >::Array | ( | ) |
const T * ON_ClassArray< T >::Array | ( | ) | const |
T * ON_ClassArray< T >::At | ( | int | i | ) |
At(index) returns nullptr if index < 0 or index >= count.
T * ON_ClassArray< T >::At | ( | unsigned int | i | ) |
T * ON_ClassArray< T >::At | ( | ON__INT64 | i | ) |
T * ON_ClassArray< T >::At | ( | ON__UINT64 | i | ) |
const T * ON_ClassArray< T >::At | ( | int | i | ) | const |
const T * ON_ClassArray< T >::At | ( | unsigned int | i | ) | const |
const T * ON_ClassArray< T >::At | ( | ON__INT64 | i | ) | const |
const T * ON_ClassArray< T >::At | ( | ON__UINT64 | i | ) | const |
int ON_ClassArray< T >::BinarySearch | ( | const T * | key, |
int(*)(const T *, const T *) | compar | ||
) | const |
int ON_ClassArray< T >::BinarySearch | ( | const T * | key, |
int(*)(const T *, const T *) | compar, | ||
int | count | ||
) | const |
int ON_ClassArray< T >::Capacity | ( | ) | const |
|
protected |
int ON_ClassArray< T >::Count | ( | ) | const |
query ///////////////////////////////////////////////////////////////
void ON_ClassArray< T >::Destroy | ( | ) |
|
protected |
void ON_ClassArray< T >::EmergencyDestroy | ( | void | ) |
emergency bailout ///////////////////////////////////////////////////
emergency destroy ///////////////////////////////////////////////////
void ON_ClassArray< T >::Empty | ( | ) |
T * ON_ClassArray< T >::First | ( | ) |
const T * ON_ClassArray< T >::First | ( | ) | const |
|
virtual |
void ON_ClassArray< T >::Insert | ( | int | i, |
const T & | x | ||
) |
Insert called with a reference uses operator =.
T * ON_ClassArray< T >::KeepArray | ( | ) |
T * ON_ClassArray< T >::Last | ( | ) |
const T * ON_ClassArray< T >::Last | ( | ) | const |
|
protected |
implimentation //////////////////////////////////////////////////////
array operations ////////////////////////////////////////////////////
int ON_ClassArray< T >::NewCapacity | ( | ) | const |
cap_size = 128 MB on 32-bit os, 256 MB on 64 bit os
ON_ClassArray< T >::operator const T * | ( | ) | const |
ON_ClassArray< T >::operator T* | ( | ) |
ON_ClassArray< T > & ON_ClassArray< T >::operator= | ( | const ON_ClassArray< T > & | src | ) |
Assignment operator.
T & ON_ClassArray< T >::operator[] | ( | int | i | ) |
T & ON_ClassArray< T >::operator[] | ( | unsigned int | i | ) |
T & ON_ClassArray< T >::operator[] | ( | ON__INT64 | i | ) |
T & ON_ClassArray< T >::operator[] | ( | ON__UINT64 | i | ) |
const T & ON_ClassArray< T >::operator[] | ( | int | i | ) | const |
const T & ON_ClassArray< T >::operator[] | ( | unsigned int | i | ) | const |
const T & ON_ClassArray< T >::operator[] | ( | ON__INT64 | i | ) | const |
const T & ON_ClassArray< T >::operator[] | ( | ON__UINT64 | i | ) | const |
bool ON_ClassArray< T >::Permute | ( | const int * | index | ) |
|
virtual |
Sorts the array using the heap sort algorithm.
Reimplemented in ON_ObjectArray< T >, ON_ObjectArray< ON_Texture >, ON_ObjectArray< ON_BrepTrim >, ON_ObjectArray< ON_BrepFaceSide >, ON_ObjectArray< ON_BrepEdge >, ON_ObjectArray< ON_BrepLoop >, ON_ObjectArray< ON_BrepRegion >, ON_ObjectArray< ON_BrepFace >, and ON_ObjectArray< ON_BrepVertex >.
|
virtual |
low level memory managment ///////////////////////////////////////
Class ON_ClassArray<>
construction ////////////////////////////////////////////////////////
Reimplemented in ON_ObjectArray< T >, ON_ObjectArray< ON_Texture >, ON_ObjectArray< ON_BrepTrim >, ON_ObjectArray< ON_BrepFaceSide >, ON_ObjectArray< ON_BrepEdge >, ON_ObjectArray< ON_BrepLoop >, ON_ObjectArray< ON_BrepRegion >, ON_ObjectArray< ON_BrepFace >, and ON_ObjectArray< ON_BrepVertex >.
void ON_ClassArray< T >::Remove | ( | ) |
void ON_ClassArray< T >::Remove | ( | int | i | ) |
T * ON_ClassArray< T >::Reserve | ( | size_t | newcap | ) |
memory managment /////////////////////////////////////////////////
memory managment ////////////////////////////////////////////////////
void ON_ClassArray< T >::Reverse | ( | ) |
int ON_ClassArray< T >::Search | ( | const T * | key, |
int(*)(const T *, const T *) | compar | ||
) | const |
void ON_ClassArray< T >::SetArray | ( | T * | p | ) |
Do not use this version of SetArray(). Use the one that takes a pointer, count and capacity: SetArray(pointer,count,capacity)
void ON_ClassArray< T >::SetArray | ( | T * | p, |
int | count, | ||
int | capacity | ||
) |
Expert user tool to set the memory used by the dyanmic array.
TODODOC: T* pointer - [in] TODODOC: int count - [in] 0 <= count <= capacity TODODOC: int capacity - [in] TODODOC: m_a is set to pointer, m_count is set to count, and m_capacity TODODOC: is set to capacity. It is critical that the pointer be one TODODOC: returned by onmalloc(sz), where sz >= capacity*sizeof(T[0]), TODODOC: and that the in-place operator new has been used to initialize TODODOC: each element of the array.
T * ON_ClassArray< T >::SetCapacity | ( | size_t | new_capacity | ) |
uses "placement" for class construction/destruction
growing
initialize new elements with default constructor
memory allocation failed
shrinking
memory allocation failed
void ON_ClassArray< T >::SetCount | ( | int | count | ) |
low level memory managment //////////////////////////////////////////
void ON_ClassArray< T >::Shrink | ( | ) |
unsigned int ON_ClassArray< T >::SizeOfArray | ( | ) | const |
unsigned int ON_ClassArray< T >::SizeOfElement | ( | ) | const |
bool ON_ClassArray< T >::Sort | ( | ON::sort_algorithm | sort_algorithm, |
int * | index, | ||
int(*)(const T *, const T *) | compar | ||
) | const |
Sort() fills in the index[] array so that array[index[i]] <= array[index[i+1]]. The array is not modified.
sort_algorithm | [in] ON::sort_algorithm::quick_sort (best in general) or ON::sort_algorithm::heap_sort Use ON::sort_algorithm::heap_sort only if you have done extensive testing with optimized release builds and are confident heap sort is significantly faster. |
index | [out] an array of length Count() that is returned with some permutation of (0,1,...,Count()-1). |
compare | [in] compare function compare(a,b) should return <0 if a<b, 0, if a==b, and >0 if a>b. |
bool ON_ClassArray< T >::Sort | ( | ON::sort_algorithm | sort_algorithm, |
int * | index, | ||
int(*)(const T *, const T *, void *) | compar, | ||
void * | p | ||
) | const |
Sort() fills in the index[] array so that array[index[i]] <= array[index[i+1]]. The array is not modified.
sort_algorithm | [in] ON::sort_algorithm::quick_sort (best in general) or ON::sort_algorithm::heap_sort Use ON::sort_algorithm::heap_sort only if you have done extensive testing with optimized release builds and are confident heap sort is significantly faster. |
index | [out] an array of length Count() that is returned with some permutation of (0,1,...,Count()-1). |
compare | [in] compare function compare(a,b,p) should return <0 if a<b, 0, if a==b, and >0 if a>b. |
p | [in] pointer passed as third argument to compare. |
void ON_ClassArray< T >::Swap | ( | int | i, |
int | j | ||
) |
unsigned int ON_ClassArray< T >::UnsignedCount | ( | ) | const |
void ON_ClassArray< T >::Zero | ( | ) |
|
protected |
|
protected |
|
protected |