Chemical Data Processing Library C++ API - Version 1.1.1
Public Types | Public Member Functions | List of all members
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck > Class Template Reference

A dynamic array class for the storage of object pointers with an indirected query interface. More...

#include <IndirectArray.hpp>

+ Inheritance diagram for CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >:

Public Types

typedef Array< PointerType > BaseType
 The type of the public Array<PointerType> base class storing the pointer elements. More...
 
typedef ValueType ElementType
 The type of the object that is obtained after dereferenciation of a stored pointer element. More...
 
typedef std::shared_ptr< IndirectArraySharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated IndirectArray instances. More...
 
typedef boost::transform_iterator< DerefFunc, typename BaseType::ConstElementIterator, const ValueType & > ConstElementIterator
 A constant random access iterator used to iterate over the pointed-to objects. More...
 
typedef boost::transform_iterator< DerefFunc, typename BaseType::ConstReverseElementIterator, const ValueType & > ConstReverseElementIterator
 A constant random access iterator used to iterate over the pointed-to objects in reverse order. More...
 
typedef boost::transform_iterator< DerefFunc, typename BaseType::ElementIterator, ValueType & > ElementIterator
 A mutable random access iterator used to iterate over the pointed-to objects. More...
 
typedef boost::transform_iterator< DerefFunc, typename BaseType::ReverseElementIterator, ValueType & > ReverseElementIterator
 A mutable random access iterator used to iterate over the pointed-to objects in reverse order. More...
 
- Public Types inherited from CDPL::Util::Array< typename ValueType::SharedPointer >
typedef std::vector< typename ValueType::SharedPointer > StorageType
 
typedef std::shared_ptr< ArraySharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated Array instances. More...
 
typedef typename ValueType::SharedPointer ElementType
 The type of objects stored by the array. More...
 
typedef std::size_t SizeType
 The type of objects stored by the array. More...
 
typedef Array BaseType
 Specifies for derived classes the type of the Array base class. More...
 
typedef StorageType::const_iterator ConstElementIterator
 A constant random access iterator used to iterate over the elements of the array. More...
 
typedef StorageType::const_reverse_iterator ConstReverseElementIterator
 A constant random access iterator used to iterate over the elements of the array in reverse order. More...
 
typedef StorageType::iterator ElementIterator
 A mutable random access iterator used to iterate over the elements of the array. More...
 
typedef StorageType::reverse_iterator ReverseElementIterator
 A mutable random access iterator used to iterate over the elements of the array in reverse order. More...
 

Public Member Functions

 IndirectArray ()
 Creates an empty array. More...
 
 IndirectArray (std::size_t num_elem, const PointerType &ptr=PointerType())
 Creates and initializes the array with num_elem copies of ptr. More...
 
template<typename InputIter >
 IndirectArray (const InputIter &first, const InputIter &last)
 Creates and initializes the array with copies of the pointers in the range [first, last). More...
 
virtual ~IndirectArray ()
 Virtual destructor. More...
 
ElementIterator insertElement (const ElementIterator &it, const PointerType &ptr)
 Inserts a new element before the location specified by the iterator it. More...
 
void insertElements (const ElementIterator &it, std::size_t num_elem, const PointerType &ptr)
 Inserts num_elem copies of ptr before the location specified by the iterator it. More...
 
template<typename InputIter >
void insertElements (const ElementIterator &it, const InputIter &first, const InputIter &last)
 Inserts the range of pointers [first, last) before the location specified by the iterator it. More...
 
ElementIterator removeElement (const ElementIterator &it)
 Removes the element at the position specified by the iterator it. More...
 
ElementIterator removeElements (const ElementIterator &first, const ElementIterator &last)
 Removes the elements pointed to by the iterators in the range [first, last). More...
 
const ValueType & getFirstElement () const
 Returns a const reference to the object pointed to by the first element of the array. More...
 
const ValueType & getLastElement () const
 Returns a const reference to the object pointed to by the last element of the array. More...
 
ValueType & getFirstElement ()
 Returns a non-const reference to the object pointed to by the first element of the array. More...
 
ValueType & getLastElement ()
 Returns a non-const reference to the object pointed to by the last element of the array. More...
 
ConstElementIterator getElementsBegin () const
 Returns a constant iterator over the pointed-to objects that points to the beginning of the array. More...
 
ElementIterator getElementsBegin ()
 Returns a mutable iterator over the pointed-to objects that points to the beginning of the array. More...
 
ConstElementIterator getElementsEnd () const
 Returns a constant iterator over the pointed-to objects that points to the end of the array. More...
 
ElementIterator getElementsEnd ()
 Returns a mutable iterator over the pointed-to objects that points to the end of the array. More...
 
ConstElementIterator begin () const
 Returns a constant iterator over the pointed-to objects that points to the beginning of the array. More...
 
ElementIterator begin ()
 Returns a mutable iterator over the pointed-to objects that points to the beginning of the array. More...
 
ConstElementIterator end () const
 Returns a constant iterator over the pointed-to objects that points to the end of the array. More...
 
ElementIterator end ()
 Returns a mutable iterator over the pointed-to objects that points to the end of the array. More...
 
ConstReverseElementIterator getElementsReverseBegin () const
 Returns a constant iterator over the pointed-to objects that points to the beginning of the reversed array. More...
 
ReverseElementIterator getElementsReverseBegin ()
 Returns a mutable iterator over the pointed-to objects that points to the beginning of the reversed array. More...
 
ConstReverseElementIterator getElementsReverseEnd () const
 Returns a constant iterator over the pointed-to objects that points to the end of the reversed array. More...
 
ReverseElementIterator getElementsReverseEnd ()
 Returns a mutable iterator over the pointed-to objects that points to the end of the reversed array. More...
 
const ValueType & getElement (std::size_t idx) const
 Returns a const reference to the object pointed-to by the pointer element at index idx. More...
 
ValueType & getElement (std::size_t idx)
 Returns a non-const reference to the object pointed-to by the pointer element at index idx. More...
 
const ValueType & operator[] (std::size_t idx) const
 Returns a const reference to the object pointed-to by the pointer element at index idx. More...
 
ValueType & operator[] (std::size_t idx)
 Returns a non-const reference to the object pointed-to by the pointer element at index idx. More...
 
void insertElement (std::size_t idx, const ValueType &value=ValueType())
 Inserts a new element before the location specified by the index idx. More...
 
ElementIterator insertElement (const ElementIterator &it, const ValueType &value=ValueType())
 Inserts a new element before the location specified by the iterator it. More...
 
void insertElements (std::size_t idx, std::size_t num_elem, const ValueType &value=ValueType())
 Inserts num_elem copies of value before the location specified by the index idx. More...
 
void insertElements (const ElementIterator &it, std::size_t num_elem, const ValueType &value=ValueType())
 Inserts num_elem copies of value before the location specified by the iterator it. More...
 
template<typename InputIter >
void insertElements (std::size_t idx, const InputIter &first, const InputIter &last)
 Inserts the range of elements [first, last) before the location specified by the index idx. More...
 
template<typename InputIter >
void insertElements (const ElementIterator &it, const InputIter &first, const InputIter &last)
 Inserts the range of elements [first, last) before the location specified by the iterator it. More...
 
void removeElement (std::size_t idx)
 Removes the element at the position specified by the index idx. More...
 
ElementIterator removeElement (const ElementIterator &it)
 Removes the element at the position specified by the iterator it. More...
 
ElementIterator removeElements (const ElementIterator &first, const ElementIterator &last)
 Removes the elements pointed to by the iterators in the range [first, last). More...
 
- Public Member Functions inherited from CDPL::Util::Array< typename ValueType::SharedPointer >
 Array ()
 Creates an empty array. More...
 
 Array (std::size_t num_elem, const typename ValueType::SharedPointer &value=typename ValueType::SharedPointer())
 Creates and initializes the array with num_elem copies of value. More...
 
 Array (const InputIter &first, const InputIter &last)
 Creates and initializes the array with copies of the elements in the range [first, last). More...
 
virtual ~Array ()
 Virtual destructor. More...
 
StorageTypegetData ()
 
const StorageTypegetData () const
 
BaseTypegetBase ()
 Returns a non-const reference to itself. More...
 
const BaseTypegetBase () const
 Returns a const reference to itself. More...
 
std::size_t getSize () const
 Returns the number of elements stored in the array. More...
 
std::size_t size () const
 Returns the number of elements stored in the array. More...
 
bool isEmpty () const
 Tells whether the array is empty (getSize() == 0). More...
 
void resize (std::size_t num_elem, const typename ValueType::SharedPointer &value=typename ValueType::SharedPointer())
 Inserts or erases elements at the end so that the size becomes num_elem. More...
 
void reserve (std::size_t num_elem)
 Preallocates memory for (at least) num_elem elements. More...
 
std::size_t getCapacity () const
 Returns the number of elements for which memory has been allocated. More...
 
void clear ()
 Erases all elements. More...
 
void swap (Array &array)
 Swaps the contents with array. More...
 
void assign (std::size_t num_elem, const typename ValueType::SharedPointer &value=typename ValueType::SharedPointer())
 This function fills the array with num_elem copies of the given value. More...
 
void assign (const InputIter &first, const InputIter &last)
 This function fills a vector with copies of the elements in the range [first, last). More...
 
void addElement (const typename ValueType::SharedPointer &value=typename ValueType::SharedPointer())
 Inserts a new element at the end of the array. More...
 
void insertElement (std::size_t idx, const typename ValueType::SharedPointer &value=typename ValueType::SharedPointer())
 Inserts a new element before the location specified by the index idx. More...
 
ElementIterator insertElement (const ElementIterator &it, const typename ValueType::SharedPointer &value=typename ValueType::SharedPointer())
 Inserts a new element before the location specified by the iterator it. More...
 
void insertElements (std::size_t idx, std::size_t num_elem, const typename ValueType::SharedPointer &value=typename ValueType::SharedPointer())
 Inserts num_elem copies of value before the location specified by the index idx. More...
 
void insertElements (const ElementIterator &it, std::size_t num_elem, const typename ValueType::SharedPointer &value=typename ValueType::SharedPointer())
 Inserts num_elem copies of value before the location specified by the iterator it. More...
 
void insertElements (std::size_t idx, const InputIter &first, const InputIter &last)
 Inserts the range of elements [first, last) before the location specified by the index idx. More...
 
void insertElements (const ElementIterator &it, const InputIter &first, const InputIter &last)
 Inserts the range of elements [first, last) before the location specified by the iterator it. More...
 
void popLastElement ()
 Removes the last element of the array. More...
 
void removeElement (std::size_t idx)
 Removes the element at the position specified by the index idx. More...
 
ElementIterator removeElement (const ElementIterator &it)
 Removes the element at the position specified by the iterator it. More...
 
ElementIterator removeElements (const ElementIterator &first, const ElementIterator &last)
 Removes the elements pointed to by the iterators in the range [first, last). More...
 
const typename ValueType::SharedPointer & getFirstElement () const
 Returns a const reference to the first element of the array. More...
 
typename ValueType::SharedPointer & getFirstElement ()
 Returns a non-const reference to the first element of the array. More...
 
const typename ValueType::SharedPointer & getLastElement () const
 Returns a const reference to the last element of the array. More...
 
typename ValueType::SharedPointer & getLastElement ()
 Returns a non-const reference to the last element of the array. More...
 
ConstElementIterator getElementsBegin () const
 Returns a constant iterator pointing to the beginning of the array. More...
 
ElementIterator getElementsBegin ()
 Returns a mutable iterator pointing to the beginning of the array. More...
 
ConstElementIterator getElementsEnd () const
 Returns a constant iterator pointing to the end of the array. More...
 
ElementIterator getElementsEnd ()
 Returns a mutable iterator pointing to the end of the array. More...
 
ConstElementIterator begin () const
 Returns a constant iterator pointing to the beginning of the array. More...
 
ElementIterator begin ()
 Returns a mutable iterator pointing to the beginning of the array. More...
 
ConstElementIterator end () const
 Returns a constant iterator pointing to the end of the array. More...
 
ElementIterator end ()
 Returns a mutable iterator pointing to the end of the array. More...
 
ConstReverseElementIterator getElementsReverseBegin () const
 Returns a constant iterator pointing to the beginning of the reversed array. More...
 
ReverseElementIterator getElementsReverseBegin ()
 Returns a mutable iterator pointing to the beginning of the reversed array. More...
 
ConstReverseElementIterator getElementsReverseEnd () const
 Returns a constant iterator pointing to the end of the reversed array. More...
 
ReverseElementIterator getElementsReverseEnd ()
 Returns a mutable iterator pointing to the end of the reversed array. More...
 
const typename ValueType::SharedPointer & getElement (std::size_t idx) const
 Returns a const reference to the element at index idx. More...
 
typename ValueType::SharedPointer & getElement (std::size_t idx)
 Returns a non-const reference to the element at index idx. More...
 
void setElement (std::size_t idx, const typename ValueType::SharedPointer &value=typename ValueType::SharedPointer())
 Assigns a new value to the element specified by the index idx. More...
 
const typename ValueType::SharedPointer & operator[] (std::size_t idx) const
 Returns a const reference to the element at index idx. More...
 
typename ValueType::SharedPointer & operator[] (std::size_t idx)
 Returns a non-const reference to the element at index idx. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Util::Array< typename ValueType::SharedPointer >
void checkIfNonEmpty () const
 
void checkIndex (std::size_t idx, bool allow_end) const
 
void checkIterator (const ElementIterator &it, bool allow_end)
 
void checkIterator (const ConstElementIterator &it, bool allow_end) const
 
virtual const char * getClassName () const
 Returns the name of the (derived) array class. More...
 

Detailed Description

template<typename ValueType, typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
class CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >

A dynamic array class for the storage of object pointers with an indirected query interface.

IndirectArray stores pointers to objects instead of object copies and provides an indirected query interface. That is, methods for accessing an array element do not directly return the stored pointer but return a reference to the pointed-to object. This is also true for iterators pointing into the array which will return a reference to the pointed-to object upon dereferenciation. To
increase code correctness and safety, IndirectArray can be configured to check if an object pointer is null before a dereferenciation or object access is attempted. Since IndirectArray publicly derives from Util::Array (which provides the storage for the pointers), IndirectArray has the same characteristics regarding dynamic memory management and time complexity of various modifying and non-modifying operations.

Template Parameters
ValueTypeThe type of the pointed-to objects.
PointerTypeThe type of the stored pointers.
NullPointerCheckWhether to check for null pointers.
Note
If null pointer checking is enabled, a Base::NullPointerException will be thrown whenever an operation on an iterator object or array element access would require the dereferenciation of a null pointer.

Member Typedef Documentation

◆ BaseType

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
typedef Array<PointerType> CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::BaseType

The type of the public Array<PointerType> base class storing the pointer elements.

◆ ElementType

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
typedef ValueType CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ElementType

The type of the object that is obtained after dereferenciation of a stored pointer element.

◆ SharedPointer

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
typedef std::shared_ptr<IndirectArray> CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated IndirectArray instances.

◆ ConstElementIterator

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
typedef boost::transform_iterator<DerefFunc, typename BaseType::ConstElementIterator, const ValueType&> CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ConstElementIterator

A constant random access iterator used to iterate over the pointed-to objects.

◆ ConstReverseElementIterator

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
typedef boost::transform_iterator<DerefFunc, typename BaseType::ConstReverseElementIterator, const ValueType&> CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ConstReverseElementIterator

A constant random access iterator used to iterate over the pointed-to objects in reverse order.

◆ ElementIterator

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
typedef boost::transform_iterator<DerefFunc, typename BaseType::ElementIterator, ValueType&> CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ElementIterator

A mutable random access iterator used to iterate over the pointed-to objects.

◆ ReverseElementIterator

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
typedef boost::transform_iterator<DerefFunc, typename BaseType::ReverseElementIterator, ValueType&> CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ReverseElementIterator

A mutable random access iterator used to iterate over the pointed-to objects in reverse order.

Constructor & Destructor Documentation

◆ IndirectArray() [1/3]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::IndirectArray ( )
inline

Creates an empty array.

◆ IndirectArray() [2/3]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::IndirectArray ( std::size_t  num_elem,
const PointerType &  ptr = PointerType() 
)
inline

Creates and initializes the array with num_elem copies of ptr.

Parameters
num_elemThe size of the created array.
ptrThe value with which each pointer element of the array will be initialized.

◆ IndirectArray() [3/3]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
template<typename InputIter >
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::IndirectArray ( const InputIter &  first,
const InputIter &  last 
)
inline

Creates and initializes the array with copies of the pointers in the range [first, last).

Parameters
firstThe start of the range.
lastThe end of the range.

◆ ~IndirectArray()

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
virtual CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::~IndirectArray ( )
inlinevirtual

Virtual destructor.

Member Function Documentation

◆ insertElement() [1/3]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::insertElement ( const ElementIterator it,
const PointerType &  ptr 
)

Inserts a new element before the location specified by the iterator it.

Parameters
itThe location where to insert the new element.
ptrThe value of pointer element to insert.
Exceptions
Base::RangeErrorif it is not in the range [getElementsBegin(), getElementsEnd()].

◆ insertElements() [1/6]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
void CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::insertElements ( const ElementIterator it,
std::size_t  num_elem,
const PointerType &  ptr 
)

Inserts num_elem copies of ptr before the location specified by the iterator it.

Parameters
itThe location where to insert the new pointers.
num_elemThe number of pointers to insert.
ptrThe value of the pointer elements to insert.
Exceptions
Base::RangeErrorif it is not in the range [getElementsBegin(), getElementsEnd()].

◆ insertElements() [2/6]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
template<typename InputIter >
void CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::insertElements ( const ElementIterator it,
const InputIter &  first,
const InputIter &  last 
)

Inserts the range of pointers [first, last) before the location specified by the iterator it.

Parameters
itThe location where to insert the new pointer elements.
firstThe start of the range.
lastThe end of the range.
Exceptions
Base::RangeErrorif it is not in the range [getElementsBegin(), getElementsEnd()].

◆ removeElement() [1/3]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::removeElement ( const ElementIterator it)

Removes the element at the position specified by the iterator it.

Parameters
itThe iterator specifying the pointer to remove.
Returns
An iterator pointing to the position of the pointer element immediately following the one that was removed.
Exceptions
Base::RangeErrorif it is not in the range [getElementsBegin(), getElementsEnd() - 1].

◆ removeElements() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::removeElements ( const ElementIterator first,
const ElementIterator last 
)

Removes the elements pointed to by the iterators in the range [first, last).

Parameters
firstThe start of the range.
lastThe end of the range.
Returns
An iterator pointing to the position of the pointer element immediately following the ones that were removed.
Exceptions
Base::RangeErrorif first or last is not in the range [getElementsBegin(), getElementsEnd()] or last < first.

◆ getFirstElement() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
const ValueType & CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getFirstElement

Returns a const reference to the object pointed to by the first element of the array.

Returns
A const reference to the first pointed-to object.
Exceptions
Base::OperationFailedif the array is empty. Base::NullPointerException if null pointer checking is enabled and the object pointer is null.

◆ getLastElement() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
const ValueType & CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getLastElement

Returns a const reference to the object pointed to by the last element of the array.

Returns
A const reference to the last pointed-to object.
Exceptions
Base::OperationFailedif the array is empty. Base::NullPointerException if null pointer checking is enabled and the object pointer is null.

◆ getFirstElement() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
ValueType & CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getFirstElement

Returns a non-const reference to the object pointed to by the first element of the array.

Returns
A non-const reference to the first pointed-to object.
Exceptions
Base::OperationFailedif the array is empty. Base::NullPointerException if null pointer checking is enabled and the object pointer is null.

◆ getLastElement() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
ValueType & CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getLastElement

Returns a non-const reference to the object pointed to by the last element of the array.

Returns
A non-const reference to the last pointed-to object.
Exceptions
Base::OperationFailedif the array is empty. Base::NullPointerException if null pointer checking is enabled and the object pointer is null.

◆ getElementsBegin() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ConstElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElementsBegin

Returns a constant iterator over the pointed-to objects that points to the beginning of the array.

Returns
A constant iterator over the pointed-to objects.

◆ getElementsBegin() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElementsBegin

Returns a mutable iterator over the pointed-to objects that points to the beginning of the array.

Returns
A mutable iterator over the pointed-to objects.

◆ getElementsEnd() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ConstElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElementsEnd

Returns a constant iterator over the pointed-to objects that points to the end of the array.

Returns
A constant iterator over the pointed-to objects.

◆ getElementsEnd() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElementsEnd

Returns a mutable iterator over the pointed-to objects that points to the end of the array.

Returns
A mutable iterator over the pointed-to objects.

◆ begin() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ConstElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::begin

Returns a constant iterator over the pointed-to objects that points to the beginning of the array.

Returns
A constant iterator over the pointed-to objects.

◆ begin() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::begin

Returns a mutable iterator over the pointed-to objects that points to the beginning of the array.

Returns
A mutable iterator over the pointed-to objects.

◆ end() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ConstElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::end

Returns a constant iterator over the pointed-to objects that points to the end of the array.

Returns
A constant iterator over the pointed-to objects.

◆ end() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::end

Returns a mutable iterator over the pointed-to objects that points to the end of the array.

Returns
A mutable iterator over the pointed-to objects.

◆ getElementsReverseBegin() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ConstReverseElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElementsReverseBegin

Returns a constant iterator over the pointed-to objects that points to the beginning of the reversed array.

Returns
A constant iterator over the pointed-to objects.

◆ getElementsReverseBegin() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ReverseElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElementsReverseBegin

Returns a mutable iterator over the pointed-to objects that points to the beginning of the reversed array.

Returns
A mutable iterator over the pointed-to objects.

◆ getElementsReverseEnd() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ConstReverseElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElementsReverseEnd

Returns a constant iterator over the pointed-to objects that points to the end of the reversed array.

Returns
A constant iterator over the pointed-to objects.

◆ getElementsReverseEnd() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::ReverseElementIterator CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElementsReverseEnd

Returns a mutable iterator over the pointed-to objects that points to the end of the reversed array.

Returns
A mutable iterator over the pointed-to objects.

◆ getElement() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
const ValueType & CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElement ( std::size_t  idx) const

Returns a const reference to the object pointed-to by the pointer element at index idx.

The method is equivalent to operator[](std::size_t) const.

Parameters
idxThe zero-based index of the pointer element.
Returns
A const reference to the pointed-to object.
Exceptions
Base::IndexErrorif the array is empty or idx is not in the range [0, getSize() - 1]. Base::NullPointerException if null pointer checking is enabled and the object pointer is null.

◆ getElement() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
ValueType & CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::getElement ( std::size_t  idx)

Returns a non-const reference to the object pointed-to by the pointer element at index idx.

The method is equivalent to operator[](std::size_t) const.

Parameters
idxThe zero-based index of the pointer element.
Returns
A non-const reference to the pointed-to object.
Exceptions
Base::IndexErrorif the array is empty or idx is not in the range [0, getSize() - 1]. Base::NullPointerException if null pointer checking is enabled and the object pointer is null.

◆ operator[]() [1/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
const ValueType & CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::operator[] ( std::size_t  idx) const

Returns a const reference to the object pointed-to by the pointer element at index idx.

Parameters
idxThe zero-based index of the pointer element.
Returns
A const reference to the pointed-to object.
Exceptions
Base::IndexErrorif the array is empty or idx is not in the range [0, getSize() - 1]. Base::NullPointerException if null pointer checking is enabled and the object pointer is null.

◆ operator[]() [2/2]

template<typename ValueType , typename PointerType , bool NullPointerCheck>
ValueType & CDPL::Util::IndirectArray< ValueType, PointerType, NullPointerCheck >::operator[] ( std::size_t  idx)

Returns a non-const reference to the object pointed-to by the pointer element at index idx.

Parameters
idxThe zero-based index of the pointer element.
Returns
A non-const reference to the pointed-to object.
Exceptions
Base::IndexErrorif the array is empty or idx is not in the range [0, getSize() - 1].
Base::NullPointerException if null pointer checking is enabled and the object pointer is null.

◆ insertElement() [2/3]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
void CDPL::Util::Array< ValueType >::insertElement

Inserts a new element before the location specified by the index idx.

Parameters
idxThe location where to insert the new element.
valueThe value of the element to insert.
Exceptions
Base::IndexErrorif the array is empty or idx is not in the range [0, getSize()].

◆ insertElement() [3/3]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
CDPL::Util::Array< ValueType >::ElementIterator CDPL::Util::Array< ValueType >::insertElement

Inserts a new element before the location specified by the iterator it.

Parameters
itThe location where to insert the new element.
valueThe value of the element to insert.
Exceptions
Base::RangeErrorif it is not in the range [getElementsBegin(), getElementsEnd()].

◆ insertElements() [3/6]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
void CDPL::Util::Array< ValueType >::insertElements

Inserts num_elem copies of value before the location specified by the index idx.

Parameters
idxThe location where to insert the new elements.
num_elemThe number of elements to insert.
valueThe value of the elements to insert.
Exceptions
Base::IndexErrorif idx is not in the range [0, getSize()].

◆ insertElements() [4/6]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
void CDPL::Util::Array< ValueType >::insertElements

Inserts num_elem copies of value before the location specified by the iterator it.

Parameters
itThe location where to insert the new elements.
num_elemThe number of elements to insert.
valueThe value of the elements to insert.
Exceptions
Base::RangeErrorif it is not in the range [getElementsBegin(), getElementsEnd()].

◆ insertElements() [5/6]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
template<typename InputIter >
void CDPL::Util::Array< ValueType >::insertElements ( typename InputIter  )

Inserts the range of elements [first, last) before the location specified by the index idx.

Parameters
idxThe location where to insert the new elements.
firstThe start of the range.
lastThe end of the range.
Exceptions
Base::IndexErrorif idx is not in the range [0, getSize()].

◆ insertElements() [6/6]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
template<typename InputIter >
void CDPL::Util::Array< ValueType >::insertElements ( typename InputIter  )

Inserts the range of elements [first, last) before the location specified by the iterator it.

Parameters
itThe location where to insert the new elements.
firstThe start of the range.
lastThe end of the range.
Exceptions
Base::RangeErrorif it is not in the range [getElementsBegin(), getElementsEnd()].

◆ removeElement() [2/3]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
void CDPL::Util::Array< ValueType >::removeElement

Removes the element at the position specified by the index idx.

Parameters
idxThe zero-based index of the element to remove.
Exceptions
Base::IndexErrorif the array is empty or idx is not in the range [0, getSize() - 1].

◆ removeElement() [3/3]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
CDPL::Util::Array< ValueType >::ElementIterator CDPL::Util::Array< ValueType >::removeElement

Removes the element at the position specified by the iterator it.

Parameters
itThe iterator specifying the element to remove.
Returns
An iterator pointing to the position of the element immediately following the one that was removed.
Exceptions
Base::RangeErrorif the array is empty or it is not in the range [getElementsBegin(), getElementsEnd() - 1].

◆ removeElements() [2/2]

template<typename ValueType , typename PointerType = typename ValueType::SharedPointer, bool NullPointerCheck = true>
CDPL::Util::Array< ValueType >::ElementIterator CDPL::Util::Array< ValueType >::removeElements

Removes the elements pointed to by the iterators in the range [first, last).

Parameters
firstThe start of the range.
lastThe end of the range.
Returns
An iterator pointing to the position of the element immediately following the ones that were removed.
Exceptions
Base::RangeErrorif first or last is not in the range [getElementsBegin(), getElementsEnd()] or last < first.

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