casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CalDelayTable.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 CalDelayTable.h
00032  */
00033  
00034 #ifndef CalDelayTable_CLASS
00035 #define CalDelayTable_CLASS
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 
00041 
00042 
00043         
00044 #include <ArrayTime.h>
00045         
00046 
00047         
00048 #include <Angle.h>
00049         
00050 
00051         
00052 #include <Tag.h>
00053         
00054 
00055         
00056 #include <Frequency.h>
00057         
00058 
00059 
00060 
00061 
00062         
00063 
00064         
00065 #include "CAtmPhaseCorrection.h"
00066         
00067 
00068         
00069 #include "CBasebandName.h"
00070         
00071 
00072         
00073 #include "CReceiverBand.h"
00074         
00075 
00076         
00077 
00078         
00079 
00080         
00081 
00082         
00083 
00084         
00085 
00086         
00087 
00088         
00089 #include "CPolarizationType.h"
00090         
00091 
00092         
00093 
00094         
00095 
00096         
00097 
00098         
00099 
00100         
00101 
00102         
00103 
00104         
00105 
00106         
00107 #include "CReceiverSideband.h"
00108         
00109 
00110 
00111 
00112 #include <ConversionException.h>
00113 #include <DuplicateKey.h>
00114 #include <UniquenessViolationException.h>
00115 #include <NoSuchRow.h>
00116 #include <DuplicateKey.h>
00117 
00118 
00119 #ifndef WITHOUT_ACS
00120 #include <asdmIDLC.h>
00121 #endif
00122 
00123 #include <Representable.h>
00124 
00125 #include <pthread.h>
00126 
00127 namespace asdm {
00128 
00129 //class asdm::ASDM;
00130 //class asdm::CalDelayRow;
00131 
00132 class ASDM;
00133 class CalDelayRow;
00320 class CalDelayTable : public Representable {
00321         friend class ASDM;
00322 
00323 public:
00324 
00325 
00331         static const std::vector<std::string>& getKeyName();
00332 
00333 
00334         virtual ~CalDelayTable();
00335         
00341         ASDM &getContainer() const;
00342         
00348         unsigned int size() const;
00349         
00357         std::string getName() const;
00358         
00366         static std::string name() ;     
00367         
00372          std::string getVersion() const ;
00373         
00379          static const std::vector<std::string>& getAttributesNames();
00380 
00386          static const std::vector<std::string>& defaultAttributesNamesInBin();
00387          
00391         Entity getEntity() const;
00392 
00397         void setEntity(Entity e);
00398                 
00406         std::string toXML()  ;
00407 
00408 #ifndef WITHOUT_ACS
00409         // Conversion Methods
00415         asdmIDL::CalDelayTableIDL *toIDL() ;
00416         
00424          void toIDL(asdmIDL::CalDelayTableIDL& x) const;
00425          
00426 #endif
00427 
00428 #ifndef WITHOUT_ACS
00429 
00435         void fromIDL(asdmIDL::CalDelayTableIDL x) ;
00436 #endif
00437         
00438         //
00439         // ====> Row creation.
00440         //
00441         
00446         CalDelayRow *newRow();
00447         
00448         
00484         CalDelayRow *newRow(string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, string refAntennaName, int numReceptor, vector<double > delayError, vector<double > delayOffset, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<double > reducedChiSquared, vector<double > appliedDelay);
00485         
00486 
00487 
00500          CalDelayRow *newRow(CalDelayRow *row); 
00501 
00502         //
00503         // ====> Append a row to its table.
00504         //
00505  
00506         
00519         CalDelayRow* add(CalDelayRow* x) ; 
00520 
00521  
00522 
00523 
00524 
00525         //
00526         // ====> Methods returning rows.
00527         //
00528                 
00534         std::vector<CalDelayRow *> get() ;
00535         
00542          const std::vector<CalDelayRow *>& get() const ;
00543         
00544 
00545 
00546  
00547         
00567         CalDelayRow* getRowByKey(string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
00568 
00569                 
00570 
00571 
00572 
00610         CalDelayRow* lookup(string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, string refAntennaName, int numReceptor, vector<double > delayError, vector<double > delayOffset, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<double > reducedChiSquared, vector<double > appliedDelay); 
00611 
00612 
00613         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00614         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00615 
00616 private:
00617 
00626         CalDelayTable (ASDM & container);
00627 
00628         ASDM & container;
00629         
00630         bool archiveAsBin; // If true archive binary else archive XML
00631         bool fileAsBin ; // If true file binary else file XML   
00632         
00633         std::string version ; 
00634         
00635         Entity entity;
00636         
00637 
00638 
00646         CalDelayRow* checkAndAdd(CalDelayRow* x, bool skipCheckUniqueness=false) ;
00647         
00653          void append(CalDelayRow* x) ;
00654          
00660          void addWithoutCheckingUnique(CalDelayRow* x) ;
00661          
00662          
00663 
00664 
00665 
00666 // A data structure to store the pointers on the table's rows.
00667 
00668 // In all cases we maintain a private vector of CalDelayRow s.
00669    std::vector<CalDelayRow * > privateRows;
00670    
00671 
00672                         
00673         std::vector<CalDelayRow *> row;
00674 
00675         
00676         void error() ; //throw(ConversionException);
00677 
00678         
00685         void fromXML(std::string& xmlDoc) ;
00686                 
00687         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00688 
00693         void setFromMIMEFile(const std::string& directory);
00694         /*
00695         void openMIMEFile(const std::string& directory);
00696         */
00697         void setFromXMLFile(const std::string& directory);
00698         
00706         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00707   
00708         
00715          void setFromMIME(const std::string & mimeMsg);
00716         
00720         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00721         
00731           void toFile(std::string directory);
00732           
00736           bool loadInProgress;
00737           void checkPresenceInMemory() {
00738                 if (!presentInMemory && !loadInProgress) {
00739                         loadInProgress = true;
00740                         setFromFile(getContainer().getDirectory());
00741                         presentInMemory = true;
00742                         loadInProgress = false;
00743                 }
00744           }
00753          void setFromFile(const std::string& directory);        
00754  
00755 };
00756 
00757 } // End namespace asdm
00758 
00759 #endif /* CalDelayTable_CLASS */