CalPositionTable.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 CalPositionTable_CLASS
00035 #define CalPositionTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <ArrayTime.h>
00045
00046
00047
00048 #include <Angle.h>
00049
00050
00051
00052 #include <Tag.h>
00053
00054
00055
00056 #include <Length.h>
00057
00058
00059
00060
00061
00062
00063
00064
00065 #include "CAtmPhaseCorrection.h"
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079 #include "CPositionMethod.h"
00080
00081
00082
00083 #include "CReceiverBand.h"
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
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 CalPositionRow;
00312 class CalPositionTable : public Representable {
00313 friend class ASDM;
00314
00315 public:
00316
00317
00323 static const std::vector<std::string>& getKeyName();
00324
00325
00326 virtual ~CalPositionTable();
00327
00333 ASDM &getContainer() const;
00334
00340 unsigned int size() const;
00341
00349 std::string getName() const;
00350
00358 static std::string name() ;
00359
00364 std::string getVersion() const ;
00365
00371 static const std::vector<std::string>& getAttributesNames();
00372
00378 static const std::vector<std::string>& defaultAttributesNamesInBin();
00379
00383 Entity getEntity() const;
00384
00389 void setEntity(Entity e);
00390
00398 std::string toXML() ;
00399
00400 #ifndef WITHOUT_ACS
00401
00407 asdmIDL::CalPositionTableIDL *toIDL() ;
00408
00416 void toIDL(asdmIDL::CalPositionTableIDL& x) const;
00417
00418 #endif
00419
00420 #ifndef WITHOUT_ACS
00421
00427 void fromIDL(asdmIDL::CalPositionTableIDL x) ;
00428 #endif
00429
00430
00431
00432
00433
00438 CalPositionRow *newRow();
00439
00440
00484 CalPositionRow *newRow(string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, vector<Length > antennaPosition, string stationName, vector<Length > stationPosition, PositionMethodMod::PositionMethod positionMethod, ReceiverBandMod::ReceiverBand receiverBand, int numAntenna, vector<string > refAntennaNames, Length axesOffset, Length axesOffsetErr, bool axesOffsetFixed, vector<Length > positionOffset, vector<Length > positionErr, double reducedChiSquared);
00485
00486
00487
00500 CalPositionRow *newRow(CalPositionRow *row);
00501
00502
00503
00504
00505
00506
00519 CalPositionRow* add(CalPositionRow* x) ;
00520
00521
00522
00523
00524
00525
00526
00527
00528
00534 std::vector<CalPositionRow *> get() ;
00535
00542 const std::vector<CalPositionRow *>& get() const ;
00543
00544
00545
00546
00547
00563 CalPositionRow* getRowByKey(string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId);
00564
00565
00566
00567
00568
00614 CalPositionRow* lookup(string antennaName, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, vector<Length > antennaPosition, string stationName, vector<Length > stationPosition, PositionMethodMod::PositionMethod positionMethod, ReceiverBandMod::ReceiverBand receiverBand, int numAntenna, vector<string > refAntennaNames, Length axesOffset, Length axesOffsetErr, bool axesOffsetFixed, vector<Length > positionOffset, vector<Length > positionErr, double reducedChiSquared);
00615
00616
00617 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00618 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00619
00620 private:
00621
00630 CalPositionTable (ASDM & container);
00631
00632 ASDM & container;
00633
00634 bool archiveAsBin;
00635 bool fileAsBin ;
00636
00637 std::string version ;
00638
00639 Entity entity;
00640
00641
00642
00650 CalPositionRow* checkAndAdd(CalPositionRow* x, bool skipCheckUniqueness=false) ;
00651
00657 void append(CalPositionRow* x) ;
00658
00664 void addWithoutCheckingUnique(CalPositionRow* x) ;
00665
00666
00667
00668
00669
00670
00671
00672
00673 std::vector<CalPositionRow * > privateRows;
00674
00675
00676
00677 std::vector<CalPositionRow *> row;
00678
00679
00680 void error() ;
00681
00682
00689 void fromXML(std::string& xmlDoc) ;
00690
00691 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00692
00697 void setFromMIMEFile(const std::string& directory);
00698
00699
00700
00701 void setFromXMLFile(const std::string& directory);
00702
00710 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00711
00712
00719 void setFromMIME(const std::string & mimeMsg);
00720
00724 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00725
00735 void toFile(std::string directory);
00736
00740 bool loadInProgress;
00741 void checkPresenceInMemory() {
00742 if (!presentInMemory && !loadInProgress) {
00743 loadInProgress = true;
00744 setFromFile(getContainer().getDirectory());
00745 presentInMemory = true;
00746 loadInProgress = false;
00747 }
00748 }
00757 void setFromFile(const std::string& directory);
00758
00759 };
00760
00761 }
00762
00763 #endif