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 CalPhaseTable_CLASS
00035 #define CalPhaseTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <ArrayTime.h>
00045
00046
00047
00048 #include <Interval.h>
00049
00050
00051
00052 #include <Angle.h>
00053
00054
00055
00056 #include <Tag.h>
00057
00058
00059
00060 #include <Length.h>
00061
00062
00063
00064 #include <Frequency.h>
00065
00066
00067
00068
00069
00070
00071 #include "CBasebandName.h"
00072
00073
00074
00075 #include "CReceiverBand.h"
00076
00077
00078
00079 #include "CAtmPhaseCorrection.h"
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107 #include "CPolarizationType.h"
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118 #include <ConversionException.h>
00119 #include <DuplicateKey.h>
00120 #include <UniquenessViolationException.h>
00121 #include <NoSuchRow.h>
00122 #include <DuplicateKey.h>
00123
00124
00125 #ifndef WITHOUT_ACS
00126 #include <asdmIDLC.h>
00127 #endif
00128
00129 #include <Representable.h>
00130
00131 #include <pthread.h>
00132
00133 namespace asdm {
00134
00135
00136
00137
00138 class ASDM;
00139 class CalPhaseRow;
00324 class CalPhaseTable : public Representable {
00325 friend class ASDM;
00326
00327 public:
00328
00329
00335 static const std::vector<std::string>& getKeyName();
00336
00337
00338 virtual ~CalPhaseTable();
00339
00345 ASDM &getContainer() const;
00346
00352 unsigned int size() const;
00353
00361 std::string getName() const;
00362
00370 static std::string name() ;
00371
00376 std::string getVersion() const ;
00377
00383 static const std::vector<std::string>& getAttributesNames();
00384
00390 static const std::vector<std::string>& defaultAttributesNamesInBin();
00391
00395 Entity getEntity() const;
00396
00401 void setEntity(Entity e);
00402
00410 std::string toXML() ;
00411
00412 #ifndef WITHOUT_ACS
00413
00419 asdmIDL::CalPhaseTableIDL *toIDL() ;
00420
00428 void toIDL(asdmIDL::CalPhaseTableIDL& x) const;
00429
00430 #endif
00431
00432 #ifndef WITHOUT_ACS
00433
00439 void fromIDL(asdmIDL::CalPhaseTableIDL x) ;
00440 #endif
00441
00442
00443
00444
00445
00450 CalPhaseRow *newRow();
00451
00452
00498 CalPhaseRow *newRow(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numBaseline, int numReceptor, vector<vector<float > > ampli, vector<vector<string > > antennaNames, vector<Length > baselineLengths, vector<vector<float > > decorrelationFactor, vector<Angle > direction, vector<Frequency > frequencyRange, Interval integrationTime, vector<vector<float > > phase, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<float > > phaseRMS, vector<vector<float > > statPhaseRMS);
00499
00500
00501
00514 CalPhaseRow *newRow(CalPhaseRow *row);
00515
00516
00517
00518
00519
00520
00533 CalPhaseRow* add(CalPhaseRow* x) ;
00534
00535
00536
00537
00538
00539
00540
00541
00542
00548 std::vector<CalPhaseRow *> get() ;
00549
00556 const std::vector<CalPhaseRow *>& get() const ;
00557
00558
00559
00560
00561
00579 CalPhaseRow* getRowByKey(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId);
00580
00581
00582
00583
00584
00632 CalPhaseRow* lookup(BasebandNameMod::BasebandName basebandName, ReceiverBandMod::ReceiverBand receiverBand, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numBaseline, int numReceptor, vector<vector<float > > ampli, vector<vector<string > > antennaNames, vector<Length > baselineLengths, vector<vector<float > > decorrelationFactor, vector<Angle > direction, vector<Frequency > frequencyRange, Interval integrationTime, vector<vector<float > > phase, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<float > > phaseRMS, vector<vector<float > > statPhaseRMS);
00633
00634
00635 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00636 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00637
00638 private:
00639
00648 CalPhaseTable (ASDM & container);
00649
00650 ASDM & container;
00651
00652 bool archiveAsBin;
00653 bool fileAsBin ;
00654
00655 std::string version ;
00656
00657 Entity entity;
00658
00659
00660
00668 CalPhaseRow* checkAndAdd(CalPhaseRow* x, bool skipCheckUniqueness=false) ;
00669
00675 void append(CalPhaseRow* x) ;
00676
00682 void addWithoutCheckingUnique(CalPhaseRow* x) ;
00683
00684
00685
00686
00687
00688
00689
00690
00691 std::vector<CalPhaseRow * > privateRows;
00692
00693
00694
00695 std::vector<CalPhaseRow *> row;
00696
00697
00698 void error() ;
00699
00700
00707 void fromXML(std::string& xmlDoc) ;
00708
00709 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00710
00715 void setFromMIMEFile(const std::string& directory);
00716
00717
00718
00719 void setFromXMLFile(const std::string& directory);
00720
00728 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00729
00730
00737 void setFromMIME(const std::string & mimeMsg);
00738
00742 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00743
00753 void toFile(std::string directory);
00754
00758 bool loadInProgress;
00759 void checkPresenceInMemory() {
00760 if (!presentInMemory && !loadInProgress) {
00761 loadInProgress = true;
00762 setFromFile(getContainer().getDirectory());
00763 presentInMemory = true;
00764 loadInProgress = false;
00765 }
00766 }
00775 void setFromFile(const std::string& directory);
00776
00777 };
00778
00779 }
00780
00781 #endif