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 CalAppPhaseTable_CLASS
00035 #define CalAppPhaseTable_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
00053
00054
00055 #include "CBasebandName.h"
00056
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
00106
00107
00108
00109
00110 #include <ConversionException.h>
00111 #include <DuplicateKey.h>
00112 #include <UniquenessViolationException.h>
00113 #include <NoSuchRow.h>
00114 #include <DuplicateKey.h>
00115
00116
00117 #ifndef WITHOUT_ACS
00118 #include <asdmIDLC.h>
00119 #endif
00120
00121 #include <Representable.h>
00122
00123 #include <pthread.h>
00124
00125 namespace asdm {
00126
00127
00128
00129
00130 class ASDM;
00131 class CalAppPhaseRow;
00363 class CalAppPhaseTable : public Representable {
00364 friend class ASDM;
00365
00366 public:
00367
00368
00374 static const std::vector<std::string>& getKeyName();
00375
00376
00377 virtual ~CalAppPhaseTable();
00378
00384 ASDM &getContainer() const;
00385
00391 unsigned int size() const;
00392
00400 std::string getName() const;
00401
00409 static std::string name() ;
00410
00415 std::string getVersion() const ;
00416
00422 static const std::vector<std::string>& getAttributesNames();
00423
00429 static const std::vector<std::string>& defaultAttributesNamesInBin();
00430
00434 Entity getEntity() const;
00435
00440 void setEntity(Entity e);
00441
00449 std::string toXML() ;
00450
00451 #ifndef WITHOUT_ACS
00452
00458 asdmIDL::CalAppPhaseTableIDL *toIDL() ;
00459
00467 void toIDL(asdmIDL::CalAppPhaseTableIDL& x) const;
00468
00469 #endif
00470
00471 #ifndef WITHOUT_ACS
00472
00478 void fromIDL(asdmIDL::CalAppPhaseTableIDL x) ;
00479 #endif
00480
00481
00482
00483
00484
00489 CalAppPhaseRow *newRow();
00490
00491
00547 CalAppPhaseRow *newRow(BasebandNameMod::BasebandName basebandName, int scanNumber, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, ArrayTime adjustTime, string adjustToken, string phasingMode, int numPhasedAntennas, vector<string > phasedAntennas, int refAntennaIndex, int candRefAntennaIndex, string phasePacking, int numReceptors, int numChannels, int numPhaseValues, vector<float > phaseValues, int numCompare, int numEfficiencies, vector<string > compareArray, vector<int > efficiencyIndices, vector<vector<float > > efficiencies, vector<float > quality, string phasedSumAntenna);
00548
00549
00550
00563 CalAppPhaseRow *newRow(CalAppPhaseRow *row);
00564
00565
00566
00567
00568
00569
00582 CalAppPhaseRow* add(CalAppPhaseRow* x) ;
00583
00584
00585
00586
00587
00588
00589
00590
00591
00597 std::vector<CalAppPhaseRow *> get() ;
00598
00605 const std::vector<CalAppPhaseRow *>& get() const ;
00606
00607
00608
00609
00610
00626 CalAppPhaseRow* getRowByKey(BasebandNameMod::BasebandName basebandName, int scanNumber, Tag calDataId, Tag calReductionId);
00627
00628
00629
00630
00631
00689 CalAppPhaseRow* lookup(BasebandNameMod::BasebandName basebandName, int scanNumber, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, ArrayTime adjustTime, string adjustToken, string phasingMode, int numPhasedAntennas, vector<string > phasedAntennas, int refAntennaIndex, int candRefAntennaIndex, string phasePacking, int numReceptors, int numChannels, int numPhaseValues, vector<float > phaseValues, int numCompare, int numEfficiencies, vector<string > compareArray, vector<int > efficiencyIndices, vector<vector<float > > efficiencies, vector<float > quality, string phasedSumAntenna);
00690
00691
00692 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00693 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00694
00695 private:
00696
00705 CalAppPhaseTable (ASDM & container);
00706
00707 ASDM & container;
00708
00709 bool archiveAsBin;
00710 bool fileAsBin ;
00711
00712 std::string version ;
00713
00714 Entity entity;
00715
00716
00717
00725 CalAppPhaseRow* checkAndAdd(CalAppPhaseRow* x, bool skipCheckUniqueness=false) ;
00726
00732 void append(CalAppPhaseRow* x) ;
00733
00739 void addWithoutCheckingUnique(CalAppPhaseRow* x) ;
00740
00741
00742
00743
00744
00745
00746
00747
00748 std::vector<CalAppPhaseRow * > privateRows;
00749
00750
00751
00752 std::vector<CalAppPhaseRow *> row;
00753
00754
00755 void error() ;
00756
00757
00764 void fromXML(std::string& xmlDoc) ;
00765
00766 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00767
00772 void setFromMIMEFile(const std::string& directory);
00773
00774
00775
00776 void setFromXMLFile(const std::string& directory);
00777
00785 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00786
00787
00794 void setFromMIME(const std::string & mimeMsg);
00795
00799 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00800
00810 void toFile(std::string directory);
00811
00815 bool loadInProgress;
00816 void checkPresenceInMemory() {
00817 if (!presentInMemory && !loadInProgress) {
00818 loadInProgress = true;
00819 setFromFile(getContainer().getDirectory());
00820 presentInMemory = true;
00821 loadInProgress = false;
00822 }
00823 }
00832 void setFromFile(const std::string& directory);
00833
00834 };
00835
00836 }
00837
00838 #endif