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 #ifndef Pressure_CLASS
00028 #define Pressure_CLASS
00029
00030 #include <vector>
00031 #include <iostream>
00032 #include <string>
00033 using namespace std;
00034
00035 #ifndef WITHOUT_ACS
00036 #include <asdmIDLTypesC.h>
00037 using asdmIDLTypes::IDLPressure;
00038 #endif
00039
00040 #include <StringTokenizer.h>
00041 #include <NumberFormatException.h>
00042 using asdm::StringTokenizer;
00043 using asdm::NumberFormatException;
00044
00045 #include "EndianStream.h"
00046 using asdm::EndianOSStream;
00047 using asdm::EndianISStream;
00048
00049 namespace asdm {
00050
00051 class Pressure;
00052 Pressure operator * ( double , const Pressure & );
00053 ostream & operator << ( ostream &, const Pressure & );
00054 istream & operator >> ( istream &, Pressure&);
00055
00065 class Pressure {
00066 friend Pressure operator * ( double , const Pressure & );
00067 friend ostream & operator << ( ostream &, const Pressure & );
00068 friend istream & operator >> ( istream &, Pressure&);
00069
00070 public:
00071 static double fromString(const string&);
00072 static string toString(double);
00073 static Pressure getPressure(StringTokenizer &t) throw(NumberFormatException);
00074
00078 void toBin(EndianOSStream& eoss);
00079
00085 static void toBin(const vector<Pressure>& pressure, EndianOSStream& eoss);
00086
00092 static void toBin(const vector<vector<Pressure> >& pressure, EndianOSStream& eoss);
00093
00099 static void toBin(const vector<vector<vector<Pressure> > >& pressure, EndianOSStream& eoss);
00100
00107 static Pressure fromBin(EndianISStream& eiss);
00108
00115 static vector<Pressure> from1DBin(EndianISStream & eiss);
00116
00123 static vector<vector<Pressure> > from2DBin(EndianISStream & eiss);
00124
00131 static vector<vector<vector<Pressure> > > from3DBin(EndianISStream & eiss);
00132
00133 Pressure();
00134 Pressure(const Pressure &);
00135 Pressure(const string &s);
00136 #ifndef WITHOUT_ACS
00137 Pressure(const IDLPressure &);
00138 #endif
00139 Pressure(double value);
00140 virtual ~Pressure();
00141
00142 Pressure& operator = (const Pressure&);
00143 Pressure& operator = (const double);
00144
00145 Pressure& operator += (const Pressure&);
00146 Pressure& operator -= (const Pressure&);
00147 Pressure& operator *= (const double);
00148 Pressure& operator /= (const double);
00149
00150 Pressure operator + (const Pressure&) const;
00151 Pressure operator - (const Pressure&) const;
00152 Pressure operator * (const double) const;
00153 Pressure operator / (const double) const;
00154
00155 bool operator < (const Pressure&) const;
00156 bool operator > (const Pressure&) const;
00157 bool operator <= (const Pressure&) const;
00158 bool operator >= (const Pressure&) const;
00159 bool operator == (const Pressure&) const;
00160 bool equals(const Pressure&) const;
00161 bool operator != (const Pressure&) const;
00162
00163 bool isZero() const;
00164
00165 Pressure operator - () const;
00166 Pressure operator + () const;
00167
00168 string toString() const;
00169 string toStringI() const;
00170
00171 operator string () const;
00172 double get() const;
00173 #ifndef WITHOUT_ACS
00174 IDLPressure toIDLPressure() const;
00175 #endif
00176 static string unit();
00177
00178 private:
00179 double value;
00180
00181 };
00182
00183
00184 inline Pressure::Pressure() : value(0.0) {
00185 }
00186
00187 inline Pressure::Pressure(const Pressure &t) : value(t.value) {
00188 }
00189
00190 #ifndef WITHOUT_ACS
00191 inline Pressure::Pressure(const IDLPressure &l) : value(l.value) {
00192 }
00193 #endif
00194
00195 inline Pressure::Pressure(const string &s) : value(fromString(s)) {
00196 }
00197
00198 inline Pressure::Pressure(double v) : value(v) {
00199 }
00200
00201
00202 inline Pressure::~Pressure() { }
00203
00204
00205 inline Pressure& Pressure::operator = ( const Pressure &t ) {
00206 value = t.value;
00207 return *this;
00208 }
00209
00210
00211 inline Pressure& Pressure::operator = ( const double v ) {
00212 value = v;
00213 return *this;
00214 }
00215
00216
00217 inline Pressure& Pressure::operator += ( const Pressure& t) {
00218 value += t.value;
00219 return *this;
00220 }
00221
00222 inline Pressure& Pressure::operator -= ( const Pressure& t) {
00223 value -= t.value;
00224 return *this;
00225 }
00226
00227 inline Pressure& Pressure::operator *= ( const double n) {
00228 value *= n;
00229 return *this;
00230 }
00231
00232 inline Pressure& Pressure::operator /= ( const double n) {
00233 value /= n;
00234 return *this;
00235 }
00236
00237
00238 inline Pressure Pressure::operator + ( const Pressure &t2 ) const {
00239 Pressure tmp;
00240 tmp.value = value + t2.value;
00241 return tmp;
00242 }
00243
00244 inline Pressure Pressure::operator - ( const Pressure &t2 ) const {
00245 Pressure tmp;
00246 tmp.value = value - t2.value;
00247 return tmp;
00248 }
00249 inline Pressure Pressure::operator * ( const double n) const {
00250 Pressure tmp;
00251 tmp.value = value * n;
00252 return tmp;
00253 }
00254
00255 inline Pressure Pressure::operator / ( const double n) const {
00256 Pressure tmp;
00257 tmp.value = value / n;
00258 return tmp;
00259 }
00260
00261
00262 inline bool Pressure::operator < (const Pressure& x) const {
00263 return (value < x.value);
00264 }
00265
00266 inline bool Pressure::operator > (const Pressure& x) const {
00267 return (value > x.value);
00268 }
00269
00270 inline bool Pressure::operator <= (const Pressure& x) const {
00271 return (value <= x.value);
00272 }
00273
00274 inline bool Pressure::operator >= (const Pressure& x) const {
00275 return (value >= x.value);
00276 }
00277
00278 inline bool Pressure::operator == (const Pressure& x) const {
00279 return (value == x.value);
00280 }
00281 inline bool Pressure::equals(const Pressure& x) const {
00282 return (value == x.value);
00283 }
00284
00285 inline bool Pressure::operator != (const Pressure& x) const {
00286 return (value != x.value);
00287 }
00288
00289
00290 inline Pressure Pressure::operator - () const {
00291 Pressure tmp;
00292 tmp.value = -value;
00293 return tmp;
00294 }
00295
00296 inline Pressure Pressure::operator + () const {
00297 Pressure tmp;
00298 tmp.value = value;
00299 return tmp;
00300 }
00301
00302
00303 inline Pressure::operator string () const {
00304 return toString();
00305 }
00306
00307 inline string Pressure::toString() const {
00308 return toString(value);
00309 }
00310
00311 inline string Pressure::toStringI() const {
00312 return toString(value);
00313 }
00314
00315 inline double Pressure::get() const {
00316 return value;
00317 }
00318
00319 #ifndef WITHOUT_ACS
00320 inline IDLPressure Pressure::toIDLPressure() const {
00321 IDLPressure tmp;
00322 tmp.value = value;
00323 return tmp;
00324 }
00325 #endif
00326
00327
00328
00329 inline Pressure operator * ( double n, const Pressure &x) {
00330 Pressure tmp;
00331 tmp.value = x.value * n;
00332 return tmp;
00333 }
00334
00335 inline ostream & operator << ( ostream &o, const Pressure &x ) {
00336 o << x.value;
00337 return o;
00338 }
00339
00340 inline istream & operator >> ( istream &i, Pressure &x ) {
00341 i >> x.value;
00342 return i;
00343 }
00344
00345 inline string Pressure::unit() {
00346 return string ("hp");
00347 }
00348
00349 }
00350
00351 #endif