FiberVISH 0.2
Fish - The Fiber Bundle API for the Vish Visualization Shell
Public Types | Public Member Functions | Public Attributes | List of all members
Fiber::ArrayRef< T, N > Class Template Reference

An array reference class, which is a convenience class for reference pointers to multidimensional memory arrays. More...

#include <ArrayRef.hpp>

Public Types

typedef MemArray< N, T > MemArray_t
 
typedef MultiArray< N, T > MultiArray_t
 
typedef std::vector< T > Storage_t
 
typedef MultiArray_t::reference_t reference_t
 
typedef std::vector< T >::iterator iterator
 Access via std vector iterator.
 
typedef std::vector< T >::const_iterator const_iterator
 Access via constant std vector iterator.
 

Public Member Functions

RefPtr< MemCore::TypedChunk< T > > getTypedStorage () const
 Return chunk to stored memory.
 
 ArrayRef (const ArrayRef &AF)
 
 ArrayRef (const MultiIndex< N > &NumberOfElements, const MemBase::Creator_t &C=MemCore::NullPtr())
 Construct from size, allocate new memory during construction.
 
reference_t operator[] (const index_t &i)
 Element access via one-dimensional index.
 
const reference_t operator[] (const index_t &i) const
 Read-only element access via one-dimensional index.
 
reference_t operator[] (const MultiIndex< N > &I)
 Element access via multidimensional index.
 
const reference_t operator[] (const MultiIndex< N > &I) const
 Read-only element access via multidimensional index.
 
iterator begin ()
 
iterator end ()
 
const_iterator begin () const
 
const_iterator end () const
 
const MultiIndex< N > & Size () const
 
size_t size () const
 
MultiArray< N, T > & operator* ()
 
const MultiArray< N, T > & operator* () const
 
 operator RefPtr< MemBase > () const
 Conversion operator to MemBase, so a ArrayRef can be used in all places where a MemBase is expected, for instance when setting up a Field.
 
RefPtr< MemBaseoperator-> () const
 

Public Attributes

const MemCore::Ref< MemArray< N, T > > myMemArray
 Stored memory.
 
MultiArray< N, T > & Data
 Reference to multidimensional data array.
 
Storage_tDataStorage
 Reference to internal storage as std::vector.
 

Detailed Description

template<class T, int N = 1>
class Fiber::ArrayRef< T, N >

An array reference class, which is a convenience class for reference pointers to multidimensional memory arrays.

It allows easy creation of a multidimensional memory-managed array with efficient access to the array elements through one-dimensional and multi-dimensional indices.

Note that the template arguments are \i reversed as compared with MemArray and MultiArray. This is to allow default template arguments for the dimenions for convenience, such that it is sufficient to define just the type of the array.

Parameters
TThe type of the array
NThe dimension of the array, one by default if left unspecified.
Author
Werner Benger
Examples
ModifyingPointCloudRange.cpp.