StationTable.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 StationTable.h
00032  */
00033  
00034 #ifndef StationTable_CLASS
00035 #define StationTable_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 /*
00070 #include <Enumerations.h>
00071 using namespace enumerations;
00072 */
00073 
00074 
00075 
00076 
00077         
00078 
00079         
00080 
00081         
00082 #include "CStationType.h"
00083 using namespace StationTypeMod;
00084         
00085 
00086         
00087 
00088 
00089 #ifndef WITHOUT_ACS
00090 #include <asdmIDLC.h>
00091 using asdmIDL::StationTableIDL;
00092 #endif
00093 
00094 using asdm::Angle;
00095 using asdm::AngularRate;
00096 using asdm::ArrayTime;
00097 using asdm::Complex;
00098 using asdm::Entity;
00099 using asdm::EntityId;
00100 using asdm::EntityRef;
00101 using asdm::Flux;
00102 using asdm::Frequency;
00103 using asdm::Humidity;
00104 using asdm::Interval;
00105 using asdm::Length;
00106 using asdm::PartId;
00107 using asdm::Pressure;
00108 using asdm::Speed;
00109 using asdm::Tag;
00110 using asdm::Temperature;
00111 
00112 using asdm::DuplicateKey;
00113 using asdm::ConversionException;
00114 using asdm::NoSuchRow;
00115 using asdm::DuplicateKey;
00116 
00117 #include <Representable.h>
00118 
00119 namespace asdm {
00120 
00121 //class asdm::ASDM;
00122 //class asdm::StationRow;
00123 
00124 class ASDM;
00125 class StationRow;
00171 class StationTable : public Representable {
00172         friend class asdm::ASDM;
00173 
00174 public:
00175 
00176 
00182         static vector<string> getKeyName();
00183 
00184 
00185         virtual ~StationTable();
00186         
00192         ASDM &getContainer() const;
00193         
00199         unsigned int size() ;
00200         
00206         string getName() const;
00207 
00211         Entity getEntity() const;
00212 
00217         void setEntity(Entity e);
00218 
00219         //
00220         // ====> Row creation.
00221         //
00222         
00227         StationRow *newRow();
00228         
00233         StationRow* newRowEmpty();
00234 
00235         
00247         StationRow *newRow(string name, vector<Length > position, StationType type);
00248         
00253         StationRow *newRowFull(string name, vector<Length > position, StationType type);
00254 
00255 
00268          StationRow *newRow(StationRow *row); 
00269 
00274          StationRow *newRowCopy(StationRow *row); 
00275 
00276         //
00277         // ====> Append a row to its table.
00278         //
00279 
00280         
00281         
00282         
00292          StationRow* add(StationRow* x) ;
00293 
00294 
00295 
00296         //
00297         // ====> Methods returning rows.
00298         //
00299                 
00305         vector<StationRow *> get() ;
00306         
00307 
00308 
00309  
00310         
00320         StationRow* StationTable::getRowByKey(Tag stationId);
00321 
00322                 
00323 
00324 
00325 
00339         StationRow* lookup(string name, vector<Length > position, StationType type); 
00340 
00341 
00342 #ifndef WITHOUT_ACS
00343         // Conversion Methods
00349         StationTableIDL *toIDL() ;
00350 #endif
00351 
00352 #ifndef WITHOUT_ACS
00353 
00359         void fromIDL(StationTableIDL x) throw(DuplicateKey,ConversionException);
00360 #endif
00361 
00365         char *toFITS() const throw(ConversionException);
00366 
00370         void fromFITS(char *fits) throw(ConversionException);
00371 
00375         string toVOTable() const throw(ConversionException);
00376 
00380         void fromVOTable(string vo) throw(ConversionException);
00381 
00388         string toXML()  throw(ConversionException);
00389         
00395         void fromXML(string xmlDoc) throw(ConversionException);
00396         
00402         string toMIME();
00403         
00410          void setFromMIME(const string & mimeMsg);
00411         
00421           void toFile(string directory);
00422           
00431          void setFromFile(const string& directory);     
00432 
00433 private:
00434 
00443         StationTable (ASDM & container);
00444 
00445         ASDM & container;
00446         
00447         bool archiveAsBin; // If true archive binary else archive XML
00448         bool fileAsBin ; // If true file binary else file XML   
00449         
00450         Entity entity;
00451         
00452 
00453         // A map for the autoincrementation algorithm
00454         map<string,int>  noAutoIncIds;
00455         void autoIncrement(string key, StationRow* x);
00456 
00457 
00461         static string tableName;
00462 
00463 
00467         static vector<string> key;
00468 
00469 
00475         StationRow* checkAndAdd(StationRow* x) throw (DuplicateKey, UniquenessViolationException);
00476 
00477 
00478 
00479 // A data structure to store the pointers on the table's rows.
00480 
00481 // In all cases we maintain a private ArrayList of StationRow s.
00482    vector<StationRow * > privateRows;
00483    
00484 
00485                         
00486         vector<StationRow *> row;
00487 
00488 
00489         void error() throw(ConversionException);
00490 
00491 };
00492 
00493 } // End namespace asdm
00494 
00495 #endif /* StationTable_CLASS */

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