Concrete matrix without memory management.
More...
#include <MatrixWrapper.h>
|
| | MatrixWrapper (const unsigned int bufferSize, uint8_t *const buffer) |
| |
| | MatrixWrapper () |
| |
| virtual const VariantHandle & | variant () const |
| |
| virtual uint8_t * | buffer () |
| |
| virtual unsigned int | bufferSize () const |
| |
| virtual unsigned int | rows () const |
| |
| virtual unsigned int | cols () const |
| |
| virtual unsigned int | stride () const |
| |
| virtual ValueType | valueType () const |
| |
| virtual uint8_t * | data () |
| |
| virtual const uint8_t * | data () const |
| |
| virtual void | initializeMatrix (const unsigned int rows, const unsigned int cols, const unsigned int stride, uint8_t *data, const ValueType valueType) |
| |
| virtual void | serialize (OutputProvider &output) const |
| |
| virtual void | deserialize (InputProvider &input, const Version &version) |
| |
| void | resize (const unsigned int rows, const unsigned int cols, const ValueType valueType) |
| |
| void | resize (const unsigned int size) |
| |
| void | open (const std::string &filename) |
| |
| void | save (const std::string &filename) const |
| |
| virtual unsigned int | valueSize () const |
| |
| template<class T > |
| T & | at (const unsigned row, const unsigned col) |
| |
| template<class T > |
| const T & | at (const unsigned int row, const unsigned col) const |
| |
| template<class T > |
| const T | value (const unsigned int row, const unsigned int col) const |
| |
| virtual const Version & | version () const =0 |
| |
| virtual const std::string & | type () const =0 |
| |
| virtual const std::string & | package () const =0 |
| |
| virtual Data * | clone () const =0 |
| |
| bool | isVariant (const VariantInterface &v) const |
| |
Concrete matrix without memory management.
§ MatrixWrapper() [1/2]
| stromx::runtime::MatrixWrapper::MatrixWrapper |
( |
const unsigned int |
bufferSize, |
|
|
uint8_t *const |
buffer |
|
) |
| |
Constructs an matrix wrapper from a given memory buffer. The buffer is not owned by the matrix and is thus not freed upon destruction of the matrix wrapper.
§ MatrixWrapper() [2/2]
| stromx::runtime::MatrixWrapper::MatrixWrapper |
( |
| ) |
|
Constructs an empty matrix wrapper, i.e. is an matrix wrapper without associated memory buffer.
§ allocate()
| virtual void stromx::runtime::MatrixWrapper::allocate |
( |
const unsigned int |
rows, |
|
|
const unsigned int |
cols, |
|
|
const runtime::Matrix::ValueType |
valueType |
|
) |
| |
|
protectedpure virtual |
Allocates or resizes the matrix to the given dimension. Must be defined in derived class which implement the memory management. Implementations of this function should call setBuffer() and initializeMatrix().
- Since
- 0.2
§ buffer()
| virtual uint8_t* stromx::runtime::MatrixWrapper::buffer |
( |
| ) |
|
|
inlinevirtual |
Returns the address of the buffer of the matrix. This is not necessarily a pointer to the matrix data which can be located at a different position in the buffer.
Implements stromx::runtime::Matrix.
§ bufferSize()
| virtual unsigned int stromx::runtime::MatrixWrapper::bufferSize |
( |
| ) |
const |
|
inlinevirtual |
§ cols()
| virtual unsigned int stromx::runtime::MatrixWrapper::cols |
( |
| ) |
const |
|
inlinevirtual |
§ data() [1/2]
| virtual uint8_t* stromx::runtime::MatrixWrapper::data |
( |
| ) |
|
|
inlinevirtual |
§ data() [2/2]
| virtual const uint8_t* stromx::runtime::MatrixWrapper::data |
( |
| ) |
const |
|
inlinevirtual |
§ deserialize()
Deserializes a data object.
- Parameters
-
| out | The input which the data obtained from. |
| version | The version of the data class which serialized the input. |
Reimplemented from stromx::runtime::Data.
§ initializeMatrix()
| void stromx::runtime::MatrixWrapper::initializeMatrix |
( |
const unsigned int |
rows, |
|
|
const unsigned int |
cols, |
|
|
const unsigned int |
stride, |
|
|
uint8_t * |
data, |
|
|
const ValueType |
valueType |
|
) |
| |
|
virtual |
Initializes the matrix to the given data. Note that this function does not change the matrix buffer but merely changes the description of the data contained in the matrix buffer.
Implements stromx::runtime::Matrix.
§ open()
| void stromx::runtime::MatrixWrapper::open |
( |
const std::string & |
filename | ) |
|
Reads the file filename. The data of the current matrix is replaced by the data of the new image.
§ resize() [1/2]
| void stromx::runtime::MatrixWrapper::resize |
( |
const unsigned int |
rows, |
|
|
const unsigned int |
cols, |
|
|
const ValueType |
valueType |
|
) |
| |
Resizes the matrix and changes the value type of the matrix.
§ resize() [2/2]
| void stromx::runtime::MatrixWrapper::resize |
( |
const unsigned int |
size | ) |
|
Resizes the buffer of the matrix to the given size in bytes. The resized matrix has 1 row and size columns. Its value type is Matrix::NONE. The buffer size of the matrix is guaranteed to be at least size.
§ rows()
| virtual unsigned int stromx::runtime::MatrixWrapper::rows |
( |
| ) |
const |
|
inlinevirtual |
§ save() [1/2]
| void stromx::runtime::MatrixWrapper::save |
( |
const std::string & |
filename, |
|
|
const runtime::Matrix & |
matrix |
|
) |
| |
|
static |
Saves the input matrix to filename. The matrix is stored in the NPY format.
§ save() [2/2]
| void stromx::runtime::MatrixWrapper::save |
( |
const std::string & |
filename | ) |
const |
Saves the matrix to the file filename. The matrix is stored in the NPY format.
§ serialize()
| void stromx::runtime::MatrixWrapper::serialize |
( |
OutputProvider & |
out | ) |
const |
|
virtual |
Serializes this data object.
- Parameters
-
| out | The output which the data is sent to. |
Reimplemented from stromx::runtime::Data.
§ setBuffer()
| void stromx::runtime::MatrixWrapper::setBuffer |
( |
uint8_t *const |
buffer, |
|
|
const unsigned int |
bufferSize |
|
) |
| |
|
protected |
Sets a new matrix buffer. Note that the matrix data defined by dimensions of the matrix value type and data must always be contained in the matrix buffer.
- Parameters
-
| buffer | The new buffer. Note that this memory is not released by the MatrixWrapper. |
| bufferSize | The size of buffer in bytes. |
§ stride()
| virtual unsigned int stromx::runtime::MatrixWrapper::stride |
( |
| ) |
const |
|
inlinevirtual |
§ valueType()
| virtual ValueType stromx::runtime::MatrixWrapper::valueType |
( |
| ) |
const |
|
inlinevirtual |
§ variant()
| virtual const VariantHandle& stromx::runtime::MatrixWrapper::variant |
( |
| ) |
const |
|
inlinevirtual |
The documentation for this class was generated from the following files: