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 namespace asdm {
00122 
00123 //class asdm::ASDM;
00124 //class asdm::CalBandpassRow;
00125 
00126 class ASDM;
00127 class CalBandpassRow;
00309 class CalBandpassTable : public Representable {
00310         friend class ASDM;
00311 
00312 public:
00313 
00314 
00320         static std::vector<std::string> getKeyName();
00321 
00322 
00323         virtual ~CalBandpassTable();
00324         
00330         ASDM &getContainer() const;
00331         
00337         unsigned int size() const;
00338         
00346         std::string getName() const;
00347         
00355         static std::string name() ;     
00356         
00361          std::string getVersion() const ;
00362         
00368          static const std::vector<std::string>& getAttributesNames();
00369 
00375          static const std::vector<std::string>& defaultAttributesNamesInBin();
00376          
00380         Entity getEntity() const;
00381 
00386         void setEntity(Entity e);
00387                 
00395         std::string toXML()  ;
00396 
00397 #ifndef WITHOUT_ACS
00398         // Conversion Methods
00404         asdmIDL::CalBandpassTableIDL *toIDL() ;
00405 #endif
00406 
00407 #ifndef WITHOUT_ACS
00408 
00414         void fromIDL(asdmIDL::CalBandpassTableIDL x) ;
00415 #endif
00416         
00417         //
00418         // ====> Row creation.
00419         //
00420         
00425         CalBandpassRow *newRow();
00426         
00427         
00469         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);
00470         
00471 
00472 
00485          CalBandpassRow *newRow(CalBandpassRow *row); 
00486 
00487         //
00488         // ====> Append a row to its table.
00489         //
00490  
00491         
00504         CalBandpassRow* add(CalBandpassRow* x) ; 
00505 
00506  
00507 
00508 
00509 
00510         //
00511         // ====> Methods returning rows.
00512         //
00513                 
00519         std::vector<CalBandpassRow *> get() ;
00520         
00527          const std::vector<CalBandpassRow *>& get() const ;
00528         
00529 
00530 
00531  
00532         
00554         CalBandpassRow* getRowByKey(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband sideband, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
00555 
00556                 
00557 
00558 
00559 
00603         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); 
00604 
00605 
00606         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00607         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00608 
00609 private:
00610 
00619         CalBandpassTable (ASDM & container);
00620 
00621         ASDM & container;
00622         
00623         bool archiveAsBin; // If true archive binary else archive XML
00624         bool fileAsBin ; // If true file binary else file XML   
00625         
00626         std::string version ; 
00627         
00628         Entity entity;
00629         
00630 
00631 
00635         static std::string itsName;
00636         
00640         static std::vector<std::string> attributesNames;
00641         
00645         static std::vector<std::string> attributesNamesInBin;
00646         
00647 
00651         static bool initAttributesNames(), initAttributesNamesDone ;
00652         
00653 
00657         static std::vector<std::string> key;
00658 
00659 
00667         CalBandpassRow* checkAndAdd(CalBandpassRow* x) ;
00668         
00674          void append(CalBandpassRow* x) ;
00675          
00681          void addWithoutCheckingUnique(CalBandpassRow* x) ;
00682          
00683          
00684 
00685 
00686 
00687 // A data structure to store the pointers on the table's rows.
00688 
00689 // In all cases we maintain a private vector of CalBandpassRow s.
00690    std::vector<CalBandpassRow * > privateRows;
00691    
00692 
00693                         
00694         std::vector<CalBandpassRow *> row;
00695 
00696         
00697         void error() ; //throw(ConversionException);
00698 
00699         
00706         void fromXML(std::string& xmlDoc) ;
00707                 
00708         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00709 
00714         void setFromMIMEFile(const std::string& directory);
00715         /*
00716         void openMIMEFile(const std::string& directory);
00717         */
00718         void setFromXMLFile(const std::string& directory);
00719         
00727         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00728   
00729         
00736          void setFromMIME(const std::string & mimeMsg);
00737         
00741         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00742         
00752           void toFile(std::string directory);
00753           
00757           bool loadInProgress;
00758           void checkPresenceInMemory() {
00759                 if (!presentInMemory && !loadInProgress) {
00760                         loadInProgress = true;
00761                         setFromFile(getContainer().getDirectory());
00762                         presentInMemory = true;
00763                         loadInProgress = false;
00764                 }
00765           }
00774          void setFromFile(const std::string& directory);        
00775  
00776 };
00777 
00778 } // End namespace asdm
00779 
00780 #endif /* CalBandpassTable_CLASS */