cgv
cgv::data::data_view_impl< D, P > Class Template Reference

#include <data_view.h>

Inheritance diagram for cgv::data::data_view_impl< D, P >:
cgv::data::data_view_base

Public Member Functions

 data_view_impl (const data_format *_format=0, typename cgv::type::func::transfer_const< P, void * >::type _data_ptr=0)
 construct a data view from the given format, viewing the complete data set
 
bool empty () const
 return whether the data pointer is a null pointer
 
template<typename S >
cgv::type::func::transfer_const< P, S * >::type get_ptr () const
 return a data pointer to type S
 
template<typename S >
cgv::type::func::transfer_const< P, S * >::type get_ptr (int i) const
 return a pointer to type S for i-th data entry
 
template<typename S >
cgv::type::func::transfer_const< P, S * >::type get_ptr (int i, int j) const
 return a pointer to type S for (i,j)-th data entry
 
template<typename S >
cgv::type::func::transfer_const< P, S * >::type get_ptr (int i, int j, int k) const
 return a pointer to type S for (i,j,k)-th data entry
 
template<typename S >
cgv::type::func::transfer_const< P, S * >::type get_ptr (int i, int j, int k, int l) const
 return a pointer to type S for (i,j,k,l)-th data entry
 
template<typename S >
get (int ci) const
 constant access to the ci-th component
 
template<typename S >
get (int ci, int i) const
 constant access to the ci-th component of i-th data entry
 
template<typename S >
get (int ci, int i, int j) const
 constant access to the ci-th component of (i,j)-th data entry
 
template<typename S >
get (int ci, int i, int j, int k) const
 constant access to the ci-th component of (i,j,k)-th data entry
 
template<typename S >
get (int ci, int i, int j, int k, int l) const
 constant access to the ci-th component of (i,j,k,l)-th data entry
 
operator() (unsigned int i) const
 access to i-th data entry
 
operator() (unsigned int i, unsigned int j) const
 access to entry at (i,j)
 
operator() (unsigned int i, unsigned int j, unsigned int k) const
 access to entry at (i,j,k)
 
operator() (unsigned int i, unsigned int j, unsigned int k, unsigned int l) const
 access to entry at (i,j,k,l)
 
permute (const std::string &permutation) const
 
transpose () const
 transpose is equivalent to permute("ji")
 
template<typename S >
cgv::type::func::transfer_const< P, S * >::type step_i (S *ptr, int n=1) const
 return a pointer that points to the n-th next location if index i is increase by n
 
template<typename S >
cgv::type::func::transfer_const< P, S * >::type step_j (S *ptr, int n=1) const
 return a pointer that points to the n-th next location if index j is increase by n
 
template<typename S >
cgv::type::func::transfer_const< P, S * >::type step_k (S *ptr, int n=1) const
 return a pointer that points to the n-th next location if index k is increase by n
 
template<typename S >
cgv::type::func::transfer_const< P, S * >::type step_l (S *ptr, int n=1) const
 return a pointer that points to the n-th next location if index l is increase by n
 
void manage_format (bool enable=true)
 whether to manage the data format pointer
 
const data_formatget_format () const
 return the component format
 
void set_format (const data_format *_format)
 set a new data format
 
unsigned int get_dim () const
 return the dimension of the data view, which is less or equal to the dimension of the data format
 
unsigned int get_step_size (unsigned int dim) const
 return the step size in bytes in the i-th dimension
 

Protected Member Functions

 data_view_impl (const data_format *_format, P _data_ptr, unsigned int _dim, const unsigned int *_step_sizes)
 constructor used to construct sub views onto the data view
 

Protected Attributes

data_ptr
 data pointer of type unsigned char or const unsigned char
 
bool owns_format
 whether to own the data format
 

Detailed Description

template<class D, typename P = unsigned char*>
class cgv::data::data_view_impl< D, P >

template class implementing the part of the view that depends on whether the pointer is const or not and manages the data pointer itself.

Member Function Documentation

◆ permute()

template<class D , typename P >
D cgv::data::data_view_impl< D, P >::permute ( const std::string &  permutation) const

permute the order of the indices, where the permutation argument "kji" implies that after the permutation the operator (i,j,k) returns the same as the operator (k,j,i) before the call to permute. The permutation string must have at least two entries. If it has n entries it must contain each of the first n letters of "ijkl" exactly once, i.e. "ik" would be invalid, whereas "ikj" is a valid permutation.


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