Flair
Framework Libre Air
cvmatrix.h
Go to the documentation of this file.
1 // %flair:license{
2 // This file is part of the Flair framework distributed under the
3 // CECILL-C License, Version 1.0.
4 // %flair:license}
13 #ifndef CVMATRIX_H
14 #define CVMATRIX_H
15 
16 #include <io_data.h>
17 #include <IODataElement.h>
18 #include <cvmatrix_descriptor.h>
19 
20 class cvmatrix_impl;
21 struct CvMat;
22 
23 namespace flair {
24 namespace core {
25 
33 class cvmatrix : public io_data {
34 public:
35  class Type : public DataType {
36  public:
37  Type(size_t _nbRows, size_t _nbCols, ScalarType const &_elementDataType)
38  : nbRows(_nbRows), nbCols(_nbCols), elementDataType(_elementDataType) {}
39  size_t GetSize() const {
40  return nbRows * nbCols * elementDataType.GetSize();
41  }
42  std::string GetDescription() const { return "matrix"; }
43  size_t GetNbRows() const { return nbRows; }
44  size_t GetNbCols() const { return nbCols; }
45  ScalarType const &GetElementDataType() const { return elementDataType; }
46 
47  private:
48  size_t nbRows, nbCols;
49  ScalarType const &elementDataType;
50  };
51 
65  cvmatrix(const Object *parent, const cvmatrix_descriptor *descriptor,
66  ScalarType const &elementDataType, std::string name = "",
67  uint32_t n = 1);
68 
82  cvmatrix(const Object *parent, uint32_t rows, uint32_t cols,
83  ScalarType const &elementDataType, std::string name = "",
84  uint32_t n = 1);
85 
90  ~cvmatrix();
91 
102  float Value(uint32_t row, uint32_t col) const;
103 
117  float ValueNoMutex(uint32_t row, uint32_t col) const;
118 
128  void SetValue(uint32_t row, uint32_t col, float value);
129 
142  void SetValueNoMutex(uint32_t row, uint32_t col, float value);
143 
149  CvMat *getCvMat(void) const;
150 
161  std::string Name(uint32_t row, uint32_t col) const;
162 
173  IODataElement *Element(uint32_t row, uint32_t col) const;
174 
186  IODataElement *Element(uint32_t index) const;
187 
193  uint32_t Rows(void) const;
194 
200  uint32_t Cols(void) const;
201 
202  Type const &GetDataType() const { return dataType; };
203 
204 private:
213  void CopyDatas(char *dst) const;
214 
215  class cvmatrix_impl *pimpl_;
216  Type dataType;
217 };
218 
219 } // end namespace core
220 } // end namespace flair
221 
222 #endif // CVMATRIX_H
Abstract class for data types.
Definition: io_data.h:94
Definition: io_data.h:26
Base class for all Framework's classes.
Definition: Object.h:77
namespace of the flair Framework
Definition: Ahrs.h:19
Class defining a matrix of kind CvMat.
Definition: cvmatrix.h:33
Abstract class for data types.
Class describing cvmatrix elements, for log and graphs purpose.
Definition: cvmatrix_descriptor.h:28
float ValueNoMutex(uint32_t row, uint32_t col) const
Element value.
void SetValueNoMutex(uint32_t row, uint32_t col, float value)
Set element value.
void SetValue(uint32_t row, uint32_t col, float value)
Set element value.
uint32_t Rows(void) const
Number of rows.
Abstract class for accessing an element of an io_data.
cvmatrix(const Object *parent, const cvmatrix_descriptor *descriptor, ScalarType const &elementDataType, std::string name="", uint32_t n=1)
Constructor.
~cvmatrix()
Destructor.
Definition: io_data.h:40
Definition: cvmatrix.h:35
Class describing cvmatrix elements, for log and graphs purpose.
std::string Name(uint32_t row, uint32_t col) const
Element name.
Abstract class for accessing an element of an io_data.
Definition: IODataElement.h:27
IODataElement * Element(uint32_t row, uint32_t col) const
Element.
uint32_t Cols(void) const
Number of colomns.
CvMat * getCvMat(void) const
get CvMat
float Value(uint32_t row, uint32_t col) const
Element value.