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
00031
00032
00033
00034 #ifndef WeatherTable_CLASS
00035 #define WeatherTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 #include <set>
00041 using std::string;
00042 using std::vector;
00043 using std::map;
00044
00045
00046
00047 #include <Angle.h>
00048 using asdm::Angle;
00049
00050 #include <Speed.h>
00051 using asdm::Speed;
00052
00053 #include <Tag.h>
00054 using asdm::Tag;
00055
00056 #include <Temperature.h>
00057 using asdm::Temperature;
00058
00059 #include <Humidity.h>
00060 using asdm::Humidity;
00061
00062 #include <ArrayTimeInterval.h>
00063 using asdm::ArrayTimeInterval;
00064
00065 #include <Pressure.h>
00066 using asdm::Pressure;
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 #include <ConversionException.h>
00104 #include <DuplicateKey.h>
00105 #include <UniquenessViolationException.h>
00106 #include <NoSuchRow.h>
00107 #include <DuplicateKey.h>
00108 using asdm::DuplicateKey;
00109 using asdm::ConversionException;
00110 using asdm::NoSuchRow;
00111 using asdm::DuplicateKey;
00112
00113 #ifndef WITHOUT_ACS
00114 #include <asdmIDLC.h>
00115 using asdmIDL::WeatherTableIDL;
00116 #endif
00117
00118 #include <Representable.h>
00119
00120 namespace asdm {
00121
00122
00123
00124
00125 class ASDM;
00126 class WeatherRow;
00270 class WeatherTable : public Representable {
00271 friend class ASDM;
00272
00273 public:
00274
00275
00281 static vector<string> getKeyName();
00282
00283
00284 virtual ~WeatherTable();
00285
00291 ASDM &getContainer() const;
00292
00298 unsigned int size() ;
00299
00305 string getName() const;
00306
00312 static const vector<string>& getAttributesNames();
00313
00317 Entity getEntity() const;
00318
00323 void setEntity(Entity e);
00324
00332 string toXML() ;
00333
00334 #ifndef WITHOUT_ACS
00335
00341 WeatherTableIDL *toIDL() ;
00342 #endif
00343
00344 #ifndef WITHOUT_ACS
00345
00351 void fromIDL(WeatherTableIDL x) ;
00352 #endif
00353
00354
00355
00356
00357
00362 WeatherRow *newRow();
00363
00364
00398 WeatherRow *newRow(Tag stationId, ArrayTimeInterval timeInterval, Pressure pressure, bool pressureFlag, Humidity relHumidity, bool relHumidityFlag, Temperature temperature, bool temperatureFlag, Angle windDirection, bool windDirectionFlag, Speed windSpeed, bool windSpeedFlag, Speed windMax, bool windMaxFlag);
00399
00400
00401
00414 WeatherRow *newRow(WeatherRow *row);
00415
00416
00417
00418
00419
00420
00437 WeatherRow* add(WeatherRow* x) ;
00438
00439
00440
00441
00442
00443
00444
00445
00446
00452 vector<WeatherRow *> get() ;
00453
00454
00462 vector <WeatherRow*> *getByContext(Tag stationId);
00463
00464
00465
00466
00467
00479 WeatherRow* getRowByKey(Tag stationId, ArrayTimeInterval timeInterval);
00480
00481
00482
00483
00484
00520 WeatherRow* lookup(Tag stationId, ArrayTimeInterval timeInterval, Pressure pressure, bool pressureFlag, Humidity relHumidity, bool relHumidityFlag, Temperature temperature, bool temperatureFlag, Angle windDirection, bool windDirectionFlag, Speed windSpeed, bool windSpeedFlag, Speed windMax, bool windMaxFlag);
00521
00522
00523 private:
00524
00533 WeatherTable (ASDM & container);
00534
00535 ASDM & container;
00536
00537 bool archiveAsBin;
00538 bool fileAsBin ;
00539
00540 Entity entity;
00541
00542
00543
00547 static string tableName;
00548
00552 static const vector<string> attributesNames;
00553
00557 static vector<string> initAttributesNames();
00558
00559
00563 static vector<string> key;
00564
00565
00573 WeatherRow* checkAndAdd(WeatherRow* x) ;
00574
00575
00576
00577
00585 WeatherRow * insertByStartTime(WeatherRow* x, vector<WeatherRow* >& row);
00586
00587
00588
00589
00590
00591
00592 vector<WeatherRow * > privateRows;
00593
00594
00595
00596
00597
00598
00599
00600
00601 typedef vector <WeatherRow* > TIME_ROWS;
00602 map<string, TIME_ROWS > context;
00603
00608 string Key(Tag stationId) ;
00609
00610
00611
00612
00618 void getByKeyNoAutoIncNoTime(vector <WeatherRow*>& vin, vector <WeatherRow*>& vout, Tag stationId);
00619
00620
00621
00622 void error() ;
00623
00624
00631 void fromXML(string xmlDoc) ;
00632
00637 void setFromMIMEFile(const string& directory);
00638 void setFromXMLFile(const string& directory);
00639
00647 string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00648
00649
00656 void setFromMIME(const string & mimeMsg);
00657
00661 string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00662
00672 void toFile(string directory);
00673
00682 void setFromFile(const string& directory);
00683
00684 };
00685
00686 }
00687
00688 #endif