#include <opennurbs_array.h>

Inheritance diagram for ON_ClassArray< T >:
ON_ObjectArray< T >

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
 

Constructor & Destructor Documentation

◆ ON_ClassArray() [1/3]

template<class T >
ON_ClassArray< T >::ON_ClassArray ( )

construction ////////////////////////////////////////////////////////

◆ ON_ClassArray() [2/3]

template<class T >
ON_ClassArray< T >::ON_ClassArray ( size_t  c)

◆ ON_ClassArray() [3/3]

template<class T>
ON_ClassArray< T >::ON_ClassArray ( const ON_ClassArray< T > &  src)

Copy constructor.

◆ ~ON_ClassArray()

template<class T >
ON_ClassArray< T >::~ON_ClassArray ( )
virtual

Member Function Documentation

◆ Append() [1/2]

template<class T>
void ON_ClassArray< T >::Append ( const T &  x)

◆ Append() [2/2]

template<class T>
void ON_ClassArray< T >::Append ( int  count,
const T *  p 
)

◆ AppendNew()

template<class T >
T & ON_ClassArray< T >::AppendNew ( )

array operations ////////////////////////////////////////////////////

First destroy what's there ..

and then get a properly initialized element

◆ Array() [1/2]

template<class T >
T * ON_ClassArray< T >::Array ( )

◆ Array() [2/2]

template<class T >
const T * ON_ClassArray< T >::Array ( ) const

◆ At() [1/8]

template<class T >
T * ON_ClassArray< T >::At ( int  i)

At(index) returns nullptr if index < 0 or index >= count.

◆ At() [2/8]

template<class T >
T * ON_ClassArray< T >::At ( unsigned int  i)

◆ At() [3/8]

template<class T >
T * ON_ClassArray< T >::At ( ON__INT64  i)

◆ At() [4/8]

template<class T >
T * ON_ClassArray< T >::At ( ON__UINT64  i)

◆ At() [5/8]

template<class T >
const T * ON_ClassArray< T >::At ( int  i) const

◆ At() [6/8]

template<class T >
const T * ON_ClassArray< T >::At ( unsigned int  i) const

◆ At() [7/8]

template<class T >
const T * ON_ClassArray< T >::At ( ON__INT64  i) const

◆ At() [8/8]

template<class T >
const T * ON_ClassArray< T >::At ( ON__UINT64  i) const

◆ BinarySearch() [1/2]

template<class T>
int ON_ClassArray< T >::BinarySearch ( const T *  key,
int(*)(const T *, const T *)  compar 
) const

◆ BinarySearch() [2/2]

template<class T>
int ON_ClassArray< T >::BinarySearch ( const T *  key,
int(*)(const T *, const T *)  compar,
int  count 
) const

◆ Capacity()

template<class T >
int ON_ClassArray< T >::Capacity ( ) const

◆ ConstructDefaultElement()

template<class T>
void ON_ClassArray< T >::ConstructDefaultElement ( T *  p)
protected

◆ Count()

template<class T >
int ON_ClassArray< T >::Count ( ) const

query ///////////////////////////////////////////////////////////////

◆ Destroy()

template<class T >
void ON_ClassArray< T >::Destroy ( )

◆ DestroyElement()

template<class T>
void ON_ClassArray< T >::DestroyElement ( T &  x)
protected

◆ EmergencyDestroy()

template<class T >
void ON_ClassArray< T >::EmergencyDestroy ( void  )

emergency bailout ///////////////////////////////////////////////////

emergency destroy ///////////////////////////////////////////////////

◆ Empty()

template<class T >
void ON_ClassArray< T >::Empty ( )

◆ First() [1/2]

template<class T >
T * ON_ClassArray< T >::First ( )

◆ First() [2/2]

template<class T >
const T * ON_ClassArray< T >::First ( ) const

◆ HeapSort()

◆ Insert()

template<class T>
void ON_ClassArray< T >::Insert ( int  i,
const T &  x 
)

Insert called with a reference uses operator =.

◆ KeepArray()

template<class T >
T * ON_ClassArray< T >::KeepArray ( )

◆ Last() [1/2]

template<class T >
T * ON_ClassArray< T >::Last ( )

◆ Last() [2/2]

template<class T >
const T * ON_ClassArray< T >::Last ( ) const

◆ Move()

template<class T >
void ON_ClassArray< T >::Move ( int  dest_i,
int  src_i,
int  ele_cnt 
)
protected

implimentation //////////////////////////////////////////////////////

array operations ////////////////////////////////////////////////////

◆ NewCapacity()

template<class T >
int ON_ClassArray< T >::NewCapacity ( ) const

cap_size = 128 MB on 32-bit os, 256 MB on 64 bit os

◆ operator const T *()

template<class T >
ON_ClassArray< T >::operator const T * ( ) const

◆ operator T*()

template<class T >
ON_ClassArray< T >::operator T* ( )

◆ operator=()

template<class T>
ON_ClassArray< T > & ON_ClassArray< T >::operator= ( const ON_ClassArray< T > &  src)

Assignment operator.

◆ operator[]() [1/8]

template<class T >
T & ON_ClassArray< T >::operator[] ( int  i)

◆ operator[]() [2/8]

template<class T >
T & ON_ClassArray< T >::operator[] ( unsigned int  i)

◆ operator[]() [3/8]

template<class T >
T & ON_ClassArray< T >::operator[] ( ON__INT64  i)

◆ operator[]() [4/8]

template<class T >
T & ON_ClassArray< T >::operator[] ( ON__UINT64  i)

◆ operator[]() [5/8]

template<class T >
const T & ON_ClassArray< T >::operator[] ( int  i) const

◆ operator[]() [6/8]

template<class T >
const T & ON_ClassArray< T >::operator[] ( unsigned int  i) const

◆ operator[]() [7/8]

template<class T >
const T & ON_ClassArray< T >::operator[] ( ON__INT64  i) const

◆ operator[]() [8/8]

template<class T >
const T & ON_ClassArray< T >::operator[] ( ON__UINT64  i) const

◆ Permute()

template<class T >
bool ON_ClassArray< T >::Permute ( const int *  index)

◆ QuickSort()

◆ Realloc()

template<class T>
T * ON_ClassArray< T >::Realloc ( T *  ptr,
int  capacity 
)
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 >.

◆ Remove() [1/2]

template<class T >
void ON_ClassArray< T >::Remove ( )

◆ Remove() [2/2]

template<class T >
void ON_ClassArray< T >::Remove ( int  i)

◆ Reserve()

template<class T >
T * ON_ClassArray< T >::Reserve ( size_t  newcap)

memory managment /////////////////////////////////////////////////

memory managment ////////////////////////////////////////////////////

◆ Reverse()

template<class T >
void ON_ClassArray< T >::Reverse ( )

◆ Search()

template<class T>
int ON_ClassArray< T >::Search ( const T *  key,
int(*)(const T *, const T *)  compar 
) const

◆ SetArray() [1/2]

template<class T>
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)

◆ SetArray() [2/2]

template<class T>
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.

◆ SetCapacity()

template<class T >
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

◆ SetCount()

template<class T >
void ON_ClassArray< T >::SetCount ( int  count)

low level memory managment //////////////////////////////////////////

◆ Shrink()

template<class T >
void ON_ClassArray< T >::Shrink ( )

◆ SizeOfArray()

template<class T >
unsigned int ON_ClassArray< T >::SizeOfArray ( ) const

◆ SizeOfElement()

template<class T >
unsigned int ON_ClassArray< T >::SizeOfElement ( ) const

◆ Sort() [1/2]

template<class T>
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.

Parameters
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.
Returns
true if successful

◆ Sort() [2/2]

template<class T>
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.

Parameters
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.
Returns
true if successful

◆ Swap()

template<class T >
void ON_ClassArray< T >::Swap ( int  i,
int  j 
)

◆ UnsignedCount()

template<class T >
unsigned int ON_ClassArray< T >::UnsignedCount ( ) const

◆ Zero()

template<class T >
void ON_ClassArray< T >::Zero ( )

Member Data Documentation

◆ m_a

template<class T>
T* ON_ClassArray< T >::m_a
protected

◆ m_capacity

template<class T>
int ON_ClassArray< T >::m_capacity
protected

◆ m_count

template<class T>
int ON_ClassArray< T >::m_count
protected