casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CalPhaseTable.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 CalPhaseTable.h
00032  */
00033  
00034 #ifndef CalPhaseTable_CLASS
00035 #define CalPhaseTable_CLASS
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 
00041 
00042 
00043         
00044 #include <ArrayTime.h>
00045         
00046 
00047         
00048 #include <Interval.h>
00049         
00050 
00051         
00052 #include <Angle.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 
00069 
00070         
00071 #include "CBasebandName.h"
00072         
00073 
00074         
00075 #include "CReceiverBand.h"
00076         
00077 
00078         
00079 #include "CAtmPhaseCorrection.h"
00080         
00081 
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 
00116 
00117 
00118 #include <ConversionException.h>
00119 #include <DuplicateKey.h>
00120 #include <UniquenessViolationException.h>
00121 #include <NoSuchRow.h>
00122 #include <DuplicateKey.h>
00123 
00124 
00125 #ifndef WITHOUT_ACS
00126 #include <asdmIDLC.h>
00127 #endif
00128 
00129 #include <Representable.h>
00130 
00131 namespace asdm {
00132 
00133 //class asdm::ASDM;
00134 //class asdm::CalPhaseRow;
00135 
00136 class ASDM;
00137 class CalPhaseRow;
00322 class CalPhaseTable : public Representable {
00323         friend class ASDM;
00324 
00325 public:
00326 
00327 
00333         static std::vector<std::string> getKeyName();
00334 
00335 
00336         virtual ~CalPhaseTable();
00337         
00343         ASDM &getContainer() const;
00344         
00350         unsigned int size() const;
00351         
00359         std::string getName() const;
00360         
00368         static std::string name() ;     
00369         
00374          std::string getVersion() const ;
00375         
00381          static const std::vector<std::string>& getAttributesNames();
00382 
00388          static const std::vector<std::string>& defaultAttributesNamesInBin();
00389          
00393         Entity getEntity() const;
00394 
00399         void setEntity(Entity e);
00400                 
00408         std::string toXML()  ;
00409 
00410 #ifndef WITHOUT_ACS
00411         // Conversion Methods
00417         asdmIDL::CalPhaseTableIDL *toIDL() ;
00418 #endif
00419 
00420 #ifndef WITHOUT_ACS
00421 
00427         void fromIDL(asdmIDL::CalPhaseTableIDL x) ;
00428 #endif
00429         
00430         //
00431         // ====> Row creation.
00432         //
00433         
00438         CalPhaseRow *newRow();
00439         
00440         
00486         CalPhaseRow *newRow(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numBaseline, int numReceptor, vector<vector<float > > ampli, vector<vector<string > > antennaNames, vector<Length > baselineLengths, vector<vector<float > > decorrelationFactor, vector<Angle > direction, vector<Frequency > frequencyRange, Interval integrationTime, vector<vector<float > > phase, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<float > > phaseRMS, vector<vector<float > > statPhaseRMS);
00487         
00488 
00489 
00502          CalPhaseRow *newRow(CalPhaseRow *row); 
00503 
00504         //
00505         // ====> Append a row to its table.
00506         //
00507  
00508         
00521         CalPhaseRow* add(CalPhaseRow* x) ; 
00522 
00523  
00524 
00525 
00526 
00527         //
00528         // ====> Methods returning rows.
00529         //
00530                 
00536         std::vector<CalPhaseRow *> get() ;
00537         
00544          const std::vector<CalPhaseRow *>& get() const ;
00545         
00546 
00547 
00548  
00549         
00567         CalPhaseRow* getRowByKey(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId);
00568 
00569                 
00570 
00571 
00572 
00620         CalPhaseRow* lookup(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numBaseline, int numReceptor, vector<vector<float > > ampli, vector<vector<string > > antennaNames, vector<Length > baselineLengths, vector<vector<float > > decorrelationFactor, vector<Angle > direction, vector<Frequency > frequencyRange, Interval integrationTime, vector<vector<float > > phase, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<float > > phaseRMS, vector<vector<float > > statPhaseRMS); 
00621 
00622 
00623         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00624         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00625 
00626 private:
00627 
00636         CalPhaseTable (ASDM & container);
00637 
00638         ASDM & container;
00639         
00640         bool archiveAsBin; // If true archive binary else archive XML
00641         bool fileAsBin ; // If true file binary else file XML   
00642         
00643         std::string version ; 
00644         
00645         Entity entity;
00646         
00647 
00648 
00652         static std::string itsName;
00653         
00657         static std::vector<std::string> attributesNames;
00658         
00662         static std::vector<std::string> attributesNamesInBin;
00663         
00664 
00668         static bool initAttributesNames(), initAttributesNamesDone ;
00669         
00670 
00674         static std::vector<std::string> key;
00675 
00676 
00684         CalPhaseRow* checkAndAdd(CalPhaseRow* x) ;
00685         
00691          void append(CalPhaseRow* x) ;
00692          
00698          void addWithoutCheckingUnique(CalPhaseRow* x) ;
00699          
00700          
00701 
00702 
00703 
00704 // A data structure to store the pointers on the table's rows.
00705 
00706 // In all cases we maintain a private vector of CalPhaseRow s.
00707    std::vector<CalPhaseRow * > privateRows;
00708    
00709 
00710                         
00711         std::vector<CalPhaseRow *> row;
00712 
00713         
00714         void error() ; //throw(ConversionException);
00715 
00716         
00723         void fromXML(std::string& xmlDoc) ;
00724                 
00725         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00726 
00731         void setFromMIMEFile(const std::string& directory);
00732         /*
00733         void openMIMEFile(const std::string& directory);
00734         */
00735         void setFromXMLFile(const std::string& directory);
00736         
00744         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00745   
00746         
00753          void setFromMIME(const std::string & mimeMsg);
00754         
00758         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00759         
00769           void toFile(std::string directory);
00770           
00774           bool loadInProgress;
00775           void checkPresenceInMemory() {
00776                 if (!presentInMemory && !loadInProgress) {
00777                         loadInProgress = true;
00778                         setFromFile(getContainer().getDirectory());
00779                         presentInMemory = true;
00780                         loadInProgress = false;
00781                 }
00782           }
00791          void setFromFile(const std::string& directory);        
00792  
00793 };
00794 
00795 } // End namespace asdm
00796 
00797 #endif /* CalPhaseTable_CLASS */