CalBandpassTable.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
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 
00126 
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         
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         
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         
00501         
00502  
00503         
00516         CalBandpassRow* add(CalBandpassRow* x) ; 
00517 
00518  
00519 
00520 
00521 
00522         
00523         
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; 
00636         bool fileAsBin ; 
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 
00672 
00673 
00674    std::vector<CalBandpassRow * > privateRows;
00675    
00676 
00677                         
00678         std::vector<CalBandpassRow *> row;
00679 
00680         
00681         void error() ; 
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 
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 } 
00763 
00764 #endif