File view_vector.hpp

Typedefs

template<typename T>
using AllocatedVector = Allocator<Vector<T>>

Allocates the memory, a Vector provides access to.

Template Parameters:

T – The type of the values stored in the Vector

template<typename T>
using ResizableVector = ResizableAllocator<Vector<T>>

Allocates the memory, a Vector provides access to, and allows to resize it afterwards.

Template Parameters:

T – The type of the values stored in the Vector

template<typename T>
class Vector : public View<T>
#include <view_vector.hpp>

A one-dimensional view that provides access to values stored in a pre-allocated array of a specific size.

Template Parameters:

T – The type of the values, the view provides access to

Subclassed by IndexableViewDecorator< Vector >, BinaryDokVectorAllocator< Vector >, BinnedVectorDecorator< Vector >, IterableIndexedVectorDecorator< Vector >, ResizableVectorDecorator< Vector >

Public Functions

inline Vector(T *array, std::initializer_list<uint32> dimensions)
Parameters:
  • array – A pointer to an array of template type T that stores the values, the view should provide access to

  • dimensions – The number of elements in each dimension of the view

inline Vector(T *array, uint32 numElements)
Parameters:
  • array – A pointer to an array of template type T that stores the values, the view should provide access to

  • numElements – The number of elements in the view

inline Vector(const Vector<T> &other)
Parameters:

other – A const reference to an object of type Vector that should be copied

inline Vector(Vector<T> &&other)
Parameters:

other – A reference to an object of type Vector that should be moved

inline virtual ~Vector() override
inline View<T>::const_iterator cend() const

Returns a const_iterator to the end of the vector.

Returns:

A const_iterator to the end

inline View<T>::iterator end()

Returns an iterator to the end of the vector.

Returns:

An iterator to the end

inline void clear()

Sets all values stored in the view to zero.

Public Members

uint32 numElements

The number of elements in the view.

struct Equal
#include <view_vector.hpp>

Allows to check whether two objects of type Vector are equal or not.

Public Functions

inline bool operator()(const Vector<T> &lhs, const Vector<T> &rhs) const

Returns whether two objects of type Vector are equal or not.

Parameters:
  • lhs – A reference to a first object of type Vector

  • rhs – A reference to a second object of type Vector

Returns:

True, if the given objects are equal, false otherwise

struct Hash
#include <view_vector.hpp>

Allows to compute hash values for objects of type Vector.

Public Functions

inline std::size_t operator()(const Vector<T> &v) const

Computes and returns a hash value for a given object of type Vector.

Parameters:

v – A reference to an object of type Vector

Returns:

The hash value

template<typename View>
class VectorDecorator : public ViewDecorator<View>
#include <view_vector.hpp>

A vector that is backed by a one-dimensional view of a specific size.

Template Parameters:

View – The type of view, the vector is backed by

Subclassed by ResizableVectorDecorator< VectorDecorator< ResizableVector< float64 > > >

Public Functions

inline VectorDecorator(View &&view)
Parameters:

view – The view, the vector should be backed by

inline virtual ~VectorDecorator() override
inline uint32 getNumElements() const

Returns the number of elements in the vector.

Returns:

The number of elements in the vector

template<typename Vector>
class IterableVectorDecorator : public IndexableViewDecorator<Vector>
#include <view_vector.hpp>

Provides access via iterators to the values stored in a vector.

Template Parameters:

Vector – The type of the vector

Subclassed by ResizableVectorDecorator< DenseVectorDecorator< ResizableVector< uint32 > > >, ResizableVectorDecorator< DenseVectorDecorator< ResizableVector< T > > >, CoverageMask, DenseVector< T >, DenseWeightVector< T >

Public Functions

inline IterableVectorDecorator(typename Vector::view_type &&view)
Parameters:

view – The view, the vector should be backed by

inline virtual ~IterableVectorDecorator() override
inline IndexableViewDecorator<Vector>::const_iterator cend() const

Returns a const_iterator to the end of the vector.

Returns:

A const_iterator to the end

inline IndexableViewDecorator<Vector>::iterator end()

Returns an iterator to the end of the vector.

Returns:

An iterator to the end

template<typename Vector>
class ResizableVectorDecorator : public Vector<T>
#include <view_vector.hpp>

Allows to resize a vector.

Template Parameters:

Vector – The type of the vector

Public Functions

inline ResizableVectorDecorator(typename Vector::view_type &&view)
Parameters:

view – The view, the vector should be backed by

inline virtual ~ResizableVectorDecorator() override
inline virtual void setNumElements(uint32 numElements, bool freeMemory)

Sets the number of elements in the vector.

Parameters:
  • numElements – The number of elements to be set

  • freeMemory – True, if unused memory should be freed, if possible, false otherwise