17 #if !defined(ON_ARRAY_DEFS_INC_) 18 #define ON_ARRAY_DEFS_INC_ 22 #pragma ON_PRAGMA_WARNING_PUSH 30 #pragma ON_PRAGMA_WARNING_DISABLE_MSC(4100) 37 #pragma ON_PRAGMA_WARNING_DISABLE_MSC(4211) 59 return (T*)onrealloc(ptr,capacity*
sizeof(T));
103 if ( m_capacity < src.
m_count ) {
108 memcpy( (
void*)(m_a), (
void*)(src.
m_a), m_count*
sizeof(T) );
115 #if defined(ON_HAS_RVALUEREF) 121 , m_count(src.m_count)
122 , m_capacity(src.m_capacity)
137 m_count = src.m_count;
138 m_capacity = src.m_capacity;
169 return ((
unsigned int)m_count);
181 return ((
unsigned int)(m_capacity*
sizeof(T)));
187 return ((
unsigned int)(
sizeof(T)));
194 return ON_CRC32(current_remainder,m_count*
sizeof(m_a[0]),m_a);
200 #if defined(ON_DEBUG) 201 if ( i < 0 || i > m_capacity )
203 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
212 #if defined(ON_DEBUG) 213 if ( i > (
unsigned int)m_capacity )
215 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
225 #if defined(ON_DEBUG) 226 if ( i < 0 || i > (ON__INT64)m_capacity )
228 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
237 #if defined(ON_DEBUG) 238 if ( i > (ON__UINT64)m_capacity )
240 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
247 #if defined(ON_RUNTIME_APPLE) 251 #if defined(ON_DEBUG) 252 if ( i > (
size_t)m_capacity )
254 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
264 #if defined(ON_DEBUG) 265 if ( i < 0 || i > m_capacity )
267 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
276 #if defined(ON_DEBUG) 277 if ( i > (
unsigned int)m_capacity )
279 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
289 #if defined(ON_DEBUG) 290 if ( i < 0 || i > ((ON__INT64)m_capacity) )
292 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
301 #if defined(ON_DEBUG) 302 if ( i > (ON__UINT64)m_capacity )
304 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
310 #if defined(ON_RUNTIME_APPLE) 314 #if defined(ON_DEBUG) 315 if ( i > (
size_t)m_capacity )
317 ON_ERROR(
"ON_SimpleArray[i]: i out of range.");
327 return (m_count > 0) ? m_a : 0;
333 return (m_count > 0) ? m_a : 0;
361 if ( m_a && m_a != p )
369 if ( m_a && m_a != p )
373 m_capacity = capacity;
379 return (m_count > 0) ? m_a : 0;
385 return (m_count > 0) ? m_a : 0;
391 return (i >= 0 && i < m_count) ? m_a+i : 0;
397 return (i < (
unsigned int)m_count) ? m_a+i : 0;
403 return (i >= 0 && i < m_count) ? m_a+i : 0;
409 return (i < (
unsigned int)m_count) ? m_a+i : 0;
415 return (i >= 0 && i < (ON__INT64)m_count) ? m_a+i : 0;
421 return (i < (ON__UINT64)m_count) ? m_a+i : 0;
427 return (i >= 0 && i < (ON__INT64)m_count) ? m_a+i : 0;
433 return (i < (ON__UINT64)m_count) ? m_a+i : 0;
439 return (m_count > 0) ? m_a+(m_count-1) : 0;
445 return (m_count > 0) ? m_a+(m_count-1) : 0;
455 if ( ele_cnt <= 0 || src_i < 0 || dest_i < 0 || src_i == dest_i ||
456 src_i + ele_cnt > m_count || dest_i > m_count )
459 int capacity = dest_i + ele_cnt;
460 if ( capacity > m_capacity ) {
461 if ( capacity < 2*m_capacity )
462 capacity = 2*m_capacity;
463 SetCapacity( capacity );
466 memmove( &m_a[dest_i], &m_a[src_i], ele_cnt*
sizeof(T) );
472 if ( m_count == m_capacity )
474 int new_capacity = NewCapacity();
475 Reserve( new_capacity );
477 memset( (
void*)(&m_a[m_count]), 0,
sizeof(T) );
478 return m_a[m_count++];
484 if ( m_count == m_capacity )
486 const int newcapacity = NewCapacity();
489 const int s = (int)(&x - m_a);
490 if ( s >= 0 && s < m_capacity )
498 Reserve( newcapacity );
499 m_a[m_count++] = temp;
503 Reserve(newcapacity);
511 if ( count > 0 && p )
513 if ( count + m_count > m_capacity )
515 int newcapacity = NewCapacity();
516 if ( newcapacity < count + m_count )
517 newcapacity = count + m_count;
518 Reserve( newcapacity );
520 memcpy( (
void*)(m_a + m_count), (
void*)(p), count*
sizeof(T) );
528 if( i >= 0 && i <= m_count )
530 if ( m_count == m_capacity )
532 int newcapacity = NewCapacity();
533 Reserve( newcapacity );
536 Move( i+1, i, m_count-1-i );
550 if ( i >= 0 && i < m_count ) {
551 Move( i, i+1, m_count-1-i );
553 memset( (
void*)(&m_a[m_count]), 0,
sizeof(T) );
561 memset( (
void*)(m_a), 0, m_capacity*
sizeof(T) );
574 for ( ; i < j; i++, j-- ) {
595 for (
int i = 0; i < m_count; i++ ) {
596 if (!memcmp(p,m_a+i,
sizeof(T)))
605 for (
int i = 0; i < m_count; i++ ) {
606 if (!compar(key,m_a+i))
615 const T* found = (key&&m_a&&m_count>0)
616 ? (
const T*)bsearch( key, m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar )
626 #if defined(ON_COMPILER_MSC1300) 627 rc = ((int)(found - m_a));
628 #elif 8 == ON_SIZEOF_POINTER 632 const ON__UINT64 fptr = (ON__UINT64)found;
633 const ON__UINT64 aptr = (ON__UINT64)m_a;
634 const ON__UINT64 sz = (ON__UINT64)
sizeof(T);
635 const ON__UINT64 i = (fptr - aptr)/sz;
641 const ON__UINT32 fptr = (ON__UINT32)found;
642 const ON__UINT32 aptr = (ON__UINT32)m_a;
643 const ON__UINT32 sz = (ON__UINT32)
sizeof(T);
644 const ON__UINT32 i = (fptr - aptr)/sz;
661 if ( count > m_count )
665 const T* found = (key&&m_a&&m_count>0)
666 ? (
const T*)bsearch( key, m_a, count,
sizeof(T), (
int(*)(
const void*,
const void*))compar )
676 #if defined(ON_COMPILER_MSC1300) 677 rc = ((int)(found - m_a));
678 #elif 8 == ON_SIZEOF_POINTER 682 const ON__UINT64 fptr = (ON__UINT64)found;
683 const ON__UINT64 aptr = (ON__UINT64)m_a;
684 const ON__UINT64 sz = (ON__UINT64)
sizeof(T);
685 const ON__UINT64 i = (fptr - aptr)/sz;
691 const ON__UINT32 fptr = (ON__UINT32)found;
692 const ON__UINT32 aptr = (ON__UINT32)m_a;
693 const ON__UINT32 sz = (ON__UINT32)
sizeof(T);
694 const ON__UINT32 i = (fptr - aptr)/sz;
712 if ( m_a && m_count > 0 && compar ) {
714 ON_hsort( m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar );
724 if ( m_a && m_count > 0 && compar ) {
726 ON_qsort( m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar );
736 if ( m_a && m_count > 0 && compar && index ) {
738 ON_Sort(sa, index, m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar );
739 else if ( m_count == 1 )
750 if ( m_a && m_count > 0 && compar && index ) {
752 ON_Sort(sa, index, m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*,
void*))compar, p );
753 else if ( m_count == 1 )
764 if ( m_a && m_count > 0 && index ) {
766 T* buffer = (T*)onmalloc(m_count*
sizeof(buffer[0]));
767 memcpy( (
void*)(buffer), (
void*)(m_a), m_count*
sizeof(T) );
768 for (i = 0; i < m_count; i++ )
769 memcpy( (
void*)(m_a+i), (
void*)(buffer+index[i]),
sizeof(T) );
779 if ( m_a && m_capacity > 0 ) {
780 memset( (
void*)(m_a), 0, m_capacity*
sizeof(T) );
787 if ( m_a && m_capacity > 0 ) {
788 memset( (
void*)(m_a), value, m_capacity*
sizeof(T) );
797 if( (
size_t)m_capacity < newcap )
798 SetCapacity( newcap );
805 SetCapacity( m_count );
819 if ( count >= 0 && count <= m_capacity )
835 int capacity = (new_capacity > 0 && new_capacity < ON_UNSET_UINT_INDEX)
838 if ( capacity != m_capacity ) {
840 if ( m_count > capacity )
843 m_a = Realloc( m_a, capacity );
845 if ( capacity > m_capacity ) {
847 memset( (
void*) (m_a + m_capacity), 0, (capacity-m_capacity)*
sizeof(T) );
849 m_capacity = capacity;
853 m_count = m_capacity = 0;
859 m_count = m_capacity = 0;
885 const size_t cap_size = 32*
sizeof(
void*)*1024*1024;
886 if (m_count*
sizeof(T) <= cap_size || m_count < 8)
887 return ((m_count <= 2) ? 4 : 2*m_count);
891 int delta_count = 8 + cap_size/
sizeof(T);
892 if ( delta_count > m_count )
893 delta_count = m_count;
894 return (m_count + delta_count);
917 const size_t cap_size = 32*
sizeof(
void*)*1024*1024;
918 if (m_count*
sizeof(T) <= cap_size || m_count < 8)
919 return ((m_count <= 2) ? 4 : 2*m_count);
923 int delta_count = 8 + cap_size/
sizeof(T);
924 if ( delta_count > m_count )
925 delta_count = m_count;
926 return (m_count + delta_count);
958 #if defined(ON_HAS_RVALUEREF) 974 m_count = src.m_count;
975 m_capacity = src.m_capacity;
994 T* reptr = (T*)onrealloc(ptr,capacity*
sizeof(T));
995 if ( ptr && reptr && reptr != ptr )
1000 for ( i = 0; i < this->m_count; i++ )
1002 reptr[i].MemoryRelocate();
1018 return (T*)onrealloc(ptr,capacity*
sizeof(T));
1027 for ( i = 0; i < this->m_count; i++ )
1029 current_remainder = this->m_a[i].DataCRC(current_remainder);
1031 return current_remainder;
1071 if(
this != &src ) {
1076 if ( m_capacity < src.
m_count ) {
1081 for ( i = 0; i < m_count; i++ ) {
1082 m_a[i] = src.
m_a[i];
1090 #if defined(ON_HAS_RVALUEREF) 1096 , m_count(src.m_count)
1097 , m_capacity(src.m_capacity)
1112 m_count = src.m_count;
1113 m_capacity = src.m_capacity;
1144 return ((
unsigned int)m_count);
1156 return ((
unsigned int)(m_capacity*
sizeof(T)));
1162 return ((
unsigned int)(
sizeof(T)));
1168 #if defined(ON_DEBUG) 1169 if ( i < 0 || i > m_capacity )
1171 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1181 #if defined(ON_DEBUG) 1182 if ( i < 0 || i > (ON__INT64)m_capacity )
1184 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1193 #if defined(ON_DEBUG) 1194 if ( i > (
unsigned int)m_capacity )
1196 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1205 #if defined(ON_DEBUG) 1206 if ( i > (ON__UINT64)m_capacity )
1208 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1214 #if defined(ON_RUNTIME_APPLE) 1218 #if defined(ON_DEBUG) 1219 if ( i > (
size_t)m_capacity )
1221 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1231 #if defined(ON_DEBUG) 1232 if ( i < 0 || i > m_capacity )
1234 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1243 #if defined(ON_DEBUG) 1244 if ( i < 0 || i > (ON__INT64)m_capacity )
1246 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1255 #if defined(ON_DEBUG) 1256 if ( i > (
unsigned int)m_capacity )
1258 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1267 #if defined(ON_DEBUG) 1268 if ( i > (ON__UINT64)m_capacity )
1270 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1276 #if defined(ON_RUNTIME_APPLE) 1280 #if defined(ON_DEBUG) 1281 if ( i > (
size_t)m_capacity )
1283 ON_ERROR(
"ON_ClassArray[i]: i out of range.");
1293 return (m_count > 0) ? m_a : 0;
1299 return (m_count > 0) ? m_a : 0;
1327 if ( m_a && m_a != p )
1335 if ( m_a && m_a != p )
1339 m_capacity = capacity;
1345 return (m_count > 0) ? m_a : 0;
1351 return (m_count > 0) ? m_a : 0;
1357 return (i >= 0 && i < m_count) ? m_a+i : 0;
1363 return (i < (
unsigned int)m_count) ? m_a+i : 0;
1369 return (i >= 0 && i < m_count) ? m_a+i : 0;
1375 return (i < (
unsigned int)m_count) ? m_a+i : 0;
1382 return (i >= 0 && i < (ON__INT64)m_count) ? m_a+i : 0;
1388 return (i < (ON__UINT64)m_count) ? m_a+i : 0;
1394 return (i >= 0 && i < (ON__INT64)m_count) ? m_a+i : 0;
1400 return (i < (ON__UINT64)m_count) ? m_a+i : 0;
1407 return (m_count > 0) ? m_a+(m_count-1) : 0;
1413 return (m_count > 0) ? m_a+(m_count-1) : 0;
1424 if ( ele_cnt <= 0 || src_i < 0 || dest_i < 0 || src_i == dest_i ||
1425 src_i + ele_cnt > m_count || dest_i > m_count )
1428 int capacity = dest_i + ele_cnt;
1429 if ( capacity > m_capacity ) {
1430 if ( capacity < 2*m_capacity )
1431 capacity = 2*m_capacity;
1432 SetCapacity( capacity );
1439 memmove( (
void*)(&m_a[dest_i]), (
const void*)(&m_a[src_i]), ele_cnt*
sizeof(T) );
1459 if ( m_count == m_capacity )
1461 int newcapacity = NewCapacity();
1462 Reserve( newcapacity );
1467 DestroyElement(m_a[m_count]);
1469 ConstructDefaultElement(&m_a[m_count]);
1471 return m_a[m_count++];
1477 if ( m_count == m_capacity )
1479 const int newcapacity = NewCapacity();
1482 const int s = (int)(&x - m_a);
1483 if ( s >= 0 && s < m_capacity )
1491 Reserve( newcapacity );
1492 m_a[m_count++] = temp;
1496 Reserve(newcapacity);
1505 if ( count > 0 && p )
1507 if ( count + m_count > m_capacity )
1509 int newcapacity = NewCapacity();
1510 if ( newcapacity < count + m_count )
1511 newcapacity = count + m_count;
1512 Reserve( newcapacity );
1514 for ( i = 0; i < count; i++ ) {
1515 m_a[m_count++] = p[i];
1524 if( i >= 0 && i <= m_count )
1526 if ( m_count == m_capacity )
1528 int newcapacity = NewCapacity();
1529 Reserve( newcapacity );
1531 DestroyElement( m_a[m_count] );
1533 if ( i < m_count-1 ) {
1534 Move( i+1, i, m_count-1-i );
1537 memset( (
void*)(&m_a[i]), 0,
sizeof(T) );
1538 ConstructDefaultElement( &m_a[i] );
1541 ConstructDefaultElement( &m_a[m_count-1] );
1556 if ( i >= 0 && i < m_count )
1558 DestroyElement( m_a[i] );
1561 memset( (
void*)(&m_a[i]), 0,
sizeof(T) );
1562 Move( i, i+1, m_count-1-i );
1565 memset( (
void*)(&m_a[m_count-1]), 0,
sizeof(T) );
1566 ConstructDefaultElement(&m_a[m_count-1]);
1575 for ( i = m_count-1; i >= 0; i-- ) {
1576 DestroyElement( m_a[i] );
1579 memset( (
void*)(&m_a[i]), 0,
sizeof(T) );
1580 ConstructDefaultElement( &m_a[i] );
1594 for ( ; i < j; i++, j-- ) {
1595 memcpy( (
void*)(t), (
void*)(&m_a[i]),
sizeof(T) );
1596 memcpy( (
void*)(&m_a[i]), (
void*)(&m_a[j]),
sizeof(T) );
1597 memcpy( (
void*)(&m_a[j]), (
void*)(t),
sizeof(T) );
1604 if ( i != j && i >= 0 && j >= 0 && i < m_count && j < m_count ) {
1606 memcpy( (
void*)(t), (
void*)(&m_a[i]),
sizeof(T) );
1607 memcpy( (
void*)(&m_a[i]), (
void*)(&m_a[j]),
sizeof(T) );
1608 memcpy( (
void*)(&m_a[j]), (
void*)(t),
sizeof(T) );
1615 for (
int i = 0; i < m_count; i++ )
1617 if (!compar(key,m_a+i))
1626 const T* found = (key&&m_a&&m_count>0) ? (
const T*)bsearch( key, m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar ) :
nullptr;
1627 return (
nullptr != found && found >= m_a) ? ((int)(found - m_a)) : -1;
1633 if ( count > m_count )
1637 const T* found = (key&&m_a&&m_count>0) ? (
const T*)bsearch( key, m_a, count,
sizeof(T), (
int(*)(
const void*,
const void*))compar ) :
nullptr;
1638 return (
nullptr != found && found >= m_a) ? ((int)(found - m_a)) : -1;
1645 if ( m_a && m_count > 0 && compar )
1648 ON_hsort( m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar );
1658 if ( m_a && m_count > 0 && compar )
1661 ON_qsort( m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar );
1675 if ( this->m_a && this->m_count > 0 && compar )
1677 if ( this->m_count > 1 )
1679 ON_hsort( this->m_a, this->m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar );
1684 for ( i = 0; i < this->m_count; i++ )
1686 this->m_a[i].MemoryRelocate();
1700 if ( this->m_a && this->m_count > 0 && compar )
1702 if ( this->m_count > 1 )
1704 ON_qsort( this->m_a, this->m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar );
1709 for ( i = 0; i < this->m_count; i++ )
1711 this->m_a[i].MemoryRelocate();
1724 if ( m_a && m_count > 0 && compar && index )
1727 ON_Sort(sa, index, m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*))compar );
1728 else if ( m_count == 1 )
1739 if ( m_a && m_count > 0 && compar && index )
1742 ON_Sort(sa, index, m_a, m_count,
sizeof(T), (
int(*)(
const void*,
const void*,
void*))compar, p );
1743 else if ( m_count == 1 )
1754 if ( m_a && m_count > 0 && index )
1757 T* buffer = (T*)onmalloc(m_count*
sizeof(buffer[0]));
1758 memcpy( (
void*)(buffer), (
void*)(m_a), m_count*
sizeof(T) );
1759 for (i = 0; i < m_count; i++ )
1760 memcpy( (
void*)(m_a+i), (
void*)(buffer+index[i]),
sizeof(T) );
1771 if ( m_a && m_capacity > 0 ) {
1772 for ( i = m_capacity-1; i >= 0; i-- ) {
1773 DestroyElement(m_a[i]);
1776 memset( (
void*)(&m_a[i]), 0,
sizeof(T) );
1777 ConstructDefaultElement(&m_a[i]);
1787 if( (
size_t)m_capacity < newcap )
1788 SetCapacity( newcap );
1795 SetCapacity( m_count );
1809 if ( count >= 0 && count <= m_capacity )
1816 if (0 == m_capacity)
1825 int capacity = (new_capacity > 0 && new_capacity < ON_UNSET_UINT_INDEX)
1829 if ( capacity <= 0 ) {
1831 for ( i = m_capacity-1; i >= 0; i-- ) {
1832 DestroyElement(m_a[i]);
1840 else if ( m_capacity < capacity ) {
1842 m_a = Realloc( m_a, capacity );
1850 memset( (
void*)(m_a + m_capacity), 0, (capacity-m_capacity)*
sizeof(T) );
1851 for ( i = m_capacity; i < capacity; i++ ) {
1852 ConstructDefaultElement(&m_a[i]);
1854 m_capacity = capacity;
1863 else if ( m_capacity > capacity ) {
1865 for ( i = m_capacity-1; i >= capacity; i-- ) {
1866 DestroyElement(m_a[i]);
1868 if ( m_count > capacity )
1870 m_capacity = capacity;
1871 m_a = Realloc( m_a, capacity );
1887 int ON_CompareIncreasing(
const T* a,
const T* b)
1897 int ON_CompareDecreasing(
const T* a,
const T* b)
1906 #pragma ON_PRAGMA_WARNING_POP void Empty()
Sets count to 0, leaves capacity untouched.
Definition: opennurbs_array_defs.h:558
void EmergencyDestroy(void)
emergency bailout ///////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:1126
int Capacity() const
capacity of array
Definition: opennurbs_array_defs.h:173
virtual ~ON_SimpleArray()
Definition: opennurbs_array_defs.h:90
T & operator[](int)
Definition: opennurbs_array_defs.h:1166
ON_SimpleArray() ON_NOEXCEPT
construction ////////////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:63
T * At(int)
At(index) returns nullptr if index < 0 or index >= count.
Definition: opennurbs_array_defs.h:389
void Zero()
Definition: opennurbs_array_defs.h:777
void Append(const T &)
Definition: opennurbs_array_defs.h:1475
void Empty()
Sets count to 0, leaves capacity untouched.
Definition: opennurbs_array_defs.h:1572
int Count() const
query ///////////////////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:1136
T * Last()
Definition: opennurbs_array_defs.h:1405
T * KeepArray()
Definition: opennurbs_array_defs.h:1315
void Move(int, int, int)
implimentation //////////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:451
int NewCapacity() const
Definition: opennurbs_array_defs.h:898
T * KeepArray()
Definition: opennurbs_array_defs.h:349
T * Last()
Definition: opennurbs_array_defs.h:437
int m_count
0 <= m_count <= m_capacity
Definition: opennurbs_array.h:363
virtual ~ON_ClassArray()
override for struct member deallocation, etc.
Definition: opennurbs_array_defs.h:1062
unsigned int SizeOfArray() const
amount of memory in the m_a[] array
Definition: opennurbs_array_defs.h:1154
ON_ObjectArray()
Class ON_ObjectArray<>
Definition: opennurbs_array_defs.h:934
void SetArray(T *)
Definition: opennurbs_array_defs.h:359
ON_SimpleArray< T > & operator=(const ON_SimpleArray< T > &)
Definition: opennurbs_array_defs.h:96
Definition: opennurbs_array.h:36
void Swap(int, int)
swap elements i and j
Definition: opennurbs_array_defs.h:582
bool Permute(const int *)
Definition: opennurbs_array_defs.h:1751
int Capacity() const
capacity of array
Definition: opennurbs_array_defs.h:1148
void Shrink()
remove unused capacity
Definition: opennurbs_array_defs.h:803
T * SetCapacity(size_t)
Definition: opennurbs_array_defs.h:824
virtual bool QuickSort(int(*)(const T *, const T *))
Sorts the array using the heap sort algorithm.
Definition: opennurbs_array_defs.h:1655
Definition: opennurbs_array.h:732
int BinarySearch(const T *, int(*)(const T *, const T *)) const
See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T>
Definition: opennurbs_array_defs.h:613
void ConstructDefaultElement(T *)
Definition: opennurbs_array_defs.h:1443
T * Reserve(size_t)
memory managment /////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:1785
int BinarySearch(const T *, int(*)(const T *, const T *)) const
See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T>
Definition: opennurbs_array_defs.h:1624
int Search(const T &) const
Definition: opennurbs_array_defs.h:592
virtual T * Realloc(T *, int)
low level memory managment //////////////////////////////////////////
Definition: opennurbs_array_defs.h:57
void Move(int, int, int)
implimentation //////////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:1419
bool Sort(ON::sort_algorithm sort_algorithm, int *, int(*)(const T *, const T *)) const
Definition: opennurbs_array_defs.h:1721
T * Realloc(T *, int)
Definition: opennurbs_array_defs.h:992
T * m_a
pointer to array memory
Definition: opennurbs_array.h:362
virtual bool HeapSort(int(*)(const T *, const T *))
QuickSort() is generally the better choice.
Definition: opennurbs_array_defs.h:1642
void Insert(int, const T &)
Insert called with a reference uses operator =.
Definition: opennurbs_array_defs.h:1522
void MemSet(unsigned char)
Definition: opennurbs_array_defs.h:785
ON__UINT32 DataCRC(ON__UINT32 current_remainder) const
Definition: opennurbs_array_defs.h:1022
bool QuickSort(int(*)(const T *, const T *))
See Also: ON_CompareIncreasing<T> and ON_CompareDeccreasing<T>
Definition: opennurbs_array_defs.h:721
void Insert(int, const T &)
Definition: opennurbs_array_defs.h:526
void SetCount(int)
low level memory managment //////////////////////////////////////////
Definition: opennurbs_array_defs.h:1807
bool QuickSort(int(*)(const T *, const T *))
Definition: opennurbs_array_defs.h:1695
bool HeapSort(int(*)(const T *, const T *))
Definition: opennurbs_array_defs.h:1670
T * First()
Definition: opennurbs_array_defs.h:1343
ON_ClassArray< T > & operator=(const ON_ClassArray< T > &)
Assignment operator.
Definition: opennurbs_array_defs.h:1068
void Remove()
Definition: opennurbs_array_defs.h:1548
bool Permute(const int *)
Definition: opennurbs_array_defs.h:761
unsigned int UnsignedCount() const
Definition: opennurbs_array_defs.h:167
void Shrink()
remove unused capacity
Definition: opennurbs_array_defs.h:1793
void Append(const T &)
Definition: opennurbs_array_defs.h:482
T * Reserve(size_t)
memory managment ////////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:795
bool Sort(ON::sort_algorithm sort_algorithm, int *, int(*)(const T *, const T *)) const
Definition: opennurbs_array_defs.h:733
int m_count
0 <= m_count <= m_capacity
Definition: opennurbs_array.h:713
void Swap(int, int)
swap elements i and j
Definition: opennurbs_array_defs.h:1602
ON__UINT32 DataCRC(ON__UINT32 current_remainder) const
Definition: opennurbs_array_defs.h:192
virtual T * Realloc(T *, int)
low level memory managment ///////////////////////////////////////
Definition: opennurbs_array_defs.h:1016
T * m_a
pointer to array memory
Definition: opennurbs_array.h:712
void Zero()
Definition: opennurbs_array_defs.h:1768
unsigned int SizeOfElement() const
amount of memory in an m_a[] array element
Definition: opennurbs_array_defs.h:185
T & operator[](int)
Definition: opennurbs_array_defs.h:198
T & AppendNew()
array operations ////////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:1457
void Destroy()
onfree any memory and set count and capacity to zero
Definition: opennurbs_array_defs.h:1799
void SetArray(T *)
Definition: opennurbs_array_defs.h:1325
~ON_ObjectArray()
override for struct member deallocation, etc.
Definition: opennurbs_array_defs.h:939
void Reverse()
reverse order
Definition: opennurbs_array_defs.h:566
unsigned int SizeOfArray() const
amount of memory in the m_a[] array
Definition: opennurbs_array_defs.h:179
unsigned int SizeOfElement() const
amount of memory in an m_a[] array element
Definition: opennurbs_array_defs.h:1160
ON_ObjectArray< T > & operator=(const ON_ObjectArray< T > &)
Definition: opennurbs_array_defs.h:949
Definition: opennurbs_array.h:412
void SetCount(int)
low level memory managment //////////////////////////////////////////
Definition: opennurbs_array_defs.h:817
void Reverse()
reverse order
Definition: opennurbs_array_defs.h:1586
ON_ClassArray() ON_NOEXCEPT
construction ////////////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:1035
T * SetCapacity(size_t)
Definition: opennurbs_array_defs.h:1814
T * First()
Definition: opennurbs_array_defs.h:377
void EmergencyDestroy(void)
emergency bailout ///////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:151
T * At(int)
At(index) returns nullptr if index < 0 or index >= count.
Definition: opennurbs_array_defs.h:1355
T * Array()
The Array() function return the.
Definition: opennurbs_array_defs.h:1303
int NewCapacity() const
Definition: opennurbs_array_defs.h:866
bool HeapSort(int(*)(const T *, const T *))
Definition: opennurbs_array_defs.h:709
void DestroyElement(T &)
Definition: opennurbs_array_defs.h:1451
int Count() const
query ///////////////////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:161
T * Array()
The Array() function return the.
Definition: opennurbs_array_defs.h:337
int Search(const T *, int(*)(const T *, const T *)) const
Definition: opennurbs_array_defs.h:1613
void Remove()
Definition: opennurbs_array_defs.h:542
void Destroy()
onfree any memory and set count and capacity to zero
Definition: opennurbs_array_defs.h:809
T & AppendNew()
array operations ////////////////////////////////////////////////////
Definition: opennurbs_array_defs.h:470
unsigned int UnsignedCount() const
Definition: opennurbs_array_defs.h:1142