Image Component Library (ICL)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
Classes | Public Member Functions | Static Protected Member Functions | Protected Attributes | Friends
icl::core::DataSegmentBase Struct Reference

Abstract data segment class. More...

#include <DataSegmentBase.h>

Inheritance diagram for icl::core::DataSegmentBase:
icl::core::DataSegment< T, N > icl::core::DataSegment< T, 1 >

List of all members.

Classes

class  Bytes
 Very simple Byte Vector class to provide binary access to DataSegmentBase data. More...

Public Member Functions

bool isOrganized () const
 returns, whether the segment is 2D-organized
utils::Size getSize () const
 returns the ordred size of the segment of utils::Size::null if it's not organized
int getStride () const
 returns the internal stride used
int getDim () const
 returns the number of elements
core::depth getDepth () const
 returns the actual core::depth (data type) of the entries
int getElemDim () const
 returns the dimension of the contained elements
icl8ugetDataPointer ()
 returns the internal (strided) data pointer
const icl8ugetDataPointer () const
 returns the internal (strided) data pointer
 DataSegmentBase (void *data=0, size_t stride=0, size_t numElements=0, icl32s organizedWidth=-1, core::depth dataDepth=core::depth8u, size_t elemDim=0)
 Constructor with given parameters.
template<class T , int N>
const DataSegment< T, N > & as () const
 shallow and save cast from data segment base to special data segment version
Bytes operator[] (int idx)
 linear index operator
const Bytes operator[] (int idx) const
 linear index operator (const)
Bytes operator() (int x, int y)
 2D-index operator (only for organized data segments)
const Bytes operator() (int x, int y) const
 2D-index operator (only for organized data segments, const)

Static Protected Member Functions

static int getSizeOf (core::depth d)
 associcates a core::depth values and the (byte)-size of the corresponding type

Protected Attributes

icl8udata
 data pointer orign
size_t stride
 stride between elements
size_t numElements
 number of vector elements contained
icl32s organizedWidth
 if > 0 , the data is 2D-organized
core::depth dataDepth
 underlying data depth
size_t elemDim
 vector element dim

Friends

class geom::PointCloudObjectBase
 for easier integration with the pointcloud object base class

Detailed Description

Abstract data segment class.

The DataSegmentBase class is a generic base class for interleaved data sets. It is use as a base class for all versions of the DataSegment class template. While the the latter provides typesave access to all data entries, the DataSegmentBase class provides runtime information about the actual type. The DataSegmentBase::as template method can be used for a type-checked cast into an actual DataSegment type, which provides type-safe access to the reference data.

Data Segments

Data segments allow for an easy access to different types of interleaved data. Internally a single stride value is used to allow for wrapping strided data as well. Examples are given in the DataSegment<T> template class. The following ascii art graphics illustrates the Idea of the data segment:

        consider a data set as a table
           |  x    y    z  timestamp    r    g   b 
        -------------------------------------------
         0 | 2.0  4.3  5.5  3478932    255   0   0
         1 | 2.1  3.3  6.4  3478933     0   255  0
        ...
        

The a DataSegment could e.g. reference the columns x,y and z Where each entry is a 3D vector with float elements. The internal stride is defined by the size of a whole row. But please note that the DataSegment does not provide an internal stride, i.e. the elements of a single vector (here x,y,z) must always be packed in memory.

Further Ideas

DataSegments are only shallow wrappers around data that is mananged externally. Therefore, copying (by copy constructor or assignment) DataSegment instances always leeds to shallow copier.

2D Organization

Data segments can be either 1D or 2D organized. In case of 2D organization, an positive "organizedWidth" value has to be given to the constructor.

Binary Data Access

Since the DataSegmentBase does not provice type-save data access directly, it provides binary data access operators that return instances of the internal untility class DataSegmentBase::Bytes. These can be copied deeply (by simple assignment) and the DataSegmentBase::Bytes class does also provide iterator based access to every byte element


Constructor & Destructor Documentation

icl::core::DataSegmentBase::DataSegmentBase ( void *  data = 0,
size_t  stride = 0,
size_t  numElements = 0,
icl32s  organizedWidth = -1,
core::depth  dataDepth = core::depth8u,
size_t  elemDim = 0 
) [inline]

Constructor with given parameters.


Member Function Documentation

template<class T , int N>
const DataSegment<T,N>& icl::core::DataSegmentBase::as ( ) const

shallow and save cast from data segment base to special data segment version

This function performs a save shallow cast, by evaluating runtime core::depth and dim parameters to throw an instance of utils::ICLException if the targetet type is not compatible

Please note: this function can only be defined after the DataSegment template class definition is available, so you can find it after that class,

returns the internal (strided) data pointer

only for those who know what they are doing

returns the internal (strided) data pointer

only for those who know what they are doing

returns the actual core::depth (data type) of the entries

int icl::core::DataSegmentBase::getDim ( ) const [inline]

returns the number of elements

If the data is 2D-organized, than width*height is returned

returns the dimension of the contained elements

returns the ordred size of the segment of utils::Size::null if it's not organized

static int icl::core::DataSegmentBase::getSizeOf ( core::depth  d) [inline, static, protected]

associcates a core::depth values and the (byte)-size of the corresponding type

int icl::core::DataSegmentBase::getStride ( ) const [inline]

returns the internal stride used

bool icl::core::DataSegmentBase::isOrganized ( ) const [inline]

returns, whether the segment is 2D-organized

Bytes icl::core::DataSegmentBase::operator() ( int  x,
int  y 
) [inline]

2D-index operator (only for organized data segments)

Reimplemented in icl::core::DataSegment< T, 1 >, icl::core::DataSegment< T, N >, and icl::core::DataSegment< float, 4 >.

const Bytes icl::core::DataSegmentBase::operator() ( int  x,
int  y 
) const [inline]

2D-index operator (only for organized data segments, const)

Reimplemented in icl::core::DataSegment< T, 1 >, icl::core::DataSegment< T, N >, and icl::core::DataSegment< float, 4 >.

Bytes icl::core::DataSegmentBase::operator[] ( int  idx) [inline]
const Bytes icl::core::DataSegmentBase::operator[] ( int  idx) const [inline]

Friends And Related Function Documentation

friend class geom::PointCloudObjectBase [friend]

for easier integration with the pointcloud object base class


Member Data Documentation

data pointer orign

underlying data depth

vector element dim

number of vector elements contained

if > 0 , the data is 2D-organized

stride between elements

The stride defines the number of bytes, one has to jump, to get from one vector start to the next start. The unit is byte E.g.

          float data[2*4] = {x,y,z,_, x,y,z, _}; // -> stride = 4*sizeof(float)

The documentation for this struct was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines