EphemerisTable.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 EphemerisTable.h
00032  */
00033  
00034 #ifndef EphemerisTable_CLASS
00035 #define EphemerisTable_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 <Tag.h>
00048 using  asdm::Tag;
00049 
00050 
00051 
00052 
00053         
00054 
00055 
00056 
00057 #include <ConversionException.h>
00058 #include <DuplicateKey.h>
00059 #include <UniquenessViolationException.h>
00060 #include <NoSuchRow.h>
00061 #include <DuplicateKey.h>
00062 using asdm::DuplicateKey;
00063 using asdm::ConversionException;
00064 using asdm::NoSuchRow;
00065 using asdm::DuplicateKey;
00066 
00067 #ifndef WITHOUT_ACS
00068 #include <asdmIDLC.h>
00069 using asdmIDL::EphemerisTableIDL;
00070 #endif
00071 
00072 #include <Representable.h>
00073 
00074 namespace asdm {
00075 
00076 //class asdm::ASDM;
00077 //class asdm::EphemerisRow;
00078 
00079 class ASDM;
00080 class EphemerisRow;
00111 class EphemerisTable : public Representable {
00112         friend class ASDM;
00113 
00114 public:
00115 
00116 
00122         static vector<string> getKeyName();
00123 
00124 
00125         virtual ~EphemerisTable();
00126         
00132         ASDM &getContainer() const;
00133         
00139         unsigned int size() ;
00140         
00146         string getName() const;
00147         
00153          static const vector<string>& getAttributesNames();
00154 
00158         Entity getEntity() const;
00159 
00164         void setEntity(Entity e);
00165                 
00173         string toXML()  ;
00174 
00175 #ifndef WITHOUT_ACS
00176         // Conversion Methods
00182         EphemerisTableIDL *toIDL() ;
00183 #endif
00184 
00185 #ifndef WITHOUT_ACS
00186 
00192         void fromIDL(EphemerisTableIDL x) ;
00193 #endif
00194         
00195         //
00196         // ====> Row creation.
00197         //
00198         
00203         EphemerisRow *newRow();
00204         
00205 
00206 
00219          EphemerisRow *newRow(EphemerisRow *row); 
00220 
00221         //
00222         // ====> Append a row to its table.
00223         //
00224 
00225         
00226         
00227         
00237          EphemerisRow* add(EphemerisRow* x) ;
00238 
00239 
00240 
00241         //
00242         // ====> Methods returning rows.
00243         //
00244                 
00250         vector<EphemerisRow *> get() ;
00251         
00252 
00253 
00254  
00255         
00265         EphemerisRow* getRowByKey(Tag ephemerisId);
00266 
00267                 
00268 
00269 
00270 
00271 
00272 private:
00273 
00282         EphemerisTable (ASDM & container);
00283 
00284         ASDM & container;
00285         
00286         bool archiveAsBin; // If true archive binary else archive XML
00287         bool fileAsBin ; // If true file binary else file XML   
00288         
00289         Entity entity;
00290         
00291 
00292         // A map for the autoincrementation algorithm
00293         map<string,int>  noAutoIncIds;
00294         void autoIncrement(string key, EphemerisRow* x);
00295 
00296 
00300         static string tableName;
00301         
00305         static const vector<string> attributesNames;
00306         
00310         static vector<string> initAttributesNames();
00311 
00312 
00316         static vector<string> key;
00317 
00318 
00328         EphemerisRow* checkAndAdd(EphemerisRow* x) ;
00329 
00330 
00331 
00332 // A data structure to store the pointers on the table's rows.
00333 
00334 // In all cases we maintain a private vector of EphemerisRow s.
00335    vector<EphemerisRow * > privateRows;
00336    
00337 
00338                         
00339         vector<EphemerisRow *> row;
00340 
00341         
00342         void error() ; //throw(ConversionException);
00343 
00344         
00351         void fromXML(string xmlDoc) ;
00352                 
00357         void setFromMIMEFile(const string& directory);
00358         void setFromXMLFile(const string& directory);
00359         
00367         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00368   
00369         
00376          void setFromMIME(const string & mimeMsg);
00377         
00381         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00382         
00392           void toFile(string directory);
00393           
00402          void setFromFile(const string& directory);     
00403  
00404 };
00405 
00406 } // End namespace asdm
00407 
00408 #endif /* EphemerisTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines