OpenWalnut  1.4.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Friends
WValueSet< T > Class Template Reference

Base Class for all value set types. More...

#include <WValueSet.h>

+ Inheritance diagram for WValueSet< T >:

List of all members.

Classes

class  SubArray
 A helper class granting safe access to a certain part of the valueset. More...

Public Types

typedef T ValueT
 The type of the single value in this value set.

Public Member Functions

 WValueSet (size_t order, size_t dimension, const boost::shared_ptr< std::vector< T > > data, dataType inDataType)
 Constructs a value set with values of type T.
 WValueSet (size_t order, size_t dimension, const boost::shared_ptr< std::vector< T > > data)
 Constructs a value set with values of type T.
virtual size_t size () const
virtual size_t rawSize () const
virtual T getScalar (size_t i) const
virtual double getScalarDouble (size_t i) const
virtual WValue< double > getWValueDouble (size_t i) const
WVector3d getVector3D (size_t index) const
 Get the i'th vector.
WValue< T > getWValue (size_t index) const
 Get the i'th WValue with the dimension of WValueSet.
const T * rawData () const
 Sometimes we need raw access to the data array, for e.g.
const std::vector< T > * rawDataVectorPointer () const
 Sometimes we need raw access to the data vector.
SubArray const getSubArray (std::size_t start, std::size_t size) const
 Request (read-) access object to a subarray of this valueset.
virtual double getMinimumValue () const
 This method returns the smallest value in the valueset.
virtual double getMaximumValue () const
 This method returns the largest value in the valueset.

Static Public Member Functions

static size_t getRequiredRawSizePerVoxel (size_t oder, size_t dimension)
 Calculates the needed number of integral values for a valueset with specified order and dimension for one voxel.

Protected Attributes

m_minimum
 The smallest value in m_data.
m_maximum
 The largest value in m_data.

Private Member Functions

virtual WValueSetVariant const getVariant () const
 Get a variant reference to this valueset (the reference is stored in the variant).

Private Attributes

const boost::shared_ptr
< std::vector< T > > 
m_data
 Stores the values of type T as simple array which never should be modified.

Friends

class WValueSetTest
 Only UnitTests are allowed to be friends.

Detailed Description

template<typename T>
class WValueSet< T >

Base Class for all value set types.

Definition at line 46 of file WValueSet.h.


Member Typedef Documentation

template<typename T>
typedef T WValueSet< T >::ValueT

The type of the single value in this value set.

Definition at line 57 of file WValueSet.h.


Constructor & Destructor Documentation

template<typename T>
WValueSet< T >::WValueSet ( size_t  order,
size_t  dimension,
const boost::shared_ptr< std::vector< T > >  data,
dataType  inDataType 
) [inline]

Constructs a value set with values of type T.

Sets order and dimension to allow to interpret the values as tensors of a certain order and dimension.

Parameters:
ordertensor order of values stored in the value set
dimensiontensor dimension of values stored in the value set
datathe vector holding the raw data
inDataTypeindicator telling us which dataType comes in

Definition at line 122 of file WValueSet.h.

References WValueSet< T >::m_maximum, and WValueSet< T >::m_minimum.

template<typename T>
WValueSet< T >::WValueSet ( size_t  order,
size_t  dimension,
const boost::shared_ptr< std::vector< T > >  data 
) [inline]

Constructs a value set with values of type T.

Sets order and dimension to allow to interpret the values as tensors of a certain order and dimension.

Parameters:
ordertensor order of values stored in the value set
dimensiontensor dimension of values stored in the value set
datathe vector holding the raw data

Definition at line 144 of file WValueSet.h.

References WValueSet< T >::m_maximum, and WValueSet< T >::m_minimum.


Member Function Documentation

template<typename T>
virtual double WValueSet< T >::getMaximumValue ( ) const [inline, virtual]

This method returns the largest value in the valueset.

It does not handle vectors, matrices and so on well. It simply returns the largest value in the data array. This is especially useful for texture scaling or other statistic tools (histograms).

Returns:
the largest value in the data.

Implements WValueSetBase.

Definition at line 289 of file WValueSet.h.

References WValueSet< T >::m_maximum.

template<typename T>
virtual double WValueSet< T >::getMinimumValue ( ) const [inline, virtual]

This method returns the smallest value in the valueset.

It does not handle vectors, matrices and so on well. It simply returns the smallest value in the data array. This is especially useful for texture scaling or other statistic tools (histograms).

Returns:
the smallest value in the data.

Implements WValueSetBase.

Definition at line 278 of file WValueSet.h.

References WValueSet< T >::m_minimum.

template<typename T >
size_t WValueSet< T >::getRequiredRawSizePerVoxel ( size_t  oder,
size_t  dimension 
) [static]

Calculates the needed number of integral values for a valueset with specified order and dimension for one voxel.

The whole dataset will then be as large as the number of voxels multiplied by this value.

Parameters:
oderdesired tensor order.
dimensiondesired dimension.
Returns:
the number of values needed

Definition at line 357 of file WValueSet.h.

References WValueSetBase::dimension().

template<typename T>
virtual T WValueSet< T >::getScalar ( size_t  i) const [inline, virtual]
Parameters:
iid of the scalar to retrieve
Returns:
The i-th scalar stored in this value set. There are rawSize() such scalars.

Definition at line 193 of file WValueSet.h.

References WValueSet< T >::m_data.

Referenced by WDataSetSingle::getValueAt().

template<typename T>
virtual double WValueSet< T >::getScalarDouble ( size_t  i) const [inline, virtual]
Parameters:
iid of the scalar to retrieve
Returns:
The i-th scalar stored in this value set. There are rawSize() such scalars.

Implements WValueSetBase.

Definition at line 202 of file WValueSet.h.

References WValueSet< T >::m_data.

template<typename T>
SubArray const WValueSet< T >::getSubArray ( std::size_t  start,
std::size_t  size 
) const [inline]

Request (read-) access object to a subarray of this valueset.

The object returned by this function can be used as an array ( starting at index 0 ), whose elements are the data elements at positions start to ( including ) start + size - 1 of the valueset.

Parameters:
startThe position of the first element of the subarray.
sizeThe number of elements in the subarray.
Returns:
The subarray.

Definition at line 265 of file WValueSet.h.

References WValueSet< T >::rawData(), and WValueSet< T >::rawSize().

template<typename T>
virtual WValueSetVariant const WValueSet< T >::getVariant ( ) const [inline, private, virtual]

Get a variant reference to this valueset (the reference is stored in the variant).

Notes:
Use this as a temporary object inside a function or something like that.
Returns:
var A variant reference.

Reimplemented from WValueSetBase.

Definition at line 326 of file WValueSet.h.

template<typename T >
WVector3d WValueSet< T >::getVector3D ( size_t  index) const

Get the i'th vector.

Parameters:
indexthe index number of the vector
Returns:
the vector

Definition at line 332 of file WValueSet.h.

References WValueSet< T >::m_data, WValueSetBase::m_dimension, and WValueSetBase::m_order.

template<typename T >
WValue< T > WValueSet< T >::getWValue ( size_t  index) const

Get the i'th WValue with the dimension of WValueSet.

Parameters:
indexthe index number of the WValue
Returns:
a WValue with the dimension WValueSet

Definition at line 340 of file WValueSet.h.

References WValueSet< T >::m_data, WValueSetBase::m_dimension, WValueSetBase::m_order, and WValueSet< T >::size().

Referenced by WValueSet< T >::getWValueDouble(), and WValueSetTest::testGetWValue().

template<typename T>
virtual WValue< double > WValueSet< T >::getWValueDouble ( size_t  i) const [inline, virtual]
Parameters:
iid of the WValue to retrieve
Returns:
The i-th WValue stored in this value set. There are size() such scalars.

Implements WValueSetBase.

Definition at line 211 of file WValueSet.h.

References WValueSet< T >::getWValue().

template<typename T>
const T* WValueSet< T >::rawData ( ) const [inline]

Sometimes we need raw access to the data array, for e.g.

OpenGL.

Returns:
the raw data pointer

Definition at line 240 of file WValueSet.h.

References WValueSet< T >::m_data.

Referenced by WValueSet< T >::getSubArray(), and WValueSetTest::testReadOnlyRawAccess().

template<typename T>
const std::vector< T >* WValueSet< T >::rawDataVectorPointer ( ) const [inline]

Sometimes we need raw access to the data vector.

Returns:
the data vector

Definition at line 250 of file WValueSet.h.

References WValueSet< T >::m_data.

template<typename T>
virtual size_t WValueSet< T >::rawSize ( ) const [inline, virtual]
Returns:
The number of integral types stored in this set.

Implements WValueSetBase.

Definition at line 184 of file WValueSet.h.

References WValueSet< T >::m_data, and WValueSet< T >::size().

Referenced by WValueSet< T >::getSubArray(), WValueSet< T >::size(), and WValueSetTest::testRawSize().

template<typename T>
virtual size_t WValueSet< T >::size ( ) const [inline, virtual]

Friends And Related Function Documentation

template<typename T>
friend class WValueSetTest [friend]

Only UnitTests are allowed to be friends.

Definition at line 51 of file WValueSet.h.


Member Data Documentation

template<typename T>
const boost::shared_ptr< std::vector< T > > WValueSet< T >::m_data [private]
template<typename T>
T WValueSet< T >::m_maximum [protected]
template<typename T>
T WValueSet< T >::m_minimum [protected]

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