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 namespace asdm {
00166 
00167 //class asdm::ASDM;
00168 //class asdm::CalAtmosphereRow;
00169 
00170 class ASDM;
00171 class CalAtmosphereRow;
00461 class CalAtmosphereTable : public Representable {
00462         friend class ASDM;
00463 
00464 public:
00465 
00466 
00472         static std::vector<std::string> getKeyName();
00473 
00474 
00475         virtual ~CalAtmosphereTable();
00476         
00482         ASDM &getContainer() const;
00483         
00489         unsigned int size() const;
00490         
00498         std::string getName() const;
00499         
00507         static std::string name() ;     
00508         
00513          std::string getVersion() const ;
00514         
00520          static const std::vector<std::string>& getAttributesNames();
00521 
00527          static const std::vector<std::string>& defaultAttributesNamesInBin();
00528          
00532         Entity getEntity() const;
00533 
00538         void setEntity(Entity e);
00539                 
00547         std::string toXML()  ;
00548 
00549 #ifndef WITHOUT_ACS
00550         // Conversion Methods
00556         asdmIDL::CalAtmosphereTableIDL *toIDL() ;
00557 #endif
00558 
00559 #ifndef WITHOUT_ACS
00560 
00566         void fromIDL(asdmIDL::CalAtmosphereTableIDL x) ;
00567 #endif
00568         
00569         //
00570         // ====> Row creation.
00571         //
00572         
00577         CalAtmosphereRow *newRow();
00578         
00579         
00645         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);
00646         
00647 
00648 
00661          CalAtmosphereRow *newRow(CalAtmosphereRow *row); 
00662 
00663         //
00664         // ====> Append a row to its table.
00665         //
00666  
00667         
00680         CalAtmosphereRow* add(CalAtmosphereRow* x) ; 
00681 
00682  
00683 
00684 
00685 
00686         //
00687         // ====> Methods returning rows.
00688         //
00689                 
00695         std::vector<CalAtmosphereRow *> get() ;
00696         
00703          const std::vector<CalAtmosphereRow *>& get() const ;
00704         
00705 
00706 
00707  
00708         
00726         CalAtmosphereRow* getRowByKey(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, BasebandNameMod::BasebandName basebandName, Tag calDataId, Tag calReductionId);
00727 
00728                 
00729 
00730 
00731 
00799         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); 
00800 
00801 
00802         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00803         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00804 
00805 private:
00806 
00815         CalAtmosphereTable (ASDM & container);
00816 
00817         ASDM & container;
00818         
00819         bool archiveAsBin; // If true archive binary else archive XML
00820         bool fileAsBin ; // If true file binary else file XML   
00821         
00822         std::string version ; 
00823         
00824         Entity entity;
00825         
00826 
00827 
00831         static std::string itsName;
00832         
00836         static std::vector<std::string> attributesNames;
00837         
00841         static std::vector<std::string> attributesNamesInBin;
00842         
00843 
00847         static bool initAttributesNames(), initAttributesNamesDone ;
00848         
00849 
00853         static std::vector<std::string> key;
00854 
00855 
00863         CalAtmosphereRow* checkAndAdd(CalAtmosphereRow* x) ;
00864         
00870          void append(CalAtmosphereRow* x) ;
00871          
00877          void addWithoutCheckingUnique(CalAtmosphereRow* x) ;
00878          
00879          
00880 
00881 
00882 
00883 // A data structure to store the pointers on the table's rows.
00884 
00885 // In all cases we maintain a private vector of CalAtmosphereRow s.
00886    std::vector<CalAtmosphereRow * > privateRows;
00887    
00888 
00889                         
00890         std::vector<CalAtmosphereRow *> row;
00891 
00892         
00893         void error() ; //throw(ConversionException);
00894 
00895         
00902         void fromXML(std::string& xmlDoc) ;
00903                 
00904         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00905 
00910         void setFromMIMEFile(const std::string& directory);
00911         /*
00912         void openMIMEFile(const std::string& directory);
00913         */
00914         void setFromXMLFile(const std::string& directory);
00915         
00923         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00924   
00925         
00932          void setFromMIME(const std::string & mimeMsg);
00933         
00937         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00938         
00948           void toFile(std::string directory);
00949           
00953           bool loadInProgress;
00954           void checkPresenceInMemory() {
00955                 if (!presentInMemory && !loadInProgress) {
00956                         loadInProgress = true;
00957                         setFromFile(getContainer().getDirectory());
00958                         presentInMemory = true;
00959                         loadInProgress = false;
00960                 }
00961           }
00970          void setFromFile(const std::string& directory);        
00971  
00972 };
00973 
00974 } // End namespace asdm
00975 
00976 #endif /* CalAtmosphereTable_CLASS */