Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef SAMPLE_H
00031 #define SAMPLE_H
00032
00033
00034
00035 #include "../bfl_err.h"
00036 #include "../wrappers/matrix/vector_wrapper.h"
00037 #include "../wrappers/matrix/matrix_wrapper.h"
00038 #include <iostream>
00039
00040 namespace BFL
00041 {
00042 using namespace std;
00043
00047 template <typename T> class Sample
00048 {
00049 protected:
00051 T Value;
00052
00053 public:
00055
00059 Sample (unsigned int dimension = 0);
00060
00062 virtual ~Sample();
00063
00065 Sample ( const Sample<T> & my_sample );
00066
00068 T& ValueGet ( ) ;
00069
00071 const T& ValueGet ( ) const;
00072
00073
00074 unsigned int DimensionGet () const;
00075
00076
00077 void DimensionSet (unsigned int dim);
00078
00080
00083 void ValueSet ( const T& value );
00084
00086
00090 template <typename S> friend ostream & operator<< (ostream & stream,
00091 Sample<S> & my_sample);
00092
00093 template <typename S> friend istream & operator>> (istream & stream,
00094 Sample<S> & my_sample);
00096 Sample & operator= (const Sample & my_sample);
00097
00098 };
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108 template <typename T> Sample<T>::Sample (unsigned int dimension)
00109 {};
00110
00111
00112
00113 template <typename T> Sample<T>::~Sample( )
00114 {};
00115
00116
00117
00118 template <typename T> Sample<T>::Sample ( const Sample & my_sample )
00119 {
00120 Value = my_sample.ValueGet();
00121 }
00122
00123
00124
00125 template <typename T> void Sample<T>::ValueSet (const T& value)
00126 {
00127 Value = value;
00128 }
00129
00130
00131
00132 template <typename T> T& Sample<T>::ValueGet ( )
00133 {
00134 return Value;
00135 }
00136
00137
00138
00139 template <typename T> const T& Sample<T>::ValueGet ( ) const
00140 {
00141 return Value;
00142 }
00143
00144
00145 template <typename T> unsigned int Sample<T>::DimensionGet ( ) const
00146 {
00147 return 0;
00148 }
00149
00150
00151 template <typename T> void Sample<T>::DimensionSet (unsigned int dim)
00152 {}
00153
00154
00155 template <typename S> ostream & operator<< (ostream & stream, Sample<S> & my_sample)
00156 {
00157 stream << my_sample.ValueGet() << endl;
00158 return stream;
00159 }
00160
00161 template <typename S> istream & operator>> (istream & stream, Sample<S> & my_sample)
00162 {
00163 S value;
00164 stream >> value;
00165 my_sample.ValueSet(value);
00166 return stream;
00167 }
00168
00169
00170 template <typename T> Sample<T> & Sample<T>::operator= ( const Sample<T> & my_sample)
00171 {
00172 Value = my_sample.ValueGet();
00173 return *this;
00174 }
00175
00176
00177
00178 }
00179
00180 #include "sample.cpp"
00181
00182 #endif
bfl
Author(s): Klaas Gadeyne, Wim Meeussen, Tinne Delaet and many others. See web page for a full contributor list. ROS package maintained by Wim Meeussen.
autogenerated on Fri Aug 28 2015 10:10:21