LTL  2.0.x
Public Member Functions | Protected Attributes | List of all members
ltl::FVMemory< T, N, S > Class Template Reference

Memory and data access interface for ltl::FVMemory. More...

Inherited by ltl::FVector< bool, NPAR >, ltl::FVector< double, N >, ltl::FVector< TPAR, NPAR >, and ltl::FVector< T, N, S >.

Public Member Functions

 FVMemory ()
 
 FVMemory (T *const data)
 construct as a reference to the memory pointed to by data. More...
 
T * data ()
 Return a pointer to the data. More...
 
T * data () const
 Return a const pointer to the data. More...
 
operator[] (const int i) const
 Access elements with zero-based index i. More...
 
T & operator[] (const int i)
 Access elements with zero-based index i. More...
 
operator() (const int i) const
 Access elements with one-based index i. More...
 
T & operator() (const int i)
 Access elements with one-based index i. More...
 

Protected Attributes

T * __data_
 points to first element of data block for 0-based access More...
 

Detailed Description

template<class T, int N, int S>
class ltl::FVMemory< T, N, S >

Memory and data access interface for ltl::FVMemory.

The ltl::FVMemory objects implement the memory access interface of the ltl::FVector object, i.e. operator() for 1-based access and operator[] for 0-based access. References N objects of type T accessible through a T* with stride S.

The template parameter S is the stride which may be != 1, such that column vectors of ltl::FVMatrix can be referenced as ltl::FVector objects.

There is a general implementation (this one) and a specialization for S=0. S!=0 indicates that this instance is a reference to foreign storage. S is then the stride used to access the memory elements. The specialization for S=0 below is used for instances that hold there own memory (i.e. ltl::FVector objects) that have their own memory, not references to other ltl::FVector objects. In this case the physical stride is one.

FVMemory does not require more memory than is necessary to store the N elements of the vector if S=0. If S>0, the size is exactly sizeof(T*).

Constructor & Destructor Documentation

template<class T, int N, int S>
ltl::FVMemory< T, N, S >::FVMemory ( )
inline
template<class T, int N, int S>
ltl::FVMemory< T, N, S >::FVMemory ( T *const  data)
inline

construct as a reference to the memory pointed to by data.

Member Function Documentation

template<class T, int N, int S>
T ltl::FVMemory< T, N, S >::operator[] ( const int  i) const
inline

Access elements with zero-based index i.

template<class T, int N, int S>
T& ltl::FVMemory< T, N, S >::operator[] ( const int  i)
inline

Access elements with zero-based index i.

template<class T, int N, int S>
T ltl::FVMemory< T, N, S >::operator() ( const int  i) const
inline

Access elements with one-based index i.

template<class T, int N, int S>
T& ltl::FVMemory< T, N, S >::operator() ( const int  i)
inline

Access elements with one-based index i.

template<class T, int N, int S>
T* ltl::FVMemory< T, N, S >::data ( )
inline

Return a pointer to the data.

template<class T, int N, int S>
T* ltl::FVMemory< T, N, S >::data ( ) const
inline

Return a const pointer to the data.

Member Data Documentation

template<class T, int N, int S>
T* ltl::FVMemory< T, N, S >::__data_
protected