Zivid C++ API 2.16.0+46cdaba6-1
Zivid::Array1D< DataFormat > Class Template Reference

One-dimensional container of data. More...

#include <Zivid/Array1D.h>

Public Types

using ValueType = DataFormat
 The type of the elements stored in the Array.
 
using ConstIterator = const DataFormat *
 The iterator type for immutable access. It iterates over individual Array1D elements.
 

Public Member Functions

 Array1D ()
 Create an empty Array1D.
 
size_t size () const
 Get the number of elements in the array.
 
bool isEmpty () const
 Check if the array is empty.
 
const DataFormat * data () const
 Pointer to the first data element of the array.
 
const DataFormat & operator() (size_t idx) const
 Constant reference to an element given by an index.
 
ConstIterator begin () const
 Iterator to the beginning of the array.
 
ConstIterator end () const
 Iterator to the end of the array.
 
ConstIterator cbegin () const
 Iterator to the beginning of the array.
 
ConstIterator cend () const
 Iterator to the end of the array.
 
std::string toString () const
 Get array information as string.
 

Friends

class Array1DFactory
 

Detailed Description

template<typename DataFormat>
class Zivid::Array1D< DataFormat >

One-dimensional container of data.

Array1D manages the data using implicit sharing via reference counting. Copy or assignment of an Array1D object is shallow (only a pointer to the data is copied), which makes copy/assignment of Array1D fast. The data stored in the array is deallocated when there are no Array1D instances pointing to it.

The type of the elements stored in the array is given by template parameter DataFormat.

Member Typedef Documentation

◆ ConstIterator

template<typename DataFormat >
using Zivid::Array1D< DataFormat >::ConstIterator = const DataFormat *

The iterator type for immutable access. It iterates over individual Array1D elements.

◆ ValueType

template<typename DataFormat >
using Zivid::Array1D< DataFormat >::ValueType = DataFormat

The type of the elements stored in the Array.

Constructor & Destructor Documentation

◆ Array1D()

template<typename DataFormat >
Zivid::Array1D< DataFormat >::Array1D ( )
inline

Create an empty Array1D.

Member Function Documentation

◆ begin()

template<typename DataFormat >
ConstIterator Zivid::Array1D< DataFormat >::begin ( ) const
inline

Iterator to the beginning of the array.

◆ cbegin()

template<typename DataFormat >
ConstIterator Zivid::Array1D< DataFormat >::cbegin ( ) const
inline

Iterator to the beginning of the array.

◆ cend()

template<typename DataFormat >
ConstIterator Zivid::Array1D< DataFormat >::cend ( ) const
inline

Iterator to the end of the array.

◆ data()

template<typename DataFormat >
const DataFormat * Zivid::Array1D< DataFormat >::data ( ) const
inline

Pointer to the first data element of the array.

If the array is empty then this method returns nullptr

◆ end()

template<typename DataFormat >
ConstIterator Zivid::Array1D< DataFormat >::end ( ) const
inline

Iterator to the end of the array.

◆ isEmpty()

template<typename DataFormat >
bool Zivid::Array1D< DataFormat >::isEmpty ( ) const
inline

Check if the array is empty.

◆ operator()()

template<typename DataFormat >
const DataFormat & Zivid::Array1D< DataFormat >::operator() ( size_t idx) const
inline

Constant reference to an element given by an index.

No bounds checking is performed. Calling this operator with an argument that is out of range causes undefined behavior. Calling this operator when the Array1D is empty causes undefined behavior.

Parameters
idxIndex (from 0 to size - 1)

◆ size()

template<typename DataFormat >
size_t Zivid::Array1D< DataFormat >::size ( ) const
inline

Get the number of elements in the array.

◆ toString()

template<typename DataFormat >
std::string Zivid::Array1D< DataFormat >::toString ( ) const
inline

Get array information as string.

Friends And Related Symbol Documentation

◆ Array1DFactory

template<typename DataFormat >
friend class Array1DFactory
friend

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