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_descriptor.cpp

    r2 r15  
    2020using std::string;
    2121
    22 namespace flair { namespace core {
     22namespace flair {
     23namespace core {
    2324
    2425cvmatrix_descriptor::cvmatrix_descriptor(uint32_t rows, uint32_t cols) {
    25     this->rows=rows;
    26     this->cols=cols;
     26  this->rows = rows;
     27  this->cols = cols;
    2728
    28     if(rows==0 || cols==0) getFrameworkManager()->Err("rows and cols must be >0\n");
     29  if (rows == 0 || cols == 0)
     30    getFrameworkManager()->Err("rows and cols must be >0\n");
    2931
    30     element_names=(string**)malloc(rows*cols*sizeof(string*));
    31     for(uint32_t i=0; i<rows*cols; i++) {
    32         element_names[i]=new string();
    33     }
     32  element_names = (string **)malloc(rows * cols * sizeof(string *));
     33  for (uint32_t i = 0; i < rows * cols; i++) {
     34    element_names[i] = new string();
     35  }
    3436}
    3537
    3638cvmatrix_descriptor::~cvmatrix_descriptor() {
    37     for(uint32_t i=0; i<rows*cols; i++) {
    38         delete element_names[i];
    39     }
    40     free(element_names);
     39  for (uint32_t i = 0; i < rows * cols; i++) {
     40    delete element_names[i];
     41  }
     42  free(element_names);
    4143}
    4244
    43 void cvmatrix_descriptor::SetElementName(uint32_t row, uint32_t col,string name) {
    44     if(row>=rows || col>=cols) {
    45         getFrameworkManager()->Err("index out of bound %s (%i,%i), range (%i,%i)\n",name.c_str(),row,col,rows-1,cols-1);
    46         return;
    47     }
    48     *element_names[row*cols+col]=name;
     45void cvmatrix_descriptor::SetElementName(uint32_t row, uint32_t col,
     46                                         string name) {
     47  if (row >= rows || col >= cols) {
     48    getFrameworkManager()->Err("index out of bound %s (%i,%i), range (%i,%i)\n",
     49                               name.c_str(), row, col, rows - 1, cols - 1);
     50    return;
     51  }
     52  *element_names[row * cols + col] = name;
    4953}
    5054
    5155string cvmatrix_descriptor::ElementName(uint32_t row, uint32_t col) const {
    52     if(row>=rows || col>=cols) {
    53         getFrameworkManager()->Err("index out of bound (%i,%i), range (%i,%i)\n",row,col,rows-1,cols-1);
    54         return *element_names[0];//safe value...
    55     }
    56     return *element_names[row*cols+col];
     56  if (row >= rows || col >= cols) {
     57    getFrameworkManager()->Err("index out of bound (%i,%i), range (%i,%i)\n",
     58                               row, col, rows - 1, cols - 1);
     59    return *element_names[0]; // safe value...
     60  }
     61  return *element_names[row * cols + col];
    5762}
    5863
    59 uint32_t cvmatrix_descriptor::Rows() const {
    60     return rows;
    61 }
     64uint32_t cvmatrix_descriptor::Rows() const { return rows; }
    6265
    63 uint32_t cvmatrix_descriptor::Cols() const {
    64     return cols;
    65 }
     66uint32_t cvmatrix_descriptor::Cols() const { return cols; }
    6667
    6768} // end namespace core
Note: See TracChangeset for help on using the changeset viewer.