#include <opennurbs_array.h>
Public Member Functions | |
ON_SimpleArray () ON_NOEXCEPT | |
construction //////////////////////////////////////////////////////// More... | |
ON_SimpleArray (const ON_SimpleArray< T > &) | |
Copy constructor. More... | |
ON_SimpleArray (size_t) | |
virtual | ~ON_SimpleArray () |
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... | |
ON__UINT32 | DataCRC (ON__UINT32 current_remainder) const |
void | Destroy () |
void | EmergencyDestroy (void) |
emergency bailout /////////////////////////////////////////////////// More... | |
void | Empty () |
T * | First () |
const T * | First () const |
bool | HeapSort (int(*)(const T *, const T *)) |
void | Insert (int, const T &) |
T * | KeepArray () |
Expert user tool to take charge of the memory used by the dyanmic array. More... | |
T * | Last () |
const T * | Last () const |
void | MemSet (unsigned char) |
int | NewCapacity () const |
operator const T * () const | |
operator T* () | |
ON_SimpleArray< T > & | operator= (const ON_SimpleArray< T > &) |
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 *) |
bool | QuickSort (int(*)(const T *, const T *)) |
virtual T * | Realloc (T *, int) |
low level memory managment ////////////////////////////////////////// More... | |
void | Remove () |
virtual void | Remove (int) |
T * | Reserve (size_t) |
memory managment //////////////////////////////////////////////////// More... | |
void | Reverse () |
int | Search (const T &) const |
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. 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 | Move (int, int, int) |
implimentation ////////////////////////////////////////////////////// More... | |
Protected Attributes | |
T * | m_a |
int | m_capacity |
int | m_count |
ON_SimpleArray< T >::ON_SimpleArray | ( | ) |
construction ////////////////////////////////////////////////////////
|
virtual |
ON_SimpleArray< T >::ON_SimpleArray | ( | const ON_SimpleArray< T > & | src | ) |
Copy constructor.
ON_SimpleArray< T >::ON_SimpleArray | ( | size_t | c | ) |
void ON_SimpleArray< T >::Append | ( | const T & | x | ) |
void ON_SimpleArray< T >::Append | ( | int | count, |
const T * | p | ||
) |
T & ON_SimpleArray< T >::AppendNew | ( | ) |
array operations ////////////////////////////////////////////////////
T * ON_SimpleArray< T >::Array | ( | ) |
const T * ON_SimpleArray< T >::Array | ( | ) | const |
T * ON_SimpleArray< T >::At | ( | int | i | ) |
At(index) returns nullptr if index < 0 or index >= count.
T * ON_SimpleArray< T >::At | ( | unsigned int | i | ) |
T * ON_SimpleArray< T >::At | ( | ON__INT64 | i | ) |
T * ON_SimpleArray< T >::At | ( | ON__UINT64 | i | ) |
const T * ON_SimpleArray< T >::At | ( | int | i | ) | const |
const T * ON_SimpleArray< T >::At | ( | unsigned int | i | ) | const |
const T * ON_SimpleArray< T >::At | ( | ON__INT64 | i | ) | const |
const T * ON_SimpleArray< T >::At | ( | ON__UINT64 | i | ) | const |
int ON_SimpleArray< T >::BinarySearch | ( | const T * | key, |
int(*)(const T *, const T *) | compar | ||
) | const |
This worked on a wide range of 32 bit compilers.
Convert "found" pointer to array index.
"key" not found
int ON_SimpleArray< T >::BinarySearch | ( | const T * | key, |
int(*)(const T *, const T *) | compar, | ||
int | count | ||
) | const |
This worked on a wide range of 32 bit compilers.
Convert "found" pointer to array index.
"key" not found
int ON_SimpleArray< T >::Capacity | ( | ) | const |
int ON_SimpleArray< T >::Count | ( | ) | const |
query ///////////////////////////////////////////////////////////////
ON__UINT32 ON_SimpleArray< T >::DataCRC | ( | ON__UINT32 | current_remainder | ) | const |
void ON_SimpleArray< T >::Destroy | ( | ) |
void ON_SimpleArray< T >::EmergencyDestroy | ( | void | ) |
emergency bailout ///////////////////////////////////////////////////
emergency destroy ///////////////////////////////////////////////////
void ON_SimpleArray< T >::Empty | ( | ) |
T * ON_SimpleArray< T >::First | ( | ) |
const T * ON_SimpleArray< T >::First | ( | ) | const |
bool ON_SimpleArray< T >::HeapSort | ( | int(*)(const T *, const T *) | compar | ) |
void ON_SimpleArray< T >::Insert | ( | int | i, |
const T & | x | ||
) |
T * ON_SimpleArray< T >::KeepArray | ( | ) |
Expert user tool to take charge of the memory used by the dyanmic array.
T * ON_SimpleArray< T >::Last | ( | ) |
const T * ON_SimpleArray< T >::Last | ( | ) | const |
void ON_SimpleArray< T >::MemSet | ( | unsigned char | value | ) |
|
protected |
implimentation //////////////////////////////////////////////////////
array operations ////////////////////////////////////////////////////
int ON_SimpleArray< T >::NewCapacity | ( | ) | const |
cap_size = 128 MB on 32-bit os, 256 MB on 64 bit os
ON_SimpleArray< T >::operator const T * | ( | ) | const |
ON_SimpleArray< T >::operator T* | ( | ) |
ON_SimpleArray< T > & ON_SimpleArray< T >::operator= | ( | const ON_SimpleArray< T > & | src | ) |
T & ON_SimpleArray< T >::operator[] | ( | int | i | ) |
T & ON_SimpleArray< T >::operator[] | ( | unsigned int | i | ) |
T & ON_SimpleArray< T >::operator[] | ( | ON__INT64 | i | ) |
T & ON_SimpleArray< T >::operator[] | ( | ON__UINT64 | i | ) |
const T & ON_SimpleArray< T >::operator[] | ( | int | i | ) | const |
const T & ON_SimpleArray< T >::operator[] | ( | unsigned int | i | ) | const |
const T & ON_SimpleArray< T >::operator[] | ( | ON__INT64 | i | ) | const |
const T & ON_SimpleArray< T >::operator[] | ( | ON__UINT64 | i | ) | const |
bool ON_SimpleArray< T >::Permute | ( | const int * | index | ) |
bool ON_SimpleArray< T >::QuickSort | ( | int(*)(const T *, const T *) | compar | ) |
|
virtual |
low level memory managment //////////////////////////////////////////
Class ON_SimpleArray<>
construction ////////////////////////////////////////////////////////
void ON_SimpleArray< T >::Remove | ( | ) |
|
virtual |
T * ON_SimpleArray< T >::Reserve | ( | size_t | newcap | ) |
memory managment ////////////////////////////////////////////////////
void ON_SimpleArray< T >::Reverse | ( | ) |
int ON_SimpleArray< T >::Search | ( | const T & | key | ) | const |
int ON_SimpleArray< T >::Search | ( | const T * | key, |
int(*)(const T *, const T *) | compar | ||
) | const |
void ON_SimpleArray< T >::SetArray | ( | T * | p | ) |
Do not use this version of SetArray(). Use the one that takes a pointer, count and capacity.
void ON_SimpleArray< 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] 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]).
T * ON_SimpleArray< T >::SetCapacity | ( | size_t | new_capacity | ) |
sets capacity to input value
NOTE: Realloc() does an allocation if the first argument is nullptr.
zero new memory
out of memory
void ON_SimpleArray< T >::SetCount | ( | int | count | ) |
low level memory managment //////////////////////////////////////////
void ON_SimpleArray< T >::Shrink | ( | ) |
unsigned int ON_SimpleArray< T >::SizeOfArray | ( | ) | const |
unsigned int ON_SimpleArray< T >::SizeOfElement | ( | ) | const |
bool ON_SimpleArray< 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,p) should return <0 if a<b, 0, if a==b, and >0 if a>b. |
bool ON_SimpleArray< 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_SimpleArray< T >::Swap | ( | int | i, |
int | j | ||
) |
unsigned int ON_SimpleArray< T >::UnsignedCount | ( | ) | const |
void ON_SimpleArray< T >::Zero | ( | ) |
|
protected |
|
protected |
|
protected |