Open CASCADE Technology  7.8.1
Public Types | Public Member Functions
NCollection_DynamicArray< TheItemType > Class Template Reference

Class NCollection_DynamicArray (dynamic array of objects) More...

#include <NCollection_DynamicArray.hxx>

Inheritance diagram for NCollection_DynamicArray< TheItemType >:
Inheritance graph
[legend]

Public Types

typedef NCollection_OccAllocator< TheItemType > allocator_type
 Memory allocation. More...
 
typedef NCollection_BasePointerVector vector
 
using value_type = TheItemType
 
using size_type = size_t
 
using difference_type = size_t
 
using pointer = TheItemType *
 
using const_pointer = TheItemType &
 
using reference = TheItemType &
 
using const_reference = const TheItemType &
 
using iterator = NCollection_IndexedIterator< std::random_access_iterator_tag, NCollection_DynamicArray, value_type, false >
 
using const_iterator = NCollection_IndexedIterator< std::random_access_iterator_tag, NCollection_DynamicArray, value_type, true >
 
using Iterator = NCollection_Iterator< NCollection_DynamicArray< TheItemType >>
 

Public Member Functions

const_iterator begin () const
 
iterator begin ()
 
const_iterator cbegin () const
 
iterator end ()
 
const_iterator end () const
 
const_iterator cend () const
 

public methods

friend iterator
 Copy constructor. More...
 
friend const_iterator
 Copy constructor. More...
 
vector myContainer
 Copy constructor. More...
 
allocator_type myAlloc
 Copy constructor. More...
 
size_t myInternalSize
 Copy constructor. More...
 
size_t myUsedSize
 Copy constructor. More...
 
 NCollection_DynamicArray (const Standard_Integer theIncrement=256)
 Copy constructor. More...
 
 NCollection_DynamicArray (const Standard_Integer theIncrement, const Handle< NCollection_BaseAllocator > &theAllocator)
 Copy constructor. More...
 
 NCollection_DynamicArray (const Standard_Integer theIncrement, const allocator_type &theAllocator)
 Copy constructor. More...
 
 NCollection_DynamicArray (const NCollection_DynamicArray &theOther)
 Copy constructor. More...
 
 NCollection_DynamicArray (NCollection_DynamicArray &&theOther) noexcept
 Copy constructor. More...
 
 ~NCollection_DynamicArray ()
 Copy constructor. More...
 
Standard_Integer Length () const
 Total number of items. More...
 
Standard_Integer Size () const
 Total number of items in the vector. More...
 
Standard_Integer Lower () const
 Method for consistency with other collections. More...
 
Standard_Integer Upper () const
 Method for consistency with other collections. More...
 
Standard_Boolean IsEmpty () const
 Empty query. More...
 
NCollection_DynamicArrayAssign (const NCollection_DynamicArray &theOther, const bool theOwnAllocator=true)
 Assignment to the collection of the same type. More...
 
NCollection_DynamicArrayAssign (NCollection_DynamicArray &&theOther)
 Copy constructor. More...
 
NCollection_DynamicArrayoperator= (const NCollection_DynamicArray &theOther)
 Assignment operator. More...
 
NCollection_DynamicArrayoperator= (NCollection_DynamicArray &&theOther)
 Assignment operator. More...
 
reference Append (const TheItemType &theValue)
 Append. More...
 
reference Append (TheItemType &&theValue)
 Append. More...
 
void EraseLast ()
 Copy constructor. More...
 
reference Appended ()
 Appends an empty value and returns the reference to it. More...
 
const_reference operator() (const Standard_Integer theIndex) const
 Operator() - query the const value. More...
 
const_reference operator[] (const Standard_Integer theIndex) const
 Operator[] - query the const value. More...
 
const_reference operator[] (const size_t theIndex) const
 Operator[] - query the const value. More...
 
const_reference Value (const Standard_Integer theIndex) const
 Copy constructor. More...
 
const_reference First () const
 
reference ChangeFirst ()
 
const_reference Last () const
 
reference ChangeLast ()
 
reference operator() (const Standard_Integer theIndex)
 Operator() - query the value. More...
 
reference operator[] (const Standard_Integer theIndex)
 Operator[] - query the value. More...
 
reference operator[] (const size_t theIndex)
 Operator[] - query the value. More...
 
reference ChangeValue (const Standard_Integer theIndex)
 Copy constructor. More...
 
reference SetValue (const Standard_Integer theIndex, const TheItemType &theValue)
 SetValue () - set or append a value. More...
 
reference SetValue (const Standard_Integer theIndex, TheItemType &&theValue)
 SetValue () - set or append a value. More...
 
void Clear (const bool theReleaseMemory=false)
 Copy constructor. More...
 
void SetIncrement (const Standard_Integer theIncrement)
 Copy constructor. More...
 
size_t availableSize () const
 Copy constructor. More...
 
TheItemType * expandArray ()
 Copy constructor. More...
 
reference at (const size_t theInd)
 Copy constructor. More...
 
const_reference at (const size_t theInd) const
 Copy constructor. More...
 
void copyDate ()
 Copy constructor. More...
 
TheItemType ** getArray () const
 Wrapper to extract array. More...
 

Detailed Description

template<class TheItemType>
class NCollection_DynamicArray< TheItemType >

Class NCollection_DynamicArray (dynamic array of objects)

The array's indices always start at 0.

The Vector is always created with 0 length. It can be enlarged by two means:

  1. Calling the method Append (val) - then "val" is added to the end of the vector (the vector length is incremented)
  2. Calling the method SetValue (i, val) - if "i" is greater than or equal to the current length of the vector, the vector is enlarged to accomo- date this index

The methods Append and SetValue return a non-const reference to the copied object inside the vector. This reference is guaranteed to be valid until the vector is destroyed. It can be used to access the vector member directly or to pass its address to other data structures.

The vector iterator remembers the length of the vector at the moment of the creation or initialisation of the iterator. Therefore the iteration begins at index 0 and stops at the index equal to (remembered_length-1). It is OK to enlarge the vector during the iteration.

Member Typedef Documentation

template<class TheItemType>
typedef NCollection_OccAllocator<TheItemType> NCollection_DynamicArray< TheItemType >::allocator_type

Memory allocation.

template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::const_iterator = NCollection_IndexedIterator<std::random_access_iterator_tag, NCollection_DynamicArray, value_type, true>
template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::const_pointer = TheItemType&
template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::const_reference = const TheItemType&
template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::difference_type = size_t
template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::iterator = NCollection_IndexedIterator<std::random_access_iterator_tag, NCollection_DynamicArray, value_type, false>
template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::Iterator = NCollection_Iterator<NCollection_DynamicArray<TheItemType>>
template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::pointer = TheItemType*
template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::reference = TheItemType&
template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::size_type = size_t
template<class TheItemType>
using NCollection_DynamicArray< TheItemType >::value_type = TheItemType
template<class TheItemType>
typedef NCollection_BasePointerVector NCollection_DynamicArray< TheItemType >::vector

Constructor & Destructor Documentation

template<class TheItemType>
NCollection_DynamicArray< TheItemType >::NCollection_DynamicArray ( const Standard_Integer  theIncrement = 256)
inline

Copy constructor.

template<class TheItemType>
NCollection_DynamicArray< TheItemType >::NCollection_DynamicArray ( const Standard_Integer  theIncrement,
const Handle< NCollection_BaseAllocator > &  theAllocator 
)
inlineexplicit

Copy constructor.

template<class TheItemType>
NCollection_DynamicArray< TheItemType >::NCollection_DynamicArray ( const Standard_Integer  theIncrement,
const allocator_type theAllocator 
)
inlineexplicit

Copy constructor.

template<class TheItemType>
NCollection_DynamicArray< TheItemType >::NCollection_DynamicArray ( const NCollection_DynamicArray< TheItemType > &  theOther)
inline

Copy constructor.

template<class TheItemType>
NCollection_DynamicArray< TheItemType >::NCollection_DynamicArray ( NCollection_DynamicArray< TheItemType > &&  theOther)
inlinenoexcept

Copy constructor.

template<class TheItemType>
NCollection_DynamicArray< TheItemType >::~NCollection_DynamicArray ( )
inline

Copy constructor.

Member Function Documentation

template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::Append ( const TheItemType &  theValue)
inline

Append.

template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::Append ( TheItemType &&  theValue)
inline

Append.

template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::Appended ( )
inline

Appends an empty value and returns the reference to it.

template<class TheItemType>
NCollection_DynamicArray& NCollection_DynamicArray< TheItemType >::Assign ( const NCollection_DynamicArray< TheItemType > &  theOther,
const bool  theOwnAllocator = true 
)
inline

Assignment to the collection of the same type.

template<class TheItemType>
NCollection_DynamicArray& NCollection_DynamicArray< TheItemType >::Assign ( NCollection_DynamicArray< TheItemType > &&  theOther)
inline

Copy constructor.

template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::at ( const size_t  theInd)
inlineprotected

Copy constructor.

template<class TheItemType>
const_reference NCollection_DynamicArray< TheItemType >::at ( const size_t  theInd) const
inlineprotected

Copy constructor.

template<class TheItemType>
size_t NCollection_DynamicArray< TheItemType >::availableSize ( ) const
inlineprotected

Copy constructor.

template<class TheItemType>
const_iterator NCollection_DynamicArray< TheItemType >::begin ( ) const
inline
template<class TheItemType>
iterator NCollection_DynamicArray< TheItemType >::begin ( )
inline
template<class TheItemType>
const_iterator NCollection_DynamicArray< TheItemType >::cbegin ( ) const
inline
template<class TheItemType>
const_iterator NCollection_DynamicArray< TheItemType >::cend ( ) const
inline
template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::ChangeFirst ( )
inline
Returns
first element
template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::ChangeLast ( )
inline
Returns
last element
template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::ChangeValue ( const Standard_Integer  theIndex)
inline

Copy constructor.

template<class TheItemType>
void NCollection_DynamicArray< TheItemType >::Clear ( const bool  theReleaseMemory = false)
inline

Copy constructor.

template<class TheItemType>
void NCollection_DynamicArray< TheItemType >::copyDate ( )
inlineprotected

Copy constructor.

template<class TheItemType>
iterator NCollection_DynamicArray< TheItemType >::end ( )
inline
template<class TheItemType>
const_iterator NCollection_DynamicArray< TheItemType >::end ( ) const
inline
template<class TheItemType>
void NCollection_DynamicArray< TheItemType >::EraseLast ( )
inline

Copy constructor.

template<class TheItemType>
TheItemType* NCollection_DynamicArray< TheItemType >::expandArray ( )
inlineprotected

Copy constructor.

template<class TheItemType>
const_reference NCollection_DynamicArray< TheItemType >::First ( ) const
inline
Returns
first element
template<class TheItemType>
TheItemType** NCollection_DynamicArray< TheItemType >::getArray ( ) const
inlineprotected

Wrapper to extract array.

template<class TheItemType>
Standard_Boolean NCollection_DynamicArray< TheItemType >::IsEmpty ( ) const
inline

Empty query.

template<class TheItemType>
const_reference NCollection_DynamicArray< TheItemType >::Last ( ) const
inline
Returns
last element
template<class TheItemType>
Standard_Integer NCollection_DynamicArray< TheItemType >::Length ( void  ) const
inline

Total number of items.

template<class TheItemType>
Standard_Integer NCollection_DynamicArray< TheItemType >::Lower ( ) const
inline

Method for consistency with other collections.

Returns
Lower bound (inclusive) for iteration.
template<class TheItemType>
const_reference NCollection_DynamicArray< TheItemType >::operator() ( const Standard_Integer  theIndex) const
inline

Operator() - query the const value.

template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::operator() ( const Standard_Integer  theIndex)
inline

Operator() - query the value.

template<class TheItemType>
NCollection_DynamicArray& NCollection_DynamicArray< TheItemType >::operator= ( const NCollection_DynamicArray< TheItemType > &  theOther)
inline

Assignment operator.

template<class TheItemType>
NCollection_DynamicArray& NCollection_DynamicArray< TheItemType >::operator= ( NCollection_DynamicArray< TheItemType > &&  theOther)
inline

Assignment operator.

template<class TheItemType>
const_reference NCollection_DynamicArray< TheItemType >::operator[] ( const Standard_Integer  theIndex) const
inline

Operator[] - query the const value.

template<class TheItemType>
const_reference NCollection_DynamicArray< TheItemType >::operator[] ( const size_t  theIndex) const
inline

Operator[] - query the const value.

template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::operator[] ( const Standard_Integer  theIndex)
inline

Operator[] - query the value.

template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::operator[] ( const size_t  theIndex)
inline

Operator[] - query the value.

template<class TheItemType>
void NCollection_DynamicArray< TheItemType >::SetIncrement ( const Standard_Integer  theIncrement)
inline

Copy constructor.

template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::SetValue ( const Standard_Integer  theIndex,
const TheItemType &  theValue 
)
inline

SetValue () - set or append a value.

template<class TheItemType>
reference NCollection_DynamicArray< TheItemType >::SetValue ( const Standard_Integer  theIndex,
TheItemType &&  theValue 
)
inline

SetValue () - set or append a value.

template<class TheItemType>
Standard_Integer NCollection_DynamicArray< TheItemType >::Size ( void  ) const
inline

Total number of items in the vector.

template<class TheItemType>
Standard_Integer NCollection_DynamicArray< TheItemType >::Upper ( ) const
inline

Method for consistency with other collections.

Returns
Upper bound (inclusive) for iteration.
template<class TheItemType>
const_reference NCollection_DynamicArray< TheItemType >::Value ( const Standard_Integer  theIndex) const
inline

Copy constructor.

Field Documentation

template<class TheItemType>
friend NCollection_DynamicArray< TheItemType >::const_iterator

Copy constructor.

template<class TheItemType>
friend NCollection_DynamicArray< TheItemType >::iterator

Copy constructor.

template<class TheItemType>
allocator_type NCollection_DynamicArray< TheItemType >::myAlloc
protected

Copy constructor.

template<class TheItemType>
vector NCollection_DynamicArray< TheItemType >::myContainer
protected

Copy constructor.

template<class TheItemType>
size_t NCollection_DynamicArray< TheItemType >::myInternalSize
protected

Copy constructor.

template<class TheItemType>
size_t NCollection_DynamicArray< TheItemType >::myUsedSize
protected

Copy constructor.


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