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 
66  cvmatrix(const Object *parent, const cvmatrix_descriptor *descriptor,
67  ScalarType const &elementDataType, std::string name = "",
68  uint32_t n = 1);
69 
84  cvmatrix(const Object *parent, uint32_t rows, uint32_t cols,
85  ScalarType const &elementDataType, std::string name = "",
86  uint32_t n = 1);
87 
92  ~cvmatrix();
93 
104  float Value(uint32_t row, uint32_t col) const;
105 
119  float ValueNoMutex(uint32_t row, uint32_t col) const;
120 
130  void SetValue(uint32_t row, uint32_t col, float value);
131 
144  void SetValueNoMutex(uint32_t row, uint32_t col, float value);
145 
151  CvMat *getCvMat(void) const;
152 
163  std::string Name(uint32_t row, uint32_t col) const;
164 
175  IODataElement *Element(uint32_t row, uint32_t col) const;
176 
188  IODataElement *Element(uint32_t index) const;
189 
195  uint32_t Rows(void) const;
196 
202  uint32_t Cols(void) const;
203 
204  Type const &GetDataType() const { return dataType; };
205 
206 private:
215  void CopyDatas(char *dst) const;
216 
217  class cvmatrix_impl *pimpl_;
218  Type dataType;
219 };
220 
221 } // end namespace core
222 } // end namespace flair
223 
224 #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:83
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.