WeatherTable.h

Go to the documentation of this file.
00001 
00002 /*
00003  * ALMA - Atacama Large Millimeter Array
00004  * (c) European Southern Observatory, 2002
00005  * (c) Associated Universities Inc., 2002
00006  * Copyright by ESO (in the framework of the ALMA collaboration),
00007  * Copyright by AUI (in the framework of the ALMA collaboration),
00008  * All rights reserved.
00009  * 
00010  * This library is free software; you can redistribute it and/or
00011  * modify it under the terms of the GNU Lesser General Public
00012  * License as published by the Free software Foundation; either
00013  * version 2.1 of the License, or (at your option) any later version.
00014  * 
00015  * This library is distributed in the hope that it will be useful,
00016  * but WITHOUT ANY WARRANTY, without even the implied warranty of
00017  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018  * Lesser General Public License for more details.
00019  * 
00020  * You should have received a copy of the GNU Lesser General Public
00021  * License along with this library; if not, write to the Free Software
00022  * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
00023  * MA 02111-1307  USA
00024  *
00025  * Warning!
00026  *  -------------------------------------------------------------------- 
00027  * | This is generated code!  Do not modify this file.                  |
00028  * | If you do, all changes will be lost when the file is re-generated. |
00029  *  --------------------------------------------------------------------
00030  *
00031  * File WeatherTable.h
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 //class asdm::ASDM;
00123 //class asdm::WeatherRow;
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         // Conversion Methods
00341         WeatherTableIDL *toIDL() ;
00342 #endif
00343 
00344 #ifndef WITHOUT_ACS
00345 
00351         void fromIDL(WeatherTableIDL x) ;
00352 #endif
00353         
00354         //
00355         // ====> Row creation.
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         // ====> Append a row to its table.
00418         //
00419  
00420         
00437         WeatherRow* add(WeatherRow* x) ; 
00438 
00439  
00440 
00441 
00442 
00443         //
00444         // ====> Methods returning rows.
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; // If true archive binary else archive XML
00538         bool fileAsBin ; // If true file binary else file XML   
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 // A data structure to store the pointers on the table's rows.
00590 
00591 // In all cases we maintain a private vector of WeatherRow s.
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() ; //throw(ConversionException);
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 } // End namespace asdm
00687 
00688 #endif /* WeatherTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines