Changeset 15 in flair-src for trunk/lib/FlairFilter/src/ControlLaw.cpp


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/FlairFilter/src/ControlLaw.cpp

    r10 r15  
    2929namespace filter {
    3030
    31 ControlLaw::ControlLaw(const Object* parent,string name,uint32_t nb_out) : IODevice(parent,name) {
    32     if(nb_out==1) {
    33         output=new cvmatrix(this,nb_out,1,floatType,name);
    34     } else {
    35         cvmatrix_descriptor* desc=new cvmatrix_descriptor(nb_out,1);
    36         for(int i=0;i<nb_out;i++) {
    37             std::stringstream ss;
    38             ss << i;
    39             desc->SetElementName(i,0,ss.str());
    40         }
    41         output=new cvmatrix(this,desc,floatType,name);
     31ControlLaw::ControlLaw(const Object *parent, string name, uint32_t nb_out)
     32    : IODevice(parent, name) {
     33  if (nb_out == 1) {
     34    output = new cvmatrix(this, nb_out, 1, floatType, name);
     35  } else {
     36    cvmatrix_descriptor *desc = new cvmatrix_descriptor(nb_out, 1);
     37    for (int i = 0; i < nb_out; i++) {
     38      std::stringstream ss;
     39      ss << i;
     40      desc->SetElementName(i, 0, ss.str());
    4241    }
     42    output = new cvmatrix(this, desc, floatType, name);
     43  }
    4344
    44     input=NULL;
    45     AddDataToLog(output);
     45  input = NULL;
     46  AddDataToLog(output);
    4647}
    4748
    48 ControlLaw::~ControlLaw(void) {
    49 
    50 }
     49ControlLaw::~ControlLaw(void) {}
    5150
    5251void ControlLaw::Update(Time time) {
    53     input->SetDataTime(time);
    54     UpdateFrom(input);
     52  input->SetDataTime(time);
     53  UpdateFrom(input);
    5554}
    5655
    5756float ControlLaw::Output(uint32_t index) const {
    58     return output->Value(index,0);
     57  return output->Value(index, 0);
    5958}
    6059
    61 void ControlLaw::UseDefaultPlot(const LayoutPosition* position) {
    62     if(output->Rows()!=1) Warn("Output size is different from 1. Plotting only Output(1,1).\n");
     60void ControlLaw::UseDefaultPlot(const LayoutPosition *position) {
     61  if (output->Rows() != 1)
     62    Warn("Output size is different from 1. Plotting only Output(1,1).\n");
    6363
    64     DataPlot1D *plot=new DataPlot1D(position,ObjectName(),-1,1);
    65     plot->AddCurve(output->Element(0));
     64  DataPlot1D *plot = new DataPlot1D(position, ObjectName(), -1, 1);
     65  plot->AddCurve(output->Element(0));
    6666}
    6767} // end namespace filter
Note: See TracChangeset for help on using the changeset viewer.