Interpolator::SambaFileReader Class Reference

This will become useless !!! This class is a file reader for a the Samba line. More...

#include <SambaFileReader.h>

Inherits Interpolator::FileReader.

Inheritance diagram for Interpolator::SambaFileReader:

Inheritance graph
[legend]
Collaboration diagram for Interpolator::SambaFileReader:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 SambaFileReader ()
 Default constructor.
 SambaFileReader (const std::string &sFileName)
 This constructor requires 1 parameter :
  • the name of the file to read.

 SambaFileReader (const std::string &sFileName, long lNbColumns, long lNbLines)
 This constructor requires 3 parameters :
  • the name of the file to read
  • the number of columns of the file
  • the number of lines of the file (without the first line which contains the name of the data).

virtual ~SambaFileReader ()
 Destructor.
virtual void Parse ()
 This method parse the buffer to read a Samba file
In this case only the 2 and 5 columns are extracted
The column 2 is the theta encoder value variable column
The column 5 is the theta real value variable column.
double * getThetaEncoder () const
 Return the encoder theta values array.
double * getThetaReal () const
 Return the real theta values array.
double * getThetaDiff () const
 Return the (theta encoder - theta real) values array.
double getXValue (int i) const
 Return the ith value of the X part of the array (in this case Theta Encoder values)
Exceptions:
This method returns a IndexOutOfBoundException if the value with the ith index is not found.

double getYValue (int i) const
 Return the ith value of the Y part of the array (in this case Theta Real values)
Exceptions:
This method returns a IndexOutOfBoundException if the value with the ith index is not found.

double getThetaEncoderValue (int i) const
 Return the ith value of Theta Encoder array
Exceptions:
This method returns a IndexOutOfBoundException if the value with the ith index is not found.

double getThetaRealValue (int i) const
 Return the ith value of Theta Real array
Exceptions:
This method returns a IndexOutOfBoundException if the value with the ith index is not found.


Private Attributes

double * _mThetaEncoder
double * _mThetaReal
double * _mThetaDiff

Detailed Description

This will become useless !!! This class is a file reader for a the Samba line.

Definition at line 23 of file SambaFileReader.h.


Constructor & Destructor Documentation

Interpolator::SambaFileReader::SambaFileReader  ) 
 

Default constructor.

Definition at line 21 of file SambaFileReader.cpp.

00022 {
00023 
00024 }

Interpolator::SambaFileReader::SambaFileReader const std::string &  sFileName  ) 
 

This constructor requires 1 parameter :

  • the name of the file to read.

Definition at line 52 of file SambaFileReader.cpp.

References Parse().

00052                                                            : FileReader(sFileName) 
00053 {
00054         Parse();
00055 }

Here is the call graph for this function:

Interpolator::SambaFileReader::SambaFileReader const std::string &  sFileName,
long  lNbColumns,
long  lNbLines
 

This constructor requires 3 parameters :

  • the name of the file to read
  • the number of columns of the file
  • the number of lines of the file (without the first line which contains the name of the data).

Definition at line 61 of file SambaFileReader.cpp.

References Parse().

00061                                                                                          : FileReader(sFileName,lNbColumns,lNbLines)
00062 {
00063         Parse();
00064 }

Here is the call graph for this function:

Interpolator::SambaFileReader::~SambaFileReader  )  [virtual]
 

Destructor.

Definition at line 27 of file SambaFileReader.cpp.

References _mThetaDiff, _mThetaEncoder, and _mThetaReal.

00028 {
00029 
00030         if (_mThetaEncoder) 
00031         {
00032                 delete [] _mThetaEncoder;
00033                 _mThetaEncoder = 0;
00034         }
00035         
00036         if (_mThetaReal) 
00037         {
00038                 delete [] _mThetaReal;
00039                 _mThetaReal = 0;
00040         }
00041         
00042         if (_mThetaDiff) 
00043         {
00044                 delete [] _mThetaDiff;
00045                 _mThetaDiff = 0;
00046         }
00047 
00048 }


Member Function Documentation

double * Interpolator::SambaFileReader::getThetaDiff  )  const
 

Return the (theta encoder - theta real) values array.

Definition at line 157 of file SambaFileReader.cpp.

References _mThetaDiff.

00158 {
00159         if (_mThetaDiff == 0) throw NullPointerException("_mThetaDiff","SambaFileReader::getThetaDiff()",__FILE__,__LINE__);
00160         return _mThetaDiff;
00161 }

double * Interpolator::SambaFileReader::getThetaEncoder  )  const
 

Return the encoder theta values array.

Exceptions:
This method throw a NullPointerException exception if the slot vector is null

Definition at line 143 of file SambaFileReader.cpp.

References _mThetaEncoder.

00144 {
00145         if (_mThetaEncoder == 0) throw NullPointerException("_mThetaEncoder","SambaFileReader::getThetaEncoder()",__FILE__,__LINE__);
00146         return _mThetaEncoder;
00147 }

double Interpolator::SambaFileReader::getThetaEncoderValue int  i  )  const
 

Return the ith value of Theta Encoder array

Exceptions:
This method returns a IndexOutOfBoundException if the value with the ith index is not found.

Definition at line 189 of file SambaFileReader.cpp.

00190 {
00191 
00192         if ((0<=i) && (i<getNbData())) 
00193         {
00194                 return getXValue(i);
00195         }
00196         else throw IndexOutOfBoundException("i",i,0,getNbData(),"SambaFileReader::getThetaEncoderValue(int i)",__FILE__,__LINE__);
00197 }

double * Interpolator::SambaFileReader::getThetaReal  )  const
 

Return the real theta values array.

Definition at line 150 of file SambaFileReader.cpp.

References _mThetaReal.

00151 {
00152         if (_mThetaReal == 0) throw NullPointerException("_mThetaEncoder","SambaFileReader::getThetaEncoder()",__FILE__,__LINE__);
00153         return _mThetaReal;
00154 }

double Interpolator::SambaFileReader::getThetaRealValue int  i  )  const
 

Return the ith value of Theta Real array

Exceptions:
This method returns a IndexOutOfBoundException if the value with the ith index is not found.

Definition at line 201 of file SambaFileReader.cpp.

00202 {
00203 
00204         if ((0<=i) && (i<getNbData())) 
00205         {
00206                 return getYValue(i);
00207         }
00208         else throw IndexOutOfBoundException("i",i,0,getNbData(),"SambaFileReader::getThetaRealValue(int i)",__FILE__,__LINE__);
00209 }

double Interpolator::SambaFileReader::getXValue int  i  )  const
 

Return the ith value of the X part of the array (in this case Theta Encoder values)

Exceptions:
This method returns a IndexOutOfBoundException if the value with the ith index is not found.

Definition at line 165 of file SambaFileReader.cpp.

00166 {
00167         if ((0<=i) && (i<getNbData())) 
00168         {
00169                 return _mThetaEncoder[i];
00170         }
00171         else throw IndexOutOfBoundException("i",i,0,getNbData(),"SambaFileReader::getXValue(int i)",__FILE__,__LINE__);
00172 }

double Interpolator::SambaFileReader::getYValue int  i  )  const
 

Return the ith value of the Y part of the array (in this case Theta Real values)

Exceptions:
This method returns a IndexOutOfBoundException if the value with the ith index is not found.

Definition at line 176 of file SambaFileReader.cpp.

00177 {
00178         
00179         if ((0<=i) && (i<getNbData())) 
00180         {
00181                 return _mThetaReal[i];
00182         }
00183         else throw IndexOutOfBoundException("i",i,0,getNbData(),"SambaFileReader::getYValue(int i)",__FILE__,__LINE__);
00184 
00185 }

void Interpolator::SambaFileReader::Parse  )  [virtual]
 

This method parse the buffer to read a Samba file
In this case only the 2 and 5 columns are extracted
The column 2 is the theta encoder value variable column
The column 5 is the theta real value variable column.

We convert the dValue given in degre in the file into radians in order to work properly with the library

Implements Interpolator::FileReader.

Definition at line 70 of file SambaFileReader.cpp.

References _mThetaDiff, _mThetaEncoder, _mThetaReal, Interpolator::Interpolator::_verb, Interpolator::FileReader::extractDouble(), Interpolator::FileReader::extractString(), Interpolator::FileReader::getNbData(), and Interpolator::FileReader::getNbVariables().

Referenced by SambaFileReader().

00071 {
00072 
00073 int iNbData = getNbData();
00074 if(Interpolator::_verb == true) cout << "NbData : " << iNbData << endl;
00075 
00076 int iNbVariables = getNbVariables();
00077 if(Interpolator::_verb == true) cout << "NbVariables : " << iNbVariables << endl;
00078 
00079 //Reading of the first line to extract the variables names
00080 std::string sColumn1Name;
00081 
00082  int i=0;
00083 
00084 for (i=0;i<iNbVariables;i++) 
00085 {
00086         sColumn1Name = extractString();
00087         if(Interpolator::_verb == true) cout << "Column " << i << " --> " << sColumn1Name << endl;
00088 }
00089 
00090 _mThetaEncoder  = new double[iNbData];
00091 _mThetaReal             = new double[iNbData];
00092 _mThetaDiff             = new double[iNbData];
00093 double dValue;
00094 
00096 for (i=0;i<iNbData;i++) 
00097 {
00098         for (int j=0;j<iNbVariables;j++) 
00099         {
00100                 dValue = extractDouble();
00101                 
00102                 if (j==1) 
00103                 {
00104                         _mThetaEncoder[i]       = DegresToRadians(dValue);
00105                 }
00106                 if (j==4) 
00107                 {
00108                         _mThetaReal[i]          = DegresToRadians(dValue);      
00109                 }
00110                 if (j==5) 
00111                 {       
00112                         _mThetaDiff[i]          = DegresToRadians(dValue);      
00113                 }
00114         }
00115         
00116 }
00117 
00118 if(Interpolator::_verb == true) cout << "_mThetaEncoder" <<endl;
00119 for (int k=0;k<iNbData;k++)
00120 {
00121         if(Interpolator::_verb == true) cout.precision(10);
00122         if(Interpolator::_verb == true) cout << "k=" << k << " --> " << _mThetaEncoder[k] << endl;
00123 }
00124 
00125 if(Interpolator::_verb == true) cout << "_mThetaReal" <<endl;
00126 for (int l=0;l<iNbData;l++)
00127 { 
00128         if(Interpolator::_verb == true) cout.precision(10);
00129         if(Interpolator::_verb == true) cout <<  "l=" << l << " --> " << _mThetaReal[l] << endl;
00130 }
00131 
00132 if(Interpolator::_verb == true) cout << "ThetaEncoder-ThetaReal" <<endl;
00133 for (int m=0;m<iNbData;m++)
00134 {
00135         if(Interpolator::_verb == true) cout.precision(10);
00136         if(Interpolator::_verb == true) cout << "m=" << m << " --> " << _mThetaDiff[m] << endl;
00137 }
00138         
00139 }

Here is the call graph for this function:


Member Data Documentation

double* Interpolator::SambaFileReader::_mThetaDiff [private]
 

Definition at line 47 of file SambaFileReader.h.

Referenced by getThetaDiff(), Parse(), and ~SambaFileReader().

double* Interpolator::SambaFileReader::_mThetaEncoder [private]
 

Definition at line 45 of file SambaFileReader.h.

Referenced by getThetaEncoder(), Parse(), and ~SambaFileReader().

double* Interpolator::SambaFileReader::_mThetaReal [private]
 

Definition at line 46 of file SambaFileReader.h.

Referenced by getThetaReal(), Parse(), and ~SambaFileReader().


The documentation for this class was generated from the following files:
Generated on Tue Apr 14 09:51:44 2009 for Interpolator Library by  doxygen 1.4.5