DataDescriptionTable.h

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;
00151 class DataDescriptionTable : public Representable {
00152         friend class asdm::ASDM;
00153 
00154 public:
00155 
00156 
00162         static vector<string> getKeyName();
00163 
00164 
00165         virtual ~DataDescriptionTable();
00166         
00172         ASDM &getContainer() const;
00173         
00179         unsigned int size() ;
00180         
00186         string getName() const;
00187 
00191         Entity getEntity() const;
00192 
00197         void setEntity(Entity e);
00198 
00199         //
00200         // ====> Row creation.
00201         //
00202         
00207         DataDescriptionRow *newRow();
00208         
00213         DataDescriptionRow *newRowEmpty();
00214         
00224         DataDescriptionRow *newRow(Tag polOrHoloId, Tag spectralWindowId);
00225         
00230         DataDescriptionRow *newRowFull(Tag polOrHoloId, Tag spectralWindowId);
00231         
00244          DataDescriptionRow *newRow(DataDescriptionRow *row); 
00245          
00250          DataDescriptionRow *newRowCopy(DataDescriptionRow *row);       
00251          
00252         //
00253         // ====> Append a row to its table.
00254         //
00255 
00256         
00257         
00258         
00268          DataDescriptionRow* add(DataDescriptionRow* x) ;
00269 
00270 
00271 
00272         //
00273         // ====> Methods returning rows.
00274         //
00275                 
00281         vector<DataDescriptionRow *> get() ;
00282         
00283 
00284 
00285  
00286         
00296         DataDescriptionRow* DataDescriptionTable::getRowByKey(Tag dataDescriptionId);
00297 
00298                 
00299 
00300 
00301 
00313         DataDescriptionRow* lookup(Tag polarizationId, Tag spectralWindowId); 
00314 
00315 
00316 #ifndef WITHOUT_ACS
00317         // Conversion Methods
00323         DataDescriptionTableIDL *toIDL() ;
00324 #endif
00325 
00326 #ifndef WITHOUT_ACS
00327 
00333         void fromIDL(DataDescriptionTableIDL x) throw(DuplicateKey,ConversionException);
00334 #endif
00335 
00339         char *toFITS() const throw(ConversionException);
00340 
00344         void fromFITS(char *fits) throw(ConversionException);
00345 
00349         string toVOTable() const throw(ConversionException);
00350 
00354         void fromVOTable(string vo) throw(ConversionException);
00355 
00362         string toXML()  throw(ConversionException);
00363         
00369         void fromXML(string xmlDoc) throw(ConversionException);
00370 
00376         string toMIME();
00377         
00384          void setFromMIME(const string & mimeMsg);
00385         
00394           void toFile(string directory);
00395           
00404          void setFromFile(const string& directory);               
00405           
00406 private:
00407 
00416         DataDescriptionTable (ASDM & container);
00417 
00418         ASDM & container;
00419         
00420         bool archiveAsBin; // If true archive binary else archive XML
00421         bool fileAsBin ; // If true file binary else file XML           
00422         
00423         Entity entity;
00424         
00425 
00426         // A map for the autoincrementation algorithm
00427         map<string,int>  noAutoIncIds;
00428         void autoIncrement(string key, DataDescriptionRow* x);
00429 
00430 
00434         static string tableName;
00435 
00436 
00440         static vector<string> key;
00441 
00442 
00448         DataDescriptionRow* checkAndAdd(DataDescriptionRow* x) throw (DuplicateKey, UniquenessViolationException);
00449 
00450 
00451 
00452 // A data structure to store the pointers on the table's rows.
00453 
00454 // In all cases we maintain a private ArrayList of DataDescriptionRow s.
00455    vector<DataDescriptionRow * > privateRows;
00456    
00457 
00458                         
00459         vector<DataDescriptionRow *> row;
00460 
00461 
00462 
00468         void getByRequiredValue(vector <DataDescriptionRow*>& vin, vector <DataDescriptionRow*>& vout,  Tag polarizationId, Tag spectralWindowId);
00469 
00470 
00471 
00472 
00473 
00474 
00475 
00476         void error() throw(ConversionException);
00477 
00478 };
00479 
00480 } // End namespace asdm
00481 
00482 #endif /* DataDescriptionTable_CLASS */

Generated on Thu Nov 29 16:46:46 2007 for ASDM C++ Implementation by  doxygen 1.5.1