DelayModelTable.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 DelayModelTable_CLASS
00035 #define DelayModelTable_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 #include <ArrayTimeInterval.h>
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
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 #include "CPolarizationType.h"
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122 #include <ConversionException.h>
00123 #include <DuplicateKey.h>
00124 #include <UniquenessViolationException.h>
00125 #include <NoSuchRow.h>
00126 #include <DuplicateKey.h>
00127
00128
00129 #ifndef WITHOUT_ACS
00130 #include <asdmIDLC.h>
00131 #endif
00132
00133 #include <Representable.h>
00134
00135 #include <pthread.h>
00136
00137 namespace asdm {
00138
00139
00140
00141
00142 class ASDM;
00143 class DelayModelRow;
00394 class DelayModelTable : public Representable {
00395 friend class ASDM;
00396
00397 public:
00398
00399
00405 static const std::vector<std::string>& getKeyName();
00406
00407
00408 virtual ~DelayModelTable();
00409
00415 ASDM &getContainer() const;
00416
00422 unsigned int size() const;
00423
00431 std::string getName() const;
00432
00440 static std::string name() ;
00441
00446 std::string getVersion() const ;
00447
00453 static const std::vector<std::string>& getAttributesNames();
00454
00460 static const std::vector<std::string>& defaultAttributesNamesInBin();
00461
00465 Entity getEntity() const;
00466
00471 void setEntity(Entity e);
00472
00480 std::string toXML() ;
00481
00482 #ifndef WITHOUT_ACS
00483
00489 asdmIDL::DelayModelTableIDL *toIDL() ;
00490
00498 void toIDL(asdmIDL::DelayModelTableIDL& x) const;
00499
00500 #endif
00501
00502 #ifndef WITHOUT_ACS
00503
00509 void fromIDL(asdmIDL::DelayModelTableIDL x) ;
00510 #endif
00511
00512
00513
00514
00515
00520 DelayModelRow *newRow();
00521
00522
00546 DelayModelRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numPoly, vector<double > phaseDelay, vector<double > phaseDelayRate, vector<double > groupDelay, vector<double > groupDelayRate, Tag fieldId);
00547
00548
00549
00562 DelayModelRow *newRow(DelayModelRow *row);
00563
00564
00565
00566
00567
00568
00585 DelayModelRow* add(DelayModelRow* x) ;
00586
00587
00588
00589
00590
00591
00592
00593
00594
00600 std::vector<DelayModelRow *> get() ;
00601
00608 const std::vector<DelayModelRow *>& get() const ;
00609
00610
00621 std::vector <DelayModelRow*> *getByContext(Tag antennaId, Tag spectralWindowId);
00622
00623
00624
00625
00626
00640 DelayModelRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval);
00641
00642
00643
00644
00645
00671 DelayModelRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numPoly, vector<double > phaseDelay, vector<double > phaseDelayRate, vector<double > groupDelay, vector<double > groupDelayRate, Tag fieldId);
00672
00673
00674 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00675 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00676
00677 private:
00678
00687 DelayModelTable (ASDM & container);
00688
00689 ASDM & container;
00690
00691 bool archiveAsBin;
00692 bool fileAsBin ;
00693
00694 std::string version ;
00695
00696 Entity entity;
00697
00698
00699
00707 DelayModelRow* checkAndAdd(DelayModelRow* x, bool skipCheckUniqueness=false) ;
00708
00714 void append(DelayModelRow* x) ;
00715
00721 void addWithoutCheckingUnique(DelayModelRow* x) ;
00722
00723
00724
00725
00726
00727
00735 DelayModelRow * insertByStartTime(DelayModelRow* x, std::vector<DelayModelRow* >& row);
00736
00737
00738
00739
00740
00741
00742 std::vector<DelayModelRow * > privateRows;
00743
00744
00745
00746
00747
00748
00749
00750
00751 typedef std::vector <DelayModelRow* > TIME_ROWS;
00752 std::map<std::string, TIME_ROWS > context;
00753
00758 std::string Key(Tag antennaId, Tag spectralWindowId) ;
00759
00760
00761
00762
00768 void getByKeyNoAutoIncNoTime(std::vector <DelayModelRow*>& vin, std::vector <DelayModelRow*>& vout, Tag antennaId, Tag spectralWindowId);
00769
00770
00771
00772 void error() ;
00773
00774
00781 void fromXML(std::string& xmlDoc) ;
00782
00783 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00784
00789 void setFromMIMEFile(const std::string& directory);
00790
00791
00792
00793 void setFromXMLFile(const std::string& directory);
00794
00802 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00803
00804
00811 void setFromMIME(const std::string & mimeMsg);
00812
00816 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00817
00827 void toFile(std::string directory);
00828
00832 bool loadInProgress;
00833 void checkPresenceInMemory() {
00834 if (!presentInMemory && !loadInProgress) {
00835 loadInProgress = true;
00836 setFromFile(getContainer().getDirectory());
00837 presentInMemory = true;
00838 loadInProgress = false;
00839 }
00840 }
00849 void setFromFile(const std::string& directory);
00850
00851 };
00852
00853 }
00854
00855 #endif