TCArrayWrapper< T > Class Template Reference
Uncategorized

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

`#include <mia/core/vector.hh>`

Inheritance diagram for TCArrayWrapper< T >:
[legend]

## 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
reference | operator[] (size_t i)
const_reference | operator[] (size_t i) const
size_type | size () const
| TCArrayWrapper (const TCArrayWrapper< T > &other)
| TCArrayWrapper (size_t n, bool clean=true)
| *‍/
| TCArrayWrapper (size_t n, const T *init)
| TCArrayWrapper (size_t n, 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

  the | data type of the C-array

Definition at line 77 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 |
  clean | initialize vector to 0

Definition at line 96 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 109 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

  n | size of input array
  init | allocated input data

Definition at line 131 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

  n | size of input array
  init | allocated input data

Definition at line 144 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 176 of file core/vector.hh.

## begin() [2/2]

template<typename T>

const_iterator TCArrayWrapper< T >::begin | ( |  | ) | const

inline

STL compatible const_iterator, begin of range

Definition at line 201 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 188 of file core/vector.hh.

## end() [2/2]

template<typename T>

const_iterator TCArrayWrapper< T >::end | ( |  | ) | const

inline

STL compatible const_iterator, end of range

Definition at line 209 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 227 of file core/vector.hh.

## operator=()

template<typename T>

TCArrayWrapper< T > & TCArrayWrapper< T >::operator= | ( | const TCArrayWrapper< T > & | other | ) |

inline

assignment operator

Definition at line 117 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 154 of file core/vector.hh.

## 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 167 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 217 of file core/vector.hh.

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

- core/vector.hh