TCArrayWrapper< T > Class Template Reference

A wrapper around the c-array to provide an STL like interface for iterators. More...

#include <mia/core/vector.hh>

Public Member Functions

iterator begin ()
 
const_iterator begin () const
 
iterator end ()
 
const_iterator end () const
 
void make_unique ()
 
TCArrayWrapper< T > & operator= (const TCArrayWrapper< T > &other)
 assignment operator More...
 
reference operator[] (size_t i)
 
const_reference operator[] (size_t i) const
 
size_type size () const
 
 TCArrayWrapper (size_t n, bool clean=true)
 */ More...
 
 TCArrayWrapper (const TCArrayWrapper< T > &other)
 
 TCArrayWrapper (size_t n, T *init)
 
 TCArrayWrapper (size_t n, const T *init)
 

Detailed Description

template<typename T>
class TCArrayWrapper< T >

A wrapper around the c-array to provide an STL like interface for iterators.

c-array envelope that supports some facilities of STL like vectors and that allows holding pre-allocated data. Handling of the optinal deleting of the array is done by a destructor template passed to the std::shared_ptr constructor

Template Parameters
thedata type of the C-array

Definition at line 75 of file core/vector.hh.

Constructor & Destructor Documentation

◆ TCArrayWrapper() [1/4]

template<typename T>
TCArrayWrapper< T >::TCArrayWrapper ( size_t  n,
bool  clean = true 
)
inline

*/

Create a vector, the data is owned by this vector and will be deleted if the reference count reaches zero

Parameters
n
cleaninitialize vector to 0

Definition at line 93 of file core/vector.hh.

◆ TCArrayWrapper() [2/4]

template<typename T>
TCArrayWrapper< T >::TCArrayWrapper ( const TCArrayWrapper< T > &  other)
inline

copy constructor, this is a shallow copy, i.e. the data is shared between the original and the copied vector

Parameters
other

Definition at line 106 of file core/vector.hh.

◆ TCArrayWrapper() [3/4]

template<typename T>
TCArrayWrapper< T >::TCArrayWrapper ( size_t  n,
T *  init 
)
inline

Constructor that creates the STL-like vector as an envelop around a C-array. The data will not be freed at destruction time.

Parameters
nsize of input array
initallocated input data

Definition at line 128 of file core/vector.hh.

◆ TCArrayWrapper() [4/4]

template<typename T>
TCArrayWrapper< T >::TCArrayWrapper ( size_t  n,
const T *  init 
)
inline

Constructor that creates the STL-like vector as an envelop around a C-array. The data will not be freed at destruction time.

Parameters
nsize of input array
initallocated input data

Definition at line 141 of file core/vector.hh.

Member Function Documentation

◆ begin() [1/2]

template<typename T>
iterator TCArrayWrapper< T >::begin ( )
inline

STL compatible iterator, begin of range

Definition at line 171 of file core/vector.hh.

References DEBUG_ASSERT_RELEASE_THROW.

Referenced by Transformation< C3DImage, C3DInterpolatorFactory >::get_energy_penalty().

◆ begin() [2/2]

template<typename T>
const_iterator TCArrayWrapper< T >::begin ( ) const
inline

STL compatible const_iterator, begin of range

Definition at line 194 of file core/vector.hh.

◆ end() [1/2]

template<typename T>
iterator TCArrayWrapper< T >::end ( )
inline

STL compatible iterator, end of range

Definition at line 182 of file core/vector.hh.

References DEBUG_ASSERT_RELEASE_THROW.

Referenced by Transformation< C3DImage, C3DInterpolatorFactory >::get_energy_penalty().

◆ end() [2/2]

template<typename T>
const_iterator TCArrayWrapper< T >::end ( ) const
inline

STL compatible const_iterator, end of range

Definition at line 201 of file core/vector.hh.

◆ make_unique()

template<typename T>
void TCArrayWrapper< T >::make_unique ( )
inline

If the wrapped data is referenced more than once or is read-only, make a copy inside this object that is refereneces only once and writable.

Definition at line 218 of file core/vector.hh.

◆ operator=()

template<typename T>
TCArrayWrapper<T>& TCArrayWrapper< T >::operator= ( const TCArrayWrapper< T > &  other)
inline

assignment operator

Definition at line 114 of file core/vector.hh.

◆ operator[]() [1/2]

template<typename T>
reference TCArrayWrapper< T >::operator[] ( size_t  i)
inline

Standard array access operator, read-write version

Definition at line 151 of file core/vector.hh.

References DEBUG_ASSERT_RELEASE_THROW.

◆ operator[]() [2/2]

template<typename T>
const_reference TCArrayWrapper< T >::operator[] ( size_t  i) const
inline

Standard array access operator, read-only version

Definition at line 163 of file core/vector.hh.

◆ size()

template<typename T>
size_type TCArrayWrapper< T >::size ( ) const
inline
Returns
number of elements in the array

Definition at line 208 of file core/vector.hh.


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