casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CalAtmosphereTable.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 CalAtmosphereTable.h
00032  */
00033  
00034 #ifndef CalAtmosphereTable_CLASS
00035 #define CalAtmosphereTable_CLASS
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 
00041 
00042 
00043         
00044 #include <ArrayTime.h>
00045         
00046 
00047         
00048 #include <Temperature.h>
00049         
00050 
00051         
00052 #include <Humidity.h>
00053         
00054 
00055         
00056 #include <Tag.h>
00057         
00058 
00059         
00060 #include <Length.h>
00061         
00062 
00063         
00064 #include <Frequency.h>
00065         
00066 
00067         
00068 #include <Pressure.h>
00069         
00070 
00071 
00072 
00073 
00074         
00075 #include "CReceiverBand.h"
00076         
00077 
00078         
00079 
00080         
00081 #include "CBasebandName.h"
00082         
00083 
00084         
00085 
00086         
00087 
00088         
00089 
00090         
00091 
00092         
00093 
00094         
00095 
00096         
00097 
00098         
00099 
00100         
00101 
00102         
00103 
00104         
00105 
00106         
00107 #include "CPolarizationType.h"
00108         
00109 
00110         
00111 
00112         
00113 
00114         
00115 #include "CSyscalMethod.h"
00116         
00117 
00118         
00119 
00120         
00121 
00122         
00123 
00124         
00125 
00126         
00127 
00128         
00129 
00130         
00131 
00132         
00133 
00134         
00135 
00136         
00137 
00138         
00139 
00140         
00141 
00142         
00143 
00144         
00145 
00146         
00147 
00148         
00149 
00150 
00151 
00152 #include <ConversionException.h>
00153 #include <DuplicateKey.h>
00154 #include <UniquenessViolationException.h>
00155 #include <NoSuchRow.h>
00156 #include <DuplicateKey.h>
00157 
00158 
00159 #ifndef WITHOUT_ACS
00160 #include <asdmIDLC.h>
00161 #endif
00162 
00163 #include <Representable.h>
00164 
00165 #include <pthread.h>
00166 
00167 namespace asdm {
00168 
00169 //class asdm::ASDM;
00170 //class asdm::CalAtmosphereRow;
00171 
00172 class ASDM;
00173 class CalAtmosphereRow;
00463 class CalAtmosphereTable : public Representable {
00464         friend class ASDM;
00465 
00466 public:
00467 
00468 
00474         static const std::vector<std::string>& getKeyName();
00475 
00476 
00477         virtual ~CalAtmosphereTable();
00478         
00484         ASDM &getContainer() const;
00485         
00491         unsigned int size() const;
00492         
00500         std::string getName() const;
00501         
00509         static std::string name() ;     
00510         
00515          std::string getVersion() const ;
00516         
00522          static const std::vector<std::string>& getAttributesNames();
00523 
00529          static const std::vector<std::string>& defaultAttributesNamesInBin();
00530          
00534         Entity getEntity() const;
00535 
00540         void setEntity(Entity e);
00541                 
00549         std::string toXML()  ;
00550 
00551 #ifndef WITHOUT_ACS
00552         // Conversion Methods
00558         asdmIDL::CalAtmosphereTableIDL *toIDL() ;
00559         
00567          void toIDL(asdmIDL::CalAtmosphereTableIDL& x) const;
00568          
00569 #endif
00570 
00571 #ifndef WITHOUT_ACS
00572 
00578         void fromIDL(asdmIDL::CalAtmosphereTableIDL x) ;
00579 #endif
00580         
00581         //
00582         // ====> Row creation.
00583         //
00584         
00589         CalAtmosphereRow *newRow();
00590         
00591         
00657         CalAtmosphereRow *newRow(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, BasebandNameMod::BasebandName basebandName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numFreq, int numLoad, int numReceptor, vector<vector<float > > forwardEffSpectrum, vector<Frequency > frequencyRange, Pressure groundPressure, Humidity groundRelHumidity, vector<Frequency > frequencySpectrum, Temperature groundTemperature, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<float > > powerSkySpectrum, vector<vector<vector<float > > > powerLoadSpectrum, SyscalMethodMod::SyscalMethod syscalType, vector<vector<Temperature > > tAtmSpectrum, vector<vector<Temperature > > tRecSpectrum, vector<vector<Temperature > > tSysSpectrum, vector<vector<float > > tauSpectrum, vector<Temperature > tAtm, vector<Temperature > tRec, vector<Temperature > tSys, vector<float > tau, vector<Length > water, vector<Length > waterError);
00658         
00659 
00660 
00673          CalAtmosphereRow *newRow(CalAtmosphereRow *row); 
00674 
00675         //
00676         // ====> Append a row to its table.
00677         //
00678  
00679         
00692         CalAtmosphereRow* add(CalAtmosphereRow* x) ; 
00693 
00694  
00695 
00696 
00697 
00698         //
00699         // ====> Methods returning rows.
00700         //
00701                 
00707         std::vector<CalAtmosphereRow *> get() ;
00708         
00715          const std::vector<CalAtmosphereRow *>& get() const ;
00716         
00717 
00718 
00719  
00720         
00738         CalAtmosphereRow* getRowByKey(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, BasebandNameMod::BasebandName basebandName, Tag calDataId, Tag calReductionId);
00739 
00740                 
00741 
00742 
00743 
00811         CalAtmosphereRow* lookup(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, BasebandNameMod::BasebandName basebandName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numFreq, int numLoad, int numReceptor, vector<vector<float > > forwardEffSpectrum, vector<Frequency > frequencyRange, Pressure groundPressure, Humidity groundRelHumidity, vector<Frequency > frequencySpectrum, Temperature groundTemperature, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<float > > powerSkySpectrum, vector<vector<vector<float > > > powerLoadSpectrum, SyscalMethodMod::SyscalMethod syscalType, vector<vector<Temperature > > tAtmSpectrum, vector<vector<Temperature > > tRecSpectrum, vector<vector<Temperature > > tSysSpectrum, vector<vector<float > > tauSpectrum, vector<Temperature > tAtm, vector<Temperature > tRec, vector<Temperature > tSys, vector<float > tau, vector<Length > water, vector<Length > waterError); 
00812 
00813 
00814         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00815         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00816 
00817 private:
00818 
00827         CalAtmosphereTable (ASDM & container);
00828 
00829         ASDM & container;
00830         
00831         bool archiveAsBin; // If true archive binary else archive XML
00832         bool fileAsBin ; // If true file binary else file XML   
00833         
00834         std::string version ; 
00835         
00836         Entity entity;
00837         
00838 
00839 
00847         CalAtmosphereRow* checkAndAdd(CalAtmosphereRow* x, bool skipCheckUniqueness=false) ;
00848         
00854          void append(CalAtmosphereRow* x) ;
00855          
00861          void addWithoutCheckingUnique(CalAtmosphereRow* x) ;
00862          
00863          
00864 
00865 
00866 
00867 // A data structure to store the pointers on the table's rows.
00868 
00869 // In all cases we maintain a private vector of CalAtmosphereRow s.
00870    std::vector<CalAtmosphereRow * > privateRows;
00871    
00872 
00873                         
00874         std::vector<CalAtmosphereRow *> row;
00875 
00876         
00877         void error() ; //throw(ConversionException);
00878 
00879         
00886         void fromXML(std::string& xmlDoc) ;
00887                 
00888         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00889 
00894         void setFromMIMEFile(const std::string& directory);
00895         /*
00896         void openMIMEFile(const std::string& directory);
00897         */
00898         void setFromXMLFile(const std::string& directory);
00899         
00907         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00908   
00909         
00916          void setFromMIME(const std::string & mimeMsg);
00917         
00921         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00922         
00932           void toFile(std::string directory);
00933           
00937           bool loadInProgress;
00938           void checkPresenceInMemory() {
00939                 if (!presentInMemory && !loadInProgress) {
00940                         loadInProgress = true;
00941                         setFromFile(getContainer().getDirectory());
00942                         presentInMemory = true;
00943                         loadInProgress = false;
00944                 }
00945           }
00954          void setFromFile(const std::string& directory);        
00955  
00956 };
00957 
00958 } // End namespace asdm
00959 
00960 #endif /* CalAtmosphereTable_CLASS */