Changeset 15 in flair-src for trunk/lib/FlairCore/src/cvmatrix.h


Ignore:
Timestamp:
Apr 8, 2016, 3:40:57 PM (6 years ago)
Author:
Bayard Gildas
Message:

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairCore/src/cvmatrix.h

    r2 r15  
    2121struct CvMat;
    2222
    23 namespace flair { namespace core {
    24 
    25     /*! \class cvmatrix
    26     *
    27     * \brief Class defining a matrix of kind CvMat
    28     *
    29     * CvMat is a matrix struct defined in OpenCV.
    30     *
    31     */
    32     class cvmatrix: public io_data {
    33     public:
    34         class Type: public DataType {
    35         public:
    36             Type(size_t _nbRows,size_t _nbCols,ScalarType const &_elementDataType):nbRows(_nbRows),nbCols(_nbCols),elementDataType(_elementDataType) {}
    37             size_t GetSize() const {
    38                 return nbRows*nbCols*elementDataType.GetSize();
    39             }
    40             std::string GetDescription() const {return "matrix";}
    41             size_t GetNbRows() const {return nbRows;}
    42             size_t GetNbCols() const {return nbCols;}
    43             ScalarType const &GetElementDataType() const {return elementDataType;}
    44 
    45         private:
    46             size_t nbRows,nbCols;
    47             ScalarType const &elementDataType;
    48         };
    49 
    50         /*!
    51         * \brief Constructor
    52         *
    53         * Construct an io_data representing a CvMat. \n
    54         * It uses a cvmatrix_descriptor to get size and elements' names. \n
    55         * Names are used for graphs and logs.
    56         *
    57         * \param parent parent
    58         * \param descriptor matrix description
    59         * \param type type of matrix elements
    60         * \param name name
    61         * \param n number of samples
    62         */
    63         cvmatrix(const Object* parent,const cvmatrix_descriptor *descriptor, ScalarType const &elementDataType,std::string name="",uint32_t n=1);
    64 
    65         /*!
    66         * \brief Constructor
    67         *
    68         * Construct an io_data representing a CvMat. \n
    69         * Elements are unamed.
    70         *
    71         * \param parent parent
    72         * \param rows matrix rows
    73         * \param cols matrix cols
    74         * \param type type of matrix elements
    75         * \param name name
    76         * \param n number of samples
    77         */
    78         cvmatrix(const Object* parent,uint32_t rows, uint32_t cols, ScalarType const &elementDataType,std::string name="",uint32_t n=1);
    79 
    80         /*!
    81         * \brief Destructor
    82         *
    83         */
    84         ~cvmatrix();
    85 
    86         /*!
    87         * \brief Element value
    88         *
    89         * Element is accessed by locking and unlocking the io_data Mutex.
    90         *
    91         * \param row element row
    92         * \param col element col
    93         *
    94         * \return element value
    95         */
    96         float Value(uint32_t row, uint32_t col) const;
    97 
    98         /*!
    99         * \brief Element value
    100         *
    101         * Element is not accessed by locking and unlocking the io_data Mutex. \n
    102         * Thus, this function should be called with Mutex locked. \n
    103         * This function is usefull when multiple successive access are done to the
    104         * elments of the matrix. It avoids unnecessary locking and unlocking.
    105         *
    106         * \param row element row
    107         * \param col element col
    108         *
    109         * \return element value
    110         */
    111         float ValueNoMutex(uint32_t row, uint32_t col) const;
    112 
    113         /*!
    114         * \brief Set element value
    115         *
    116         * Element is accessed by locking and unlocking the io_data Mutex.
    117         *
    118         * \param row element row
    119         * \param col element col
    120         * \param value element value
    121         */
    122         void SetValue(uint32_t row, uint32_t col,float value);
    123 
    124         /*!
    125         * \brief Set element value
    126         *
    127         * Element is not accessed by locking and unlocking the io_data Mutex. \n
    128         * Thus, this function should be called with Mutex locked. \n
    129         * This function is usefull when multiple successive access are done to the
    130         * elments of the matrix. It avoids unnecessary locking and unlocking.
    131         *
    132         * \param row element row
    133         * \param col element col
    134         * \param value element value
    135         */
    136         void SetValueNoMutex(uint32_t row, uint32_t col,float value);
    137 
    138         /*!
    139         * \brief get CvMat
    140         *
    141         * The io_data Mutex must be used by the user.
    142         */
    143         CvMat* getCvMat(void) const;
    144 
    145         /*!
    146         * \brief Element name
    147         *
    148         * If cvmatrix was created without cvmatrix_descriptor, element name is empty.
    149         *
    150         * \param row element row
    151         * \param col element col
    152         *
    153         * \return element name
    154         */
    155         std::string Name(uint32_t row, uint32_t col) const;
    156 
    157         /*!
    158         * \brief Element
    159         *
    160         * Get a pointer to a specific element. This pointer can be used for plotting.
    161         *
    162         * \param row element row
    163         * \param col element col
    164         *
    165         * \return pointer to the element
    166         */
    167         IODataElement* Element(uint32_t row, uint32_t col) const;
    168 
    169         /*!
    170         * \brief Element
    171         *
    172         * Get a pointer to a specific element. This pointer can be used for plotting. \n
    173         * This function can be used for a 1D matrix.
    174         *
    175         * \param index element index
    176         *
    177         * \return pointer to the element
    178         */
    179         IODataElement* Element(uint32_t index) const;
    180 
    181         /*!
    182         * \brief Number of rows
    183         *
    184         * \return rows
    185         */
    186         uint32_t Rows(void) const;
    187 
    188         /*!
    189         * \brief Number of colomns
    190         *
    191         * \return colomns
    192         */
    193         uint32_t Cols(void) const;
    194 
    195         Type const &GetDataType() const {return dataType;};
    196 
    197     private:
    198         /*!
    199         * \brief Copy datas
    200         *
    201         * Reimplemented from io_data. \n
    202         * See io_data::CopyDatas.
    203         *
    204         * \param dst destination buffer
    205         */
    206         void CopyDatas(char* dst) const;
    207 
    208         class cvmatrix_impl* pimpl_;
    209         Type dataType;
    210     };
     23namespace flair {
     24namespace core {
     25
     26/*! \class cvmatrix
     27*
     28* \brief Class defining a matrix of kind CvMat
     29*
     30* CvMat is a matrix struct defined in OpenCV.
     31*
     32*/
     33class cvmatrix : public io_data {
     34public:
     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
     52  /*!
     53  * \brief Constructor
     54  *
     55  * Construct an io_data representing a CvMat. \n
     56  * It uses a cvmatrix_descriptor to get size and elements' names. \n
     57  * Names are used for graphs and logs.
     58  *
     59  * \param parent parent
     60  * \param descriptor matrix description
     61  * \param type type of matrix elements
     62  * \param name name
     63  * \param n number of samples
     64  */
     65  cvmatrix(const Object *parent, const cvmatrix_descriptor *descriptor,
     66           ScalarType const &elementDataType, std::string name = "",
     67           uint32_t n = 1);
     68
     69  /*!
     70  * \brief Constructor
     71  *
     72  * Construct an io_data representing a CvMat. \n
     73  * Elements are unamed.
     74  *
     75  * \param parent parent
     76  * \param rows matrix rows
     77  * \param cols matrix cols
     78  * \param type type of matrix elements
     79  * \param name name
     80  * \param n number of samples
     81  */
     82  cvmatrix(const Object *parent, uint32_t rows, uint32_t cols,
     83           ScalarType const &elementDataType, std::string name = "",
     84           uint32_t n = 1);
     85
     86  /*!
     87  * \brief Destructor
     88  *
     89  */
     90  ~cvmatrix();
     91
     92  /*!
     93  * \brief Element value
     94  *
     95  * Element is accessed by locking and unlocking the io_data Mutex.
     96  *
     97  * \param row element row
     98  * \param col element col
     99  *
     100  * \return element value
     101  */
     102  float Value(uint32_t row, uint32_t col) const;
     103
     104  /*!
     105  * \brief Element value
     106  *
     107  * Element is not accessed by locking and unlocking the io_data Mutex. \n
     108  * Thus, this function should be called with Mutex locked. \n
     109  * This function is usefull when multiple successive access are done to the
     110  * elments of the matrix. It avoids unnecessary locking and unlocking.
     111  *
     112  * \param row element row
     113  * \param col element col
     114  *
     115  * \return element value
     116  */
     117  float ValueNoMutex(uint32_t row, uint32_t col) const;
     118
     119  /*!
     120  * \brief Set element value
     121  *
     122  * Element is accessed by locking and unlocking the io_data Mutex.
     123  *
     124  * \param row element row
     125  * \param col element col
     126  * \param value element value
     127  */
     128  void SetValue(uint32_t row, uint32_t col, float value);
     129
     130  /*!
     131  * \brief Set element value
     132  *
     133  * Element is not accessed by locking and unlocking the io_data Mutex. \n
     134  * Thus, this function should be called with Mutex locked. \n
     135  * This function is usefull when multiple successive access are done to the
     136  * elments of the matrix. It avoids unnecessary locking and unlocking.
     137  *
     138  * \param row element row
     139  * \param col element col
     140  * \param value element value
     141  */
     142  void SetValueNoMutex(uint32_t row, uint32_t col, float value);
     143
     144  /*!
     145  * \brief get CvMat
     146  *
     147  * The io_data Mutex must be used by the user.
     148  */
     149  CvMat *getCvMat(void) const;
     150
     151  /*!
     152  * \brief Element name
     153  *
     154  * If cvmatrix was created without cvmatrix_descriptor, element name is empty.
     155  *
     156  * \param row element row
     157  * \param col element col
     158  *
     159  * \return element name
     160  */
     161  std::string Name(uint32_t row, uint32_t col) const;
     162
     163  /*!
     164  * \brief Element
     165  *
     166  * Get a pointer to a specific element. This pointer can be used for plotting.
     167  *
     168  * \param row element row
     169  * \param col element col
     170  *
     171  * \return pointer to the element
     172  */
     173  IODataElement *Element(uint32_t row, uint32_t col) const;
     174
     175  /*!
     176  * \brief Element
     177  *
     178  * Get a pointer to a specific element. This pointer can be used for plotting.
     179  *\n
     180  * This function can be used for a 1D matrix.
     181  *
     182  * \param index element index
     183  *
     184  * \return pointer to the element
     185  */
     186  IODataElement *Element(uint32_t index) const;
     187
     188  /*!
     189  * \brief Number of rows
     190  *
     191  * \return rows
     192  */
     193  uint32_t Rows(void) const;
     194
     195  /*!
     196  * \brief Number of colomns
     197  *
     198  * \return colomns
     199  */
     200  uint32_t Cols(void) const;
     201
     202  Type const &GetDataType() const { return dataType; };
     203
     204private:
     205  /*!
     206  * \brief Copy datas
     207  *
     208  * Reimplemented from io_data. \n
     209  * See io_data::CopyDatas.
     210  *
     211  * \param dst destination buffer
     212  */
     213  void CopyDatas(char *dst) const;
     214
     215  class cvmatrix_impl *pimpl_;
     216  Type dataType;
     217};
    211218
    212219} // end namespace core
Note: See TracChangeset for help on using the changeset viewer.