CMatrix Class Reference

Basic standalone OpenViBE matrix implementationThis class offers a basic standalone impementation of the OpenViBE::IMatrix interface. This class can be directly instanciated and used. More...

Inheritance diagram for CMatrix:
IMatrix IObject

Public Member Functions

virtual const OpenViBE::uint32 getDimensionCount (void) const
 Gets the dimension count for this matrix. More...
 
virtual const OpenViBE::uint32 getDimensionSize (const OpenViBE::uint32 ui32DimensionIndex) const
 Gets the dimension size for a given dimension index. More...
 
virtual const char * getDimensionLabel (const OpenViBE::uint32 ui32DimensionIndex, const OpenViBE::uint32 ui32DimensionEntryIndex) const
 Gets the dimension label for a given dimension index / dimension entry index pair. More...
 
virtual const OpenViBE::float64 * getBuffer (void) const
 Gets the raw buffer for this matrix. More...
 
virtual const OpenViBE::uint32 getBufferElementCount (void) const
 Gets the total number of elements in the matrix. More...
 
virtual OpenViBE::boolean setDimensionCount (const OpenViBE::uint32 ui32DimensionCount)
 Sets dimension count for this matrix. More...
 
virtual OpenViBE::boolean setDimensionSize (const OpenViBE::uint32 ui32DimensionIndex, const OpenViBE::uint32 ui32DimensionSize)
 Sets the dimension size for this matrix on a given dimension index. More...
 
virtual OpenViBE::boolean setDimensionLabel (const OpenViBE::uint32 ui32DimensionIndex, const OpenViBE::uint32 ui32DimensionEntryIndex, const char *sDimensionLabel)
 Sets the dimension label for this matrix on a given dimension index / dimension entry index pair. More...
 
virtual OpenViBE::float64 * getBuffer (void)
 Gets a writable raw buffer for this matrix. More...
 
Constructors
 CMatrix (void)
 Default constructor. More...
 
virtual ~CMatrix (void)
 Destructor. More...
 
Accessors
Modifiers
- Public Member Functions inherited from IObject
virtual OpenViBE::CIdentifier getClassIdentifier (void) const =0
 Returns the final class identifier of the concrete class. More...
 
virtual OpenViBE::boolean isDerivedFromClass (const OpenViBE::CIdentifier &rClassIdentifier) const
 Checks if this object is compatible with a class identifier. More...
 
virtual OpenViBE::boolean acceptVisitor (OpenViBE::IObjectVisitor &rObjectVisitor)
 Requests this object to accept a visitor. More...
 

Detailed Description

Basic standalone OpenViBE matrix implementation

This class offers a basic standalone impementation of the OpenViBE::IMatrix interface. This class can be directly instanciated and used.

Author
Yann Renard (INRIA/IRISA)
Date
2007-11-21 Instances of this class use an internal implementation of the OpenViBE::IMatrix interface and redirect their calls to this implementation.

Constructor & Destructor Documentation

CMatrix ( void  )

Default constructor.

This constructor builds the internal implementation of this matrix.

~CMatrix ( void  )
virtual

Destructor.

The internal implementation is released.

Member Function Documentation

const uint32 getDimensionCount ( void  ) const
virtual

Gets the dimension count for this matrix.

Returns
the dimension count for this matrix
Note
Uninitialized matrices should return 0

Implements IMatrix.

const uint32 getDimensionSize ( const OpenViBE::uint32  ui32DimensionIndex) const
virtual

Gets the dimension size for a given dimension index.

Parameters
ui32DimensionIndex[in] : the dimension index which size has to be returned
Returns
the dimension size for the specified dimension index
Note
Each dimension can have a different size

Implements IMatrix.

const char * getDimensionLabel ( const OpenViBE::uint32  ui32DimensionIndex,
const OpenViBE::uint32  ui32DimensionEntryIndex 
) const
virtual

Gets the dimension label for a given dimension index / dimension entry index pair.

Parameters
ui32DimensionIndex[in] : the dimension index
ui32DimensionEntryIndex[in] : the dimension entry index for the specified dimension index
Returns
the dimension label for the given dimension index / dimension entry index pair
Note
The string is permanent pointer until the dimension size or the label itself changes

Implements IMatrix.

const float64 * getBuffer ( void  ) const
virtual

Gets the raw buffer for this matrix.

Returns
the raw buffer for this matrix
Note
The raw buffer is permanent pointer until the dimension count or any dimension size changes

When the raw buffer is acquired, the elements are accessed sequentially, using each dimension after the other. Suppose a matrix of 2 dimensions. First dimension size is 2 and second dimension size is 3 :

IMatrix* l_pMatrix= // ...
l_pMatrix->setDimensionCount(2);
l_pMatrix->setDimensionSize(0, 2);
l_pMatrix->setDimensionSize(1, 3);
float64* l_pMatrixRawBuffer=l_pMatrix->getBuffer();
l_pMatrixRawBuffer[0]; // this is l_pMatrixRawBuffer[0*3 + 0];
l_pMatrixRawBuffer[1]; // this is l_pMatrixRawBuffer[0*3 + 1];
l_pMatrixRawBuffer[2]; // this is l_pMatrixRawBuffer[0*3 + 2];
l_pMatrixRawBuffer[3]; // this is l_pMatrixRawBuffer[1*3 + 0];
l_pMatrixRawBuffer[4]; // this is l_pMatrixRawBuffer[1*3 + 1];
l_pMatrixRawBuffer[5]; // this is l_pMatrixRawBuffer[1*3 + 2];
l_pMatrixRawBuffer[i*3+j]; // this is index i of the first dimension, and j of the second dimension
See also
getBufferElementCount

Implements IMatrix.

const uint32 getBufferElementCount ( void  ) const
virtual

Gets the total number of elements in the matrix.

Returns
the total number of elements in the matrix
Note
The value returned by this function is the size of the raw buffer returned by getBuffer

Implements IMatrix.

boolean setDimensionCount ( const OpenViBE::uint32  ui32DimensionCount)
virtual

Sets dimension count for this matrix.

Parameters
ui32DimensionCount[in] : the number of dimension for this matrix
Returns
true in case of success.
false in case of error.

Implements IMatrix.

boolean setDimensionSize ( const OpenViBE::uint32  ui32DimensionIndex,
const OpenViBE::uint32  ui32DimensionSize 
)
virtual

Sets the dimension size for this matrix on a given dimension index.

Parameters
ui32DimensionIndex[in] : the dimension index which size has to be changed
ui32DimensionSize[in] : the new dimension size for this dimension
Returns
true in case of success.
false in case of error.

Implements IMatrix.

boolean setDimensionLabel ( const OpenViBE::uint32  ui32DimensionIndex,
const OpenViBE::uint32  ui32DimensionEntryIndex,
const char *  sDimensionLabel 
)
virtual

Sets the dimension label for this matrix on a given dimension index / dimension entry index pair.

Parameters
ui32DimensionIndex[in] : the dimension index
ui32DimensionEntryIndex[in] : the entry index in the specificed dimension which label has to be changed
sDimensionLabel[in] : the new dimension label to apply to this dimension index / dimension entry index pair
Returns
true in case of success.
false in case of error.

Implements IMatrix.

float64 * getBuffer ( void  )
virtual

Gets a writable raw buffer for this matrix.

Returns
the raw buffer for this matrix
Note
The raw buffer is permanent pointer until the dimension count or any dimension size changes
See also
IMatrix::getBufferElementCount
IMatrix::getBuffer const

Implements IMatrix.