casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CalBandpassTable.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 CalBandpassTable.h
00032  */
00033  
00034 #ifndef CalBandpassTable_CLASS
00035 #define CalBandpassTable_CLASS
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 
00041 
00042 
00043         
00044 #include <ArrayTime.h>
00045         
00046 
00047         
00048 #include <Tag.h>
00049         
00050 
00051         
00052 #include <Frequency.h>
00053         
00054 
00055 
00056 
00057 
00058         
00059 #include "CBasebandName.h"
00060         
00061 
00062         
00063 #include "CNetSideband.h"
00064         
00065 
00066         
00067 #include "CAtmPhaseCorrection.h"
00068         
00069 
00070         
00071 #include "CCalCurveType.h"
00072         
00073 
00074         
00075 #include "CReceiverBand.h"
00076         
00077 
00078         
00079 
00080         
00081 
00082         
00083 
00084         
00085 
00086         
00087 
00088         
00089 
00090         
00091 
00092         
00093 
00094         
00095 #include "CPolarizationType.h"
00096         
00097 
00098         
00099 
00100         
00101 
00102         
00103 
00104         
00105 
00106 
00107 
00108 #include <ConversionException.h>
00109 #include <DuplicateKey.h>
00110 #include <UniquenessViolationException.h>
00111 #include <NoSuchRow.h>
00112 #include <DuplicateKey.h>
00113 
00114 
00115 #ifndef WITHOUT_ACS
00116 #include <asdmIDLC.h>
00117 #endif
00118 
00119 #include <Representable.h>
00120 
00121 #include <pthread.h>
00122 
00123 namespace asdm {
00124 
00125 //class asdm::ASDM;
00126 //class asdm::CalBandpassRow;
00127 
00128 class ASDM;
00129 class CalBandpassRow;
00311 class CalBandpassTable : public Representable {
00312         friend class ASDM;
00313 
00314 public:
00315 
00316 
00322         static const std::vector<std::string>& getKeyName();
00323 
00324 
00325         virtual ~CalBandpassTable();
00326         
00332         ASDM &getContainer() const;
00333         
00339         unsigned int size() const;
00340         
00348         std::string getName() const;
00349         
00357         static std::string name() ;     
00358         
00363          std::string getVersion() const ;
00364         
00370          static const std::vector<std::string>& getAttributesNames();
00371 
00377          static const std::vector<std::string>& defaultAttributesNamesInBin();
00378          
00382         Entity getEntity() const;
00383 
00388         void setEntity(Entity e);
00389                 
00397         std::string toXML()  ;
00398 
00399 #ifndef WITHOUT_ACS
00400         // Conversion Methods
00406         asdmIDL::CalBandpassTableIDL *toIDL() ;
00407         
00415          void toIDL(asdmIDL::CalBandpassTableIDL& x) const;
00416          
00417 #endif
00418 
00419 #ifndef WITHOUT_ACS
00420 
00426         void fromIDL(asdmIDL::CalBandpassTableIDL x) ;
00427 #endif
00428         
00429         //
00430         // ====> Row creation.
00431         //
00432         
00437         CalBandpassRow *newRow();
00438         
00439         
00481         CalBandpassRow *newRow(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband sideband, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numAntenna, int numPoly, int numReceptor, vector<string > antennaNames, string refAntennaName, vector<Frequency > freqLimits, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<vector<float > > > curve, vector<double > reducedChiSquared);
00482         
00483 
00484 
00497          CalBandpassRow *newRow(CalBandpassRow *row); 
00498 
00499         //
00500         // ====> Append a row to its table.
00501         //
00502  
00503         
00516         CalBandpassRow* add(CalBandpassRow* x) ; 
00517 
00518  
00519 
00520 
00521 
00522         //
00523         // ====> Methods returning rows.
00524         //
00525                 
00531         std::vector<CalBandpassRow *> get() ;
00532         
00539          const std::vector<CalBandpassRow *>& get() const ;
00540         
00541 
00542 
00543  
00544         
00566         CalBandpassRow* getRowByKey(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband sideband, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
00567 
00568                 
00569 
00570 
00571 
00615         CalBandpassRow* lookup(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband sideband, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numAntenna, int numPoly, int numReceptor, vector<string > antennaNames, string refAntennaName, vector<Frequency > freqLimits, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<vector<float > > > curve, vector<double > reducedChiSquared); 
00616 
00617 
00618         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00619         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00620 
00621 private:
00622 
00631         CalBandpassTable (ASDM & container);
00632 
00633         ASDM & container;
00634         
00635         bool archiveAsBin; // If true archive binary else archive XML
00636         bool fileAsBin ; // If true file binary else file XML   
00637         
00638         std::string version ; 
00639         
00640         Entity entity;
00641         
00642 
00643 
00651         CalBandpassRow* checkAndAdd(CalBandpassRow* x, bool skipCheckUniqueness=false) ;
00652         
00658          void append(CalBandpassRow* x) ;
00659          
00665          void addWithoutCheckingUnique(CalBandpassRow* x) ;
00666          
00667          
00668 
00669 
00670 
00671 // A data structure to store the pointers on the table's rows.
00672 
00673 // In all cases we maintain a private vector of CalBandpassRow s.
00674    std::vector<CalBandpassRow * > privateRows;
00675    
00676 
00677                         
00678         std::vector<CalBandpassRow *> row;
00679 
00680         
00681         void error() ; //throw(ConversionException);
00682 
00683         
00690         void fromXML(std::string& xmlDoc) ;
00691                 
00692         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00693 
00698         void setFromMIMEFile(const std::string& directory);
00699         /*
00700         void openMIMEFile(const std::string& directory);
00701         */
00702         void setFromXMLFile(const std::string& directory);
00703         
00711         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00712   
00713         
00720          void setFromMIME(const std::string & mimeMsg);
00721         
00725         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00726         
00736           void toFile(std::string directory);
00737           
00741           bool loadInProgress;
00742           void checkPresenceInMemory() {
00743                 if (!presentInMemory && !loadInProgress) {
00744                         loadInProgress = true;
00745                         setFromFile(getContainer().getDirectory());
00746                         presentInMemory = true;
00747                         loadInProgress = false;
00748                 }
00749           }
00758          void setFromFile(const std::string& directory);        
00759  
00760 };
00761 
00762 } // End namespace asdm
00763 
00764 #endif /* CalBandpassTable_CLASS */