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 namespace asdm {
00126 
00127 //class asdm::ASDM;
00128 //class asdm::CalDelayRow;
00129 
00130 class ASDM;
00131 class CalDelayRow;
00318 class CalDelayTable : public Representable {
00319         friend class ASDM;
00320 
00321 public:
00322 
00323 
00329         static std::vector<std::string> getKeyName();
00330 
00331 
00332         virtual ~CalDelayTable();
00333         
00339         ASDM &getContainer() const;
00340         
00346         unsigned int size() const;
00347         
00355         std::string getName() const;
00356         
00364         static std::string name() ;     
00365         
00370          std::string getVersion() const ;
00371         
00377          static const std::vector<std::string>& getAttributesNames();
00378 
00384          static const std::vector<std::string>& defaultAttributesNamesInBin();
00385          
00389         Entity getEntity() const;
00390 
00395         void setEntity(Entity e);
00396                 
00404         std::string toXML()  ;
00405 
00406 #ifndef WITHOUT_ACS
00407         // Conversion Methods
00413         asdmIDL::CalDelayTableIDL *toIDL() ;
00414 #endif
00415 
00416 #ifndef WITHOUT_ACS
00417 
00423         void fromIDL(asdmIDL::CalDelayTableIDL x) ;
00424 #endif
00425         
00426         //
00427         // ====> Row creation.
00428         //
00429         
00434         CalDelayRow *newRow();
00435         
00436         
00472         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);
00473         
00474 
00475 
00488          CalDelayRow *newRow(CalDelayRow *row); 
00489 
00490         //
00491         // ====> Append a row to its table.
00492         //
00493  
00494         
00507         CalDelayRow* add(CalDelayRow* x) ; 
00508 
00509  
00510 
00511 
00512 
00513         //
00514         // ====> Methods returning rows.
00515         //
00516                 
00522         std::vector<CalDelayRow *> get() ;
00523         
00530          const std::vector<CalDelayRow *>& get() const ;
00531         
00532 
00533 
00534  
00535         
00555         CalDelayRow* getRowByKey(string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
00556 
00557                 
00558 
00559 
00560 
00598         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); 
00599 
00600 
00601         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00602         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00603 
00604 private:
00605 
00614         CalDelayTable (ASDM & container);
00615 
00616         ASDM & container;
00617         
00618         bool archiveAsBin; // If true archive binary else archive XML
00619         bool fileAsBin ; // If true file binary else file XML   
00620         
00621         std::string version ; 
00622         
00623         Entity entity;
00624         
00625 
00626 
00630         static std::string itsName;
00631         
00635         static std::vector<std::string> attributesNames;
00636         
00640         static std::vector<std::string> attributesNamesInBin;
00641         
00642 
00646         static bool initAttributesNames(), initAttributesNamesDone ;
00647         
00648 
00652         static std::vector<std::string> key;
00653 
00654 
00662         CalDelayRow* checkAndAdd(CalDelayRow* x) ;
00663         
00669          void append(CalDelayRow* x) ;
00670          
00676          void addWithoutCheckingUnique(CalDelayRow* x) ;
00677          
00678          
00679 
00680 
00681 
00682 // A data structure to store the pointers on the table's rows.
00683 
00684 // In all cases we maintain a private vector of CalDelayRow s.
00685    std::vector<CalDelayRow * > privateRows;
00686    
00687 
00688                         
00689         std::vector<CalDelayRow *> row;
00690 
00691         
00692         void error() ; //throw(ConversionException);
00693 
00694         
00701         void fromXML(std::string& xmlDoc) ;
00702                 
00703         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00704 
00709         void setFromMIMEFile(const std::string& directory);
00710         /*
00711         void openMIMEFile(const std::string& directory);
00712         */
00713         void setFromXMLFile(const std::string& directory);
00714         
00722         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00723   
00724         
00731          void setFromMIME(const std::string & mimeMsg);
00732         
00736         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00737         
00747           void toFile(std::string directory);
00748           
00752           bool loadInProgress;
00753           void checkPresenceInMemory() {
00754                 if (!presentInMemory && !loadInProgress) {
00755                         loadInProgress = true;
00756                         setFromFile(getContainer().getDirectory());
00757                         presentInMemory = true;
00758                         loadInProgress = false;
00759                 }
00760           }
00769          void setFromFile(const std::string& directory);        
00770  
00771 };
00772 
00773 } // End namespace asdm
00774 
00775 #endif /* CalDelayTable_CLASS */