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

#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)
 size_t parameter = initial capacity More...
 
virtual ~ON_SimpleArray ()
 
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
 
const T * BinarySearchPtr (const T *, int(*)(const T *, const T *)) const
 
const T * BinarySearchPtr (const T *, int(*)(const T *, const T *), int) const
 
int Capacity () const
 capacity of array More...
 
int Count () const
 query /////////////////////////////////////////////////////////////// More...
 
ON__UINT32 DataCRC (ON__UINT32 current_remainder) const
 
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...
 
bool HeapSort (int(*)(const T *, const T *))
 
void Insert (int, const T &)
 
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...
 
void MemSet (unsigned char)
 
int NewCapacity () const
 
 operator const T * () const
 
 operator T* ()
 The cast operators return a pointer. More...
 
ON_SimpleArray< T > & operator= (const ON_SimpleArray< T > &)
 
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 *)
 
void Prepend (int, const T *)
 Prepend copy of an array T[count]. More...
 
bool QuickSort (int(*)(const T *, const T *))
 See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T> More...
 
bool QuickSortAndRemoveDuplicates (int(*)(const T *, const T *))
 See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T> More...
 
virtual T * Realloc (T *, int)
 low level memory management ////////////////////////////////////////// More...
 
void Remove ()
 
virtual void Remove (int)
 
void RemoveIf (bool predicate(const T &key))
 
void RemoveValue (const T &)
 
T * Reserve (size_t)
 memory management //////////////////////////////////////////////////// More...
 
void Reverse ()
 reverse order More...
 
int Search (const T &) const
 
int Search (const T *, int(*)(const T *, const T *)) const
 See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T> More...
 
void SetArray (T *)
 
void SetArray (T *, int, int)
 
T * SetCapacity (size_t)
 
void SetCount (int)
 low level memory management ////////////////////////////////////////// More...
 
void SetRange (int from, int count, T)
 
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 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_SimpleArray< T >

Copyright (c) 1993-2022 Robert McNeel & Associates. All rights reserved. OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert McNeel & Associates.

THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF MERCHANTABILITY ARE HEREBY DISCLAIMED.

For complete openNURBS copyright information see http://www.opennurbs.org. The ON_SimpleArray<> template is more efficient than the ON_ClassArray<> template, but ON_SimpleArray<> should not be used for arrays of classes that require explicit construction, destruction, or copy operators.

Elements returned by AppendNew() are memset to zero.

By default, ON_SimpleArray<> uses onrealloc() to manage the dynamic array memory. If you want to use something besides onrealloc() to manage the array memory, then override ON_SimpleArray::Realloc().

Member Function Documentation

◆ Array()

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

m_a pointer value.

◆ First()

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

returns nullptr if count = 0

◆ Last()

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

returns nullptr if count = 0

Member Data Documentation

◆ m_a

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

pointer to array memory

◆ m_capacity

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

actual length of m_a[]

◆ m_count

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

0 <= m_count <= m_capacity