Rhino C++ API  8.14
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ON_ClassArray< T > Class Template Reference

#include <opennurbs_array.h>

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

Public Member Functions

 ON_ClassArray () ON_NOEXCEPT
 construction //////////////////////////////////////////////////////// More...
 
 ON_ClassArray (const ON_ClassArray< T > &)
 Copy constructor. More...
 
 ON_ClassArray (size_t)
 size_t parameter = initial capacity More...
 
virtual ~ON_ClassArray ()
 override for struct member deallocation, etc. More...
 
void Append (const T &)
 
void Append (int, const T *)
 Append copy of an array T[count]. More...
 
T & AppendNew ()
 array operations //////////////////////////////////////////////////// More...
 
T * Array ()
 The Array() function return the. More...
 
const T * Array () const
 m_a pointer value. More...
 
T * At (int)
 At(index) returns nullptr if index < 0 or index >= count. More...
 
const T * At (int) const
 
T * At (ON__INT64)
 
const T * At (ON__INT64) const
 
T * At (ON__UINT64)
 
const T * At (ON__UINT64) const
 
T * At (unsigned int)
 
const T * At (unsigned int) const
 
int BinarySearch (const T *, int(*)(const T *, const T *)) const
 See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T> More...
 
int BinarySearch (const T *, int(*)(const T *, const T *), int) const
 
int Capacity () const
 capacity of array More...
 
int Count () const
 query /////////////////////////////////////////////////////////////// More...
 
void Destroy ()
 onfree any memory and set count and capacity to zero More...
 
void EmergencyDestroy (void)
 emergency bailout /////////////////////////////////////////////////// More...
 
void Empty ()
 Sets count to 0, leaves capacity untouched. More...
 
T * First ()
 
const T * First () const
 returns nullptr if count = 0 More...
 
virtual bool HeapSort (int(*)(const T *, const T *))
 QuickSort() is generally the better choice. More...
 
void Insert (int, const T &)
 Insert called with a reference uses operator =. More...
 
int InsertInSortedList (const T &, int(*)(const T *, const T *))
 
int InsertInSortedList (const T &, int(*)(const T *, const T *), int)
 
T * KeepArray ()
 
T * Last ()
 
const T * Last () const
 returns nullptr if count = 0 More...
 
int NewCapacity () const
 
 operator const T * () const
 
 operator T* ()
 The cast operators return a pointer. More...
 
ON_ClassArray< T > & operator= (const ON_ClassArray< T > &)
 Assignment operator. More...
 
T & operator[] (int)
 
const T & operator[] (int) const
 
T & operator[] (ON__INT64)
 
const T & operator[] (ON__INT64) const
 
T & operator[] (ON__UINT64)
 
const T & operator[] (ON__UINT64) const
 
T & operator[] (unsigned int)
 
const T & operator[] (unsigned int) 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 management /////////////////////////////////////// More...
 
void Remove ()
 
void Remove (int)
 
T * Reserve (size_t)
 memory management ///////////////////////////////////////////////// More...
 
void Reverse ()
 reverse order More...
 
int Search (const T *, int(*)(const T *, const T *)) const
 
void SetArray (T *)
 
void SetArray (T *, int, int)
 
T * SetCapacity (size_t)
 
void SetCount (int)
 low level memory management ////////////////////////////////////////// More...
 
void Shrink ()
 remove unused capacity More...
 
unsigned int SizeOfArray () const
 amount of memory in the m_a[] array More...
 
unsigned int SizeOfElement () const
 amount of memory in an m_a[] array element More...
 
bool Sort (ON::sort_algorithm sort_algorithm, int *, int(*)(const T *, const T *)) const
 
bool Sort (ON::sort_algorithm sort_algorithm, int *, int(*)(const T *, const T *, void *), void *) const
 
void Swap (int, int)
 swap elements i and j More...
 
unsigned int UnsignedCount () const
 
void Zero ()
 

Protected Member Functions

void ConstructDefaultElement (T *)
 
void DestroyElement (T &)
 
void Move (int, int, int)
 implementation ////////////////////////////////////////////////////// More...
 

Protected Attributes

T * m_a
 pointer to array memory More...
 
int m_capacity
 actual length of m_a[] More...
 
int m_count
 0 <= m_count <= m_capacity More...
 

Detailed Description

template<class T>
class ON_ClassArray< T >

The ON_ClassArray<> template is designed to be used with classes that require non-trivial construction or destruction. Any class used with the ON_ClassArray<> template must have a robust operator=().

By default, ON_ClassArray<> uses onrealloc() to manage the dynamic array memory. If you want to use something besides onrealloc() to manage the array memory, then override ON_ClassArray::Realloc(). In practice this means that if your class has members with back-pointers, then you cannot use it in the default ON_ClassArray. See ON_ObjectArray for an example.

Member Function Documentation

◆ Array()

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

m_a pointer value.

◆ First()

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

returns nullptr if count = 0

◆ Last()

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

returns nullptr if count = 0

Member Data Documentation

◆ m_a

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

pointer to array memory

◆ m_capacity

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

actual length of m_a[]

◆ m_count

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

0 <= m_count <= m_capacity