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

sources reformatted with flair-format-dir script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/RadioReceiver.cpp

    r3 r15  
    2828using namespace flair::gui;
    2929
    30 namespace flair
    31 {
    32 namespace sensor
    33 {
     30namespace flair {
     31namespace sensor {
    3432
    35 RadioReceiver::RadioReceiver(const FrameworkManager* parent,string name,unsigned int nb_channels) : IODevice(parent,name)
    36 {
    37     is_connected=false;
    38     this->nb_channels=nb_channels;
     33RadioReceiver::RadioReceiver(const FrameworkManager *parent, string name,
     34                             unsigned int nb_channels)
     35    : IODevice(parent, name) {
     36  is_connected = false;
     37  this->nb_channels = nb_channels;
    3938
    40     //init matrix
    41     cvmatrix_descriptor* desc=new cvmatrix_descriptor(nb_channels,1);
    42     for(int i=0;i<nb_channels;i++)
    43     {
    44         ostringstream channel_name;
    45         channel_name << "channel " << i;
    46         desc->SetElementName(i,0,channel_name.str());
    47     }
    48     output=new cvmatrix(this,desc,floatType,name);
     39  // init matrix
     40  cvmatrix_descriptor *desc = new cvmatrix_descriptor(nb_channels, 1);
     41  for (int i = 0; i < nb_channels; i++) {
     42    ostringstream channel_name;
     43    channel_name << "channel " << i;
     44    desc->SetElementName(i, 0, channel_name.str());
     45  }
     46  output = new cvmatrix(this, desc, floatType, name);
    4947
    50      //station sol
    51     main_tab=new Tab(parent->GetTabWidget(),name);
    52     tab=new TabWidget(main_tab->NewRow(),name);
    53     setup_tab=new Tab(tab,"Setup");
     48  // station sol
     49  main_tab = new Tab(parent->GetTabWidget(), name);
     50  tab = new TabWidget(main_tab->NewRow(), name);
     51  setup_tab = new Tab(tab, "Setup");
    5452
    55     AddDataToLog(output);
     53  AddDataToLog(output);
    5654}
    5755
    58 RadioReceiver::~RadioReceiver()
    59 {
    60     delete main_tab;
     56RadioReceiver::~RadioReceiver() { delete main_tab; }
     57
     58Layout *RadioReceiver::GetLayout(void) const { return setup_tab; }
     59
     60float RadioReceiver::ChannelValue(unsigned int id) const {
     61  if (id < nb_channels) {
     62    return output->Value(id, 0);
     63  } else {
     64    Err("channel %i/%i is out of bound\n", id, nb_channels);
     65    return -1;
     66  }
    6167}
    6268
    63 Layout* RadioReceiver::GetLayout(void) const
    64 {
    65     return setup_tab;
    66 }
    67 
    68 float RadioReceiver::ChannelValue(unsigned int id) const
    69 {
    70     if(id<nb_channels)
    71     {
    72         return output->Value(id,0);
    73     }
    74     else
    75     {
    76         Err("channel %i/%i is out of bound\n",id,nb_channels);
    77         return -1;
    78     }
    79 }
    80 
    81 bool RadioReceiver::IsConnected(void) const
    82 {
    83     return is_connected;
    84 }
     69bool RadioReceiver::IsConnected(void) const { return is_connected; }
    8570
    8671} // end namespace sensor
Note: See TracChangeset for help on using the changeset viewer.