CalCurveTable.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 CalCurveTable_CLASS
00035 #define CalCurveTable_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 "CAtmPhaseCorrection.h"
00060
00061
00062
00063 #include "CCalCurveType.h"
00064
00065
00066
00067 #include "CReceiverBand.h"
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087 #include "CPolarizationType.h"
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100 #include <ConversionException.h>
00101 #include <DuplicateKey.h>
00102 #include <UniquenessViolationException.h>
00103 #include <NoSuchRow.h>
00104 #include <DuplicateKey.h>
00105
00106
00107 #ifndef WITHOUT_ACS
00108 #include <asdmIDLC.h>
00109 #endif
00110
00111 #include <Representable.h>
00112
00113 #include <pthread.h>
00114
00115 namespace asdm {
00116
00117
00118
00119
00120 class ASDM;
00121 class CalCurveRow;
00285 class CalCurveTable : public Representable {
00286 friend class ASDM;
00287
00288 public:
00289
00290
00296 static const std::vector<std::string>& getKeyName();
00297
00298
00299 virtual ~CalCurveTable();
00300
00306 ASDM &getContainer() const;
00307
00313 unsigned int size() const;
00314
00322 std::string getName() const;
00323
00331 static std::string name() ;
00332
00337 std::string getVersion() const ;
00338
00344 static const std::vector<std::string>& getAttributesNames();
00345
00351 static const std::vector<std::string>& defaultAttributesNamesInBin();
00352
00356 Entity getEntity() const;
00357
00362 void setEntity(Entity e);
00363
00371 std::string toXML() ;
00372
00373 #ifndef WITHOUT_ACS
00374
00380 asdmIDL::CalCurveTableIDL *toIDL() ;
00381
00389 void toIDL(asdmIDL::CalCurveTableIDL& x) const;
00390
00391 #endif
00392
00393 #ifndef WITHOUT_ACS
00394
00400 void fromIDL(asdmIDL::CalCurveTableIDL x) ;
00401 #endif
00402
00403
00404
00405
00406
00411 CalCurveRow *newRow();
00412
00413
00451 CalCurveRow *newRow(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, vector<Frequency > frequencyRange, int numAntenna, int numPoly, int numReceptor, vector<string > antennaNames, string refAntennaName, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<vector<float > > > curve, vector<double > reducedChiSquared);
00452
00453
00454
00467 CalCurveRow *newRow(CalCurveRow *row);
00468
00469
00470
00471
00472
00473
00486 CalCurveRow* add(CalCurveRow* x) ;
00487
00488
00489
00490
00491
00492
00493
00494
00495
00501 std::vector<CalCurveRow *> get() ;
00502
00509 const std::vector<CalCurveRow *>& get() const ;
00510
00511
00512
00513
00514
00532 CalCurveRow* getRowByKey(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
00533
00534
00535
00536
00537
00577 CalCurveRow* lookup(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, CalCurveTypeMod::CalCurveType typeCurve, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, vector<Frequency > frequencyRange, int numAntenna, int numPoly, int numReceptor, vector<string > antennaNames, string refAntennaName, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<vector<float > > > curve, vector<double > reducedChiSquared);
00578
00579
00580 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00581 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00582
00583 private:
00584
00593 CalCurveTable (ASDM & container);
00594
00595 ASDM & container;
00596
00597 bool archiveAsBin;
00598 bool fileAsBin ;
00599
00600 std::string version ;
00601
00602 Entity entity;
00603
00604
00605
00613 CalCurveRow* checkAndAdd(CalCurveRow* x, bool skipCheckUniqueness=false) ;
00614
00620 void append(CalCurveRow* x) ;
00621
00627 void addWithoutCheckingUnique(CalCurveRow* x) ;
00628
00629
00630
00631
00632
00633
00634
00635
00636 std::vector<CalCurveRow * > privateRows;
00637
00638
00639
00640 std::vector<CalCurveRow *> row;
00641
00642
00643 void error() ;
00644
00645
00652 void fromXML(std::string& xmlDoc) ;
00653
00654 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00655
00660 void setFromMIMEFile(const std::string& directory);
00661
00662
00663
00664 void setFromXMLFile(const std::string& directory);
00665
00673 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00674
00675
00682 void setFromMIME(const std::string & mimeMsg);
00683
00687 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00688
00698 void toFile(std::string directory);
00699
00703 bool loadInProgress;
00704 void checkPresenceInMemory() {
00705 if (!presentInMemory && !loadInProgress) {
00706 loadInProgress = true;
00707 setFromFile(getContainer().getDirectory());
00708 presentInMemory = true;
00709 loadInProgress = false;
00710 }
00711 }
00720 void setFromFile(const std::string& directory);
00721
00722 };
00723
00724 }
00725
00726 #endif