CFx SDK Documentation  2023 SP0
Classes | Public Types | Public Member Functions | Friends | List of all members
OdArray< T, A > Class Template Reference

#include <OdArray.h>

Public Types

typedef A::size_type size_type
 
typedef T * iterator
 
typedef const T * const_iterator
 
typedef T value_type
 
typedef const T & const_reference
 
typedef T & reference
 

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
void insert (iterator before, const_iterator first, const_iterator afterLast)
 
void resize (size_type logicalLength, const T &value)
 
void resize (size_type logicalLength)
 
size_type size () const
 
bool empty () const
 
size_type capacity () const
 
void reserve (size_type reserveLength)
 
void assign (const_iterator first, const_iterator afterLast)
 
iterator erase (iterator first, iterator afterLast)
 
iterator erase (iterator where)
 
void clear ()
 
void push_back (const T &value)
 
iterator insert (iterator before, size_type numElements, const T &value)
 
iterator insert (iterator before, const T &value=T())
 
bool contains (const T &value, size_type start=0) const
 
size_type length () const
 
bool isEmpty () const
 
size_type logicalLength () const
 
size_type physicalLength () const
 
int growLength () const
 
const T * asArrayPtr () const
 
const T * getPtr () const
 
T * asArrayPtr ()
 
const T & operator[] (size_type index) const
 
T & operator[] (size_type index)
 
T & at (size_type arrayIndex)
 
const T & at (size_type arrayIndex) const
 
OdArraysetAt (size_type arrayIndex, const T &value)
 
const T & getAt (size_type arrayIndex) const
 
T & first ()
 
const T & first () const
 
T & last ()
 
const T & last () const
 
size_type append (const T &value)
 
iterator append ()
 
OdArrayremoveFirst ()
 
OdArrayremoveLast ()
 
OdArraysetGrowLength (int growLength)
 
 OdArray (size_type physicalLength, int growLength=8)
 
 OdArray ()
 
 OdArray (const OdArray &source)
 
 ~OdArray ()
 
OdArrayoperator= (const OdArray &source)
 
bool operator== (const OdArray &array) const
 
OdArraysetAll (const T &value)
 
OdArrayappend (const OdArray &otherArray)
 
OdArrayinsertAt (size_type arrayIndex, const T &value)
 
OdArrayremoveAt (size_type arrayIndex)
 
OdArrayremoveSubArray (size_type startIndex, size_type endIndex)
 
bool find (const T &value, size_type &findIndex, size_type start=0) const
 
OdArraysetLogicalLength (size_type logLength)
 
OdArraysetPhysicalLength (size_type physLength)
 
OdArrayreverse ()
 
OdArrayswap (size_type firstIndex, size_type secondIndex)
 
bool remove (const T &value, size_type start=0)
 

Friends

class reallocator
 

Detailed Description

template<class T, class A>
class OdArray< T, A >

This template class implements dynamic Array objects within Teigha.

Remarks
Methods are provided to access Array elements via both array indices and array pointers (iterators).

Some definitions are in order:

  1. Logical Length or Size – The number of entries in the array. Initially zero.
  2. Physical Length – The maximum Logical Length of the array before it automatically grows.
  3. Grow Length – The number of entries by which the Physical Length will grow as required.
See also
TD_Db

<group Other_Classes>

Definition at line 590 of file OdArray.h.

Member Typedef Documentation

◆ const_iterator

template<class T , class A >
typedef const T* OdArray< T, A >::const_iterator

Definition at line 595 of file OdArray.h.

◆ const_reference

template<class T , class A >
typedef const T& OdArray< T, A >::const_reference

Definition at line 597 of file OdArray.h.

◆ iterator

template<class T , class A >
typedef T* OdArray< T, A >::iterator

Definition at line 594 of file OdArray.h.

◆ reference

template<class T , class A >
typedef T& OdArray< T, A >::reference

Definition at line 598 of file OdArray.h.

◆ size_type

template<class T , class A >
typedef A::size_type OdArray< T, A >::size_type

Definition at line 593 of file OdArray.h.

◆ value_type

template<class T , class A >
typedef T OdArray< T, A >::value_type

Definition at line 596 of file OdArray.h.

Constructor & Destructor Documentation

◆ OdArray() [1/3]

template<class T , class A >
OdArray< T, A >::OdArray ( size_type  physicalLength,
int  growLength = 8 
)
inlineexplicit

Constructor

Parameters
physicalLength[in] Initial physical length.
growLength[in] Initial grow length.

Definition at line 1272 of file OdArray.h.

◆ OdArray() [2/3]

template<class T , class A >
OdArray< T, A >::OdArray ( )
inline

Definition at line 1283 of file OdArray.h.

◆ OdArray() [3/3]

template<class T , class A >
OdArray< T, A >::OdArray ( const OdArray< T, A > &  source)
inline

Definition at line 1288 of file OdArray.h.

◆ ~OdArray()

template<class T , class A >
OdArray< T, A >::~OdArray ( )
inline

Definition at line 1293 of file OdArray.h.

Member Function Documentation

◆ append() [1/3]

template<class T , class A >
iterator OdArray< T, A >::append ( )
inline

Returns an interator (pointer) to the first element after the last element in the array.

Definition at line 1225 of file OdArray.h.

◆ append() [2/3]

template<class T , class A >
OdArray& OdArray< T, A >::append ( const OdArray< T, A > &  otherArray)
inline

Appends the specified value or Array object to the end of this Array object.

Parameters
otherArray[in] Array to append.
value[in] Value to append.
Remarks
If called with otherArray, returns a reference to this Array object.

If called with value, returns the index of the new last element.

If called with no arguments, returns an interator (pointer) to the first element after the last element in the array.

Definition at line 1354 of file OdArray.h.

◆ append() [3/3]

template<class T , class A >
size_type OdArray< T, A >::append ( const T &  value)
inline

Appends the specified value to the end of this Array object.

Parameters
value[in] Value to append.
Returns
Returns the index of the new last element.

Definition at line 1215 of file OdArray.h.

◆ asArrayPtr() [1/2]

template<class T , class A >
T* OdArray< T, A >::asArrayPtr ( )
inline

Returns the data buffer of this Array object.

Definition at line 1110 of file OdArray.h.

◆ asArrayPtr() [2/2]

template<class T , class A >
const T* OdArray< T, A >::asArrayPtr ( ) const
inline

Returns the data buffer of this Array object.

Definition at line 1094 of file OdArray.h.

◆ assign()

template<class T , class A >
void OdArray< T, A >::assign ( const_iterator  first,
const_iterator  afterLast 
)
inline

Assigns the specified range of elements to this Array object.

Parameters
first[in] Position of first element to be assigned.
afterLast[in] Position of first element after the last element to be assigned.
Remarks
After this Array object is cleared, this function assigns the specified range of elements from another Array object.

Definition at line 939 of file OdArray.h.

◆ at() [1/2]

template<class T , class A >
T& OdArray< T, A >::at ( size_type  arrayIndex)
inline

Returns the element of this Array object at the specified index.

Parameters
arrayIndex[in] Array index.

Definition at line 1140 of file OdArray.h.

◆ at() [2/2]

template<class T , class A >
const T& OdArray< T, A >::at ( size_type  arrayIndex) const
inline

Returns the element of this Array object at the specified index.

Parameters
arrayIndex[in] Array index.

Definition at line 1151 of file OdArray.h.

◆ begin() [1/2]

template<class T , class A >
iterator OdArray< T, A >::begin ( )
inline

Returns an iterator that references the first element in this Array object.

Definition at line 751 of file OdArray.h.

◆ begin() [2/2]

template<class T , class A >
const_iterator OdArray< T, A >::begin ( ) const
inline

Definition at line 760 of file OdArray.h.

◆ capacity()

template<class T , class A >
size_type OdArray< T, A >::capacity ( ) const
inline

Returns the physical length of this Array object.

Definition at line 909 of file OdArray.h.

◆ clear()

template<class T , class A >
void OdArray< T, A >::clear ( )
inline

Removes all elements from this Array object.

Definition at line 979 of file OdArray.h.

◆ contains()

template<class T , class A >
bool OdArray< T, A >::contains ( const T &  value,
size_type  start = 0 
) const
inline

Returns true if and only if this Array object contains ths specified value.

Parameters
value[in] Value for which to search.
start[in] Starting index of search.

Definition at line 1043 of file OdArray.h.

◆ empty()

template<class T , class A >
bool OdArray< T, A >::empty ( ) const
inline

Returns true if and only if this Array is empty.

Definition at line 901 of file OdArray.h.

◆ end() [1/2]

template<class T , class A >
iterator OdArray< T, A >::end ( )
inline

Returns an iterator that references the location after the last element in this Array object.

Definition at line 772 of file OdArray.h.

◆ end() [2/2]

template<class T , class A >
const_iterator OdArray< T, A >::end ( ) const
inline

Definition at line 781 of file OdArray.h.

◆ erase() [1/2]

template<class T , class A >
iterator OdArray< T, A >::erase ( iterator  first,
iterator  afterLast 
)
inline

Removes the specified range of elements from this Array object.

Parameters
first[in] Position of first element to be erased.
afterLast[in] Position of first element after the last element to be erased.

Definition at line 953 of file OdArray.h.

◆ erase() [2/2]

template<class T , class A >
iterator OdArray< T, A >::erase ( iterator  where)
inline

Removes the specified element from this Array object.

Parameters
where[in] Element to remove.

Definition at line 969 of file OdArray.h.

◆ find()

template<class T , class A >
bool OdArray< T, A >::find ( const T &  value,
size_type findIndex,
size_type  start = 0 
) const
inline

Returns true if and only if this Array object contains ths specified value.

Parameters
value[in] Value for which to search.
findIndex[out] Receives the index of the found value.
start[in] Starting index of search.
Returns
Returns the index at which the element was found.

Definition at line 1466 of file OdArray.h.

◆ first() [1/2]

template<class T , class A >
T& OdArray< T, A >::first ( )
inline

Returns the first element of this Array object.

Definition at line 1186 of file OdArray.h.

◆ first() [2/2]

template<class T , class A >
const T& OdArray< T, A >::first ( ) const
inline

Definition at line 1190 of file OdArray.h.

◆ getAt()

template<class T , class A >
const T& OdArray< T, A >::getAt ( size_type  arrayIndex) const
inline

Returns the element of this Array object at the specified position.

Parameters
arrayIndex[in] Array index.

Definition at line 1176 of file OdArray.h.

◆ getPtr()

template<class T , class A >
const T* OdArray< T, A >::getPtr ( ) const
inline

Returns the data buffer of this Array object.

Definition at line 1102 of file OdArray.h.

◆ growLength()

template<class T , class A >
int OdArray< T, A >::growLength ( ) const
inline

Returns the grow length of this Array object.

Definition at line 1086 of file OdArray.h.

◆ insert() [1/3]

template<class T , class A >
iterator OdArray< T, A >::insert ( iterator  before,
const T &  value = T() 
)
inline

Inserts an element into this Array object.

Parameters
value[in] Value to insert.

Definition at line 1028 of file OdArray.h.

◆ insert() [2/3]

template<class T , class A >
void OdArray< T, A >::insert ( iterator  before,
const_iterator  first,
const_iterator  afterLast 
)
inline

Inserts an element, number of elements, or range of elements, into this Array object.

Parameters
before[in] Position where first element is to be inserted.
first[in] Position of first element to be inserted.
afterLast[in] Position of first element after the last element to be inserted.
Remarks
The range of elements may be from another Array object.

Definition at line 800 of file OdArray.h.

◆ insert() [3/3]

template<class T , class A >
iterator OdArray< T, A >::insert ( iterator  before,
size_type  numElements,
const T &  value 
)
inline

Inserts number of elements into this Array object.

Parameters
before[in] Position where first element is to be inserted.
numElements[in] Number of elements to insert.
value[in] Value to insert.

Definition at line 1000 of file OdArray.h.

◆ insertAt()

template<class T , class A >
OdArray& OdArray< T, A >::insertAt ( size_type  arrayIndex,
const T &  value 
)
inline

Inserts the specified value into this Array object at the specified index.

Parameters
arrayIndex[in] Array index.
value[in] Value to insert.
Remarks
0 <= arrayIndex <= length()

Elements starting at arrayIndex will have their indices incremented.

Returns a reference to this Array object.

Definition at line 1374 of file OdArray.h.

◆ isEmpty()

template<class T , class A >
bool OdArray< T, A >::isEmpty ( ) const
inline

Returns true if and only if this Array is empty.

Definition at line 1062 of file OdArray.h.

◆ last() [1/2]

template<class T , class A >
T& OdArray< T, A >::last ( )
inline

Returns the last element of this Array object.

Definition at line 1198 of file OdArray.h.

◆ last() [2/2]

template<class T , class A >
const T& OdArray< T, A >::last ( ) const
inline

Definition at line 1202 of file OdArray.h.

◆ length()

template<class T , class A >
size_type OdArray< T, A >::length ( ) const
inline

Returns the number of elements in this Array object.

Definition at line 1054 of file OdArray.h.

◆ logicalLength()

template<class T , class A >
size_type OdArray< T, A >::logicalLength ( ) const
inline

Returns the logical length of this Array object.

Definition at line 1070 of file OdArray.h.

◆ operator=()

template<class T , class A >
OdArray& OdArray< T, A >::operator= ( const OdArray< T, A > &  source)
inline

Definition at line 1298 of file OdArray.h.

◆ operator==()

template<class T , class A >
bool OdArray< T, A >::operator== ( const OdArray< T, A > &  array) const
inline

Definition at line 1307 of file OdArray.h.

◆ operator[]() [1/2]

template<class T , class A >
T& OdArray< T, A >::operator[] ( size_type  index)
inline
Remarks
For convenient access to the data.

Definition at line 1128 of file OdArray.h.

◆ operator[]() [2/2]

template<class T , class A >
const T& OdArray< T, A >::operator[] ( size_type  index) const
inline
Remarks
For convenient access to the data.

Definition at line 1119 of file OdArray.h.

◆ physicalLength()

template<class T , class A >
size_type OdArray< T, A >::physicalLength ( ) const
inline

Returns the physical length of this Array object.

Definition at line 1078 of file OdArray.h.

◆ push_back()

template<class T , class A >
void OdArray< T, A >::push_back ( const T &  value)
inline

Appends an element to the end of this Array object.

Definition at line 987 of file OdArray.h.

◆ remove()

template<class T , class A >
bool OdArray< T, A >::remove ( const T &  value,
size_type  start = 0 
)
inline

Removes the element with the specified value from this Array object.

Parameters
value[in] Value for which to search.
start[in] Starting index of search.
Remarks
Removes the first occurance of value starting at start.

Returns true if and only if an element was removed.

Definition at line 1577 of file OdArray.h.

◆ removeAt()

template<class T , class A >
OdArray& OdArray< T, A >::removeAt ( size_type  arrayIndex)
inline

Removes the element at the specified index from this Array object.

Parameters
arrayIndex[in] Array index.
Remarks
0 <= arrayIndex < length()

Elements starting at arrayIndex+1 will have their indices decremented.

Returns a reference to this Array object.

Definition at line 1411 of file OdArray.h.

◆ removeFirst()

template<class T , class A >
OdArray& OdArray< T, A >::removeFirst ( )
inline

Removes the first element in this Array object.

Definition at line 1234 of file OdArray.h.

◆ removeLast()

template<class T , class A >
OdArray& OdArray< T, A >::removeLast ( )
inline

Removes the last element in this Array object.

Definition at line 1242 of file OdArray.h.

◆ removeSubArray()

template<class T , class A >
OdArray& OdArray< T, A >::removeSubArray ( size_type  startIndex,
size_type  endIndex 
)
inline

Removes the specified elements from this Array object.

Parameters
startIndex[in] Start index.
endIndex[in] End index.
Remarks
Elements from startIndex through endIndex inclusive will be removed.

Returns a reference to this Array object.

Definition at line 1437 of file OdArray.h.

◆ reserve()

template<class T , class A >
void OdArray< T, A >::reserve ( size_type  reserveLength)
inline

Sets the physical length of this Array object to the specified reserve length if the reserve length is greater than its physical length.

Parameters
reserveLength[in] Minimum physical length.

Definition at line 920 of file OdArray.h.

◆ resize() [1/2]

template<class T , class A >
void OdArray< T, A >::resize ( size_type  logicalLength)
inline

Specifies the logical length for this Array object.

Parameters
logicalLength[in] Logical length.

Definition at line 865 of file OdArray.h.

◆ resize() [2/2]

template<class T , class A >
void OdArray< T, A >::resize ( size_type  logicalLength,
const T &  value 
)
inline

Specifies the logical length for this Array object.

Parameters
logicalLength[in] Logical length.
value[in] Value for the elements added to obtain the new logical length.

Definition at line 834 of file OdArray.h.

◆ reverse()

template<class T , class A >
OdArray& OdArray< T, A >::reverse ( )
inline

Reverses the order of the elements in this Array object.

Definition at line 1524 of file OdArray.h.

◆ setAll()

template<class T , class A >
OdArray& OdArray< T, A >::setAll ( const T &  value)
inline

Sets all the elements in this Array object to the specified value.

Parameters
value[in] Value to assign.

Definition at line 1328 of file OdArray.h.

◆ setAt()

template<class T , class A >
OdArray& OdArray< T, A >::setAt ( size_type  arrayIndex,
const T &  value 
)
inline

Sets the element of this Array object at the specified index.

Parameters
arrayIndex[in] Array index.
value[in] Value.

Definition at line 1162 of file OdArray.h.

◆ setGrowLength()

template<class T , class A >
OdArray& OdArray< T, A >::setGrowLength ( int  growLength)
inline

Sets the grow length of this Array object.

Parameters
growLength[in] Grow length.

Definition at line 1251 of file OdArray.h.

◆ setLogicalLength()

template<class T , class A >
OdArray& OdArray< T, A >::setLogicalLength ( size_type  logLength)
inline

Sets the logical length of this Array object.

Parameters
logLength[in] Logical length.
Remarks
The physical length is increased as required.

Definition at line 1494 of file OdArray.h.

◆ setPhysicalLength()

template<class T , class A >
OdArray& OdArray< T, A >::setPhysicalLength ( size_type  physLength)
inline

Sets the physical length of this Array object.

Parameters
physLength[in] Physical length.
Remarks
The logical length is decreased as required.

Definition at line 1507 of file OdArray.h.

◆ size()

template<class T , class A >
size_type OdArray< T, A >::size ( ) const
inline

Returns the logical length of this Array object.

Definition at line 893 of file OdArray.h.

◆ swap()

template<class T , class A >
OdArray& OdArray< T, A >::swap ( size_type  firstIndex,
size_type  secondIndex 
)
inline

Swaps the specified elements in this Array object.

Parameters
firstIndex[in] Index of first element.
secondIndex[in] Index of second element.

Definition at line 1550 of file OdArray.h.

Friends And Related Function Documentation

◆ reallocator

template<class T , class A >
friend class reallocator
friend

Definition at line 675 of file OdArray.h.


The documentation for this class was generated from the following file: