DataDescriptionTable.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 DataDescriptionTable.h
00032  */
00033  
00034 #ifndef DataDescriptionTable_CLASS
00035 #define DataDescriptionTable_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 #include <Angle.h>
00046 #include <AngularRate.h>
00047 #include <ArrayTime.h>
00048 #include <ArrayTimeInterval.h>
00049 #include <Complex.h>
00050 #include <Entity.h>
00051 #include <EntityId.h>
00052 #include <EntityRef.h>
00053 #include <Flux.h>
00054 #include <Frequency.h>
00055 #include <Humidity.h>
00056 #include <Interval.h>
00057 #include <Length.h>
00058 #include <PartId.h>
00059 #include <Pressure.h>
00060 #include <Speed.h>
00061 #include <Tag.h>
00062 #include <Temperature.h>
00063 #include <ConversionException.h>
00064 #include <DuplicateKey.h>
00065 #include <UniquenessViolationException.h>
00066 #include <NoSuchRow.h>
00067 #include <DuplicateKey.h>
00068 
00069 #ifndef WITHOUT_ACS
00070 #include <asdmIDLC.h>
00071 using asdmIDL::DataDescriptionTableIDL;
00072 #endif
00073 
00074 using asdm::Angle;
00075 using asdm::AngularRate;
00076 using asdm::ArrayTime;
00077 using asdm::Complex;
00078 using asdm::Entity;
00079 using asdm::EntityId;
00080 using asdm::EntityRef;
00081 using asdm::Flux;
00082 using asdm::Frequency;
00083 using asdm::Humidity;
00084 using asdm::Interval;
00085 using asdm::Length;
00086 using asdm::PartId;
00087 using asdm::Pressure;
00088 using asdm::Speed;
00089 using asdm::Tag;
00090 using asdm::Temperature;
00091 
00092 using asdm::DuplicateKey;
00093 using asdm::ConversionException;
00094 using asdm::NoSuchRow;
00095 using asdm::DuplicateKey;
00096 
00097 #include <Representable.h>
00098 
00099 namespace asdm {
00100 
00101 //class asdm::ASDM;
00102 //class asdm::DataDescriptionRow;
00103 
00104 class ASDM;
00105 class DataDescriptionRow;
00139 class DataDescriptionTable : public Representable {
00140         friend class asdm::ASDM;
00141 
00142 public:
00143 
00144 
00150         static vector<string> getKeyName();
00151 
00152 
00153         virtual ~DataDescriptionTable();
00154         
00160         ASDM &getContainer() const;
00161         
00167         unsigned int size() ;
00168         
00174         string getName() const;
00175 
00181          static const vector<string>& getAttributesNames();
00182 
00186         Entity getEntity() const;
00187 
00192         void setEntity(Entity e);
00193 
00194         //
00195         // ====> Row creation.
00196         //
00197         
00202         DataDescriptionRow *newRow();
00203         
00208         DataDescriptionRow *newRowEmpty();
00209         
00219         DataDescriptionRow *newRow(Tag polOrHoloId, Tag spectralWindowId);
00220         
00225         DataDescriptionRow *newRowFull(Tag polOrHoloId, Tag spectralWindowId);
00226         
00239          DataDescriptionRow *newRow(DataDescriptionRow *row); 
00240          
00245          DataDescriptionRow *newRowCopy(DataDescriptionRow *row);       
00246          
00247         //
00248         // ====> Append a row to its table.
00249         //
00250 
00251         
00252         
00253         
00263          DataDescriptionRow* add(DataDescriptionRow* x) ;
00264 
00265 
00266 
00267         //
00268         // ====> Methods returning rows.
00269         //
00270                 
00276         vector<DataDescriptionRow *> get() ;
00277         
00278 
00279 
00280  
00281         
00291         DataDescriptionRow* getRowByKey(Tag dataDescriptionId);
00292 
00293                 
00294 
00295 
00296 
00308         DataDescriptionRow* lookup(Tag polarizationId, Tag spectralWindowId); 
00309 
00310 
00311 #ifndef WITHOUT_ACS
00312         // Conversion Methods
00318         DataDescriptionTableIDL *toIDL() ;
00319 #endif
00320 
00321 #ifndef WITHOUT_ACS
00322 
00328         void fromIDL(DataDescriptionTableIDL x) throw(DuplicateKey,ConversionException);
00329 #endif
00330 
00334         char *toFITS() const throw(ConversionException);
00335 
00339         void fromFITS(char *fits) throw(ConversionException);
00340 
00344         string toVOTable() const throw(ConversionException);
00345 
00349         void fromVOTable(string vo) throw(ConversionException);
00350 
00357         string toXML()  throw(ConversionException);
00358         
00364         void fromXML(string xmlDoc) throw(ConversionException);
00365 
00371         string toMIME();
00372         
00379          void setFromMIME(const string & mimeMsg);
00380         
00389           void toFile(string directory);
00390           
00399          void setFromFile(const string& directory);               
00400           
00401 private:
00402 
00411         DataDescriptionTable (ASDM & container);
00412 
00413         ASDM & container;
00414         
00415         bool archiveAsBin; // If true archive binary else archive XML
00416         bool fileAsBin ; // If true file binary else file XML           
00417         
00418         Entity entity;
00419         
00420 
00421         // A map for the autoincrementation algorithm
00422         map<string,int>  noAutoIncIds;
00423         void autoIncrement(string key, DataDescriptionRow* x);
00424 
00425 
00429         static string tableName;
00430 
00434         static const vector<string> attributesNames;
00435 
00439         static vector<string> initAttributesNames();
00440 
00444         static vector<string> key;
00445 
00446 
00452         DataDescriptionRow* checkAndAdd(DataDescriptionRow* x) throw (DuplicateKey, UniquenessViolationException);
00453 
00454 
00455 
00456 // A data structure to store the pointers on the table's rows.
00457 
00458 // In all cases we maintain a private ArrayList of DataDescriptionRow s.
00459    vector<DataDescriptionRow * > privateRows;
00460    
00461 
00462                         
00463         vector<DataDescriptionRow *> row;
00464 
00465 
00466 
00472         void getByRequiredValue(vector <DataDescriptionRow*>& vin, vector <DataDescriptionRow*>& vout,  Tag polarizationId, Tag spectralWindowId);
00473 
00474 
00475 
00476 
00477 
00478 
00479 
00480         void error() throw(ConversionException);
00481 
00482 };
00483 
00484 } // End namespace asdm
00485 
00486 #endif /* DataDescriptionTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines