ExecBlockTable.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 ExecBlockTable_CLASS
00035 #define ExecBlockTable_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 #include <EntityRef.h>
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
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120 #include <ConversionException.h>
00121 #include <DuplicateKey.h>
00122 #include <UniquenessViolationException.h>
00123 #include <NoSuchRow.h>
00124 #include <DuplicateKey.h>
00125
00126
00127 #ifndef WITHOUT_ACS
00128 #include <asdmIDLC.h>
00129 #endif
00130
00131 #include <Representable.h>
00132
00133 #include <pthread.h>
00134
00135 namespace asdm {
00136
00137
00138
00139
00140 class ASDM;
00141 class ExecBlockRow;
00374 class ExecBlockTable : public Representable {
00375 friend class ASDM;
00376
00377 public:
00378
00379
00385 static const std::vector<std::string>& getKeyName();
00386
00387
00388 virtual ~ExecBlockTable();
00389
00395 ASDM &getContainer() const;
00396
00402 unsigned int size() const;
00403
00411 std::string getName() const;
00412
00420 static std::string name() ;
00421
00426 std::string getVersion() const ;
00427
00433 static const std::vector<std::string>& getAttributesNames();
00434
00440 static const std::vector<std::string>& defaultAttributesNamesInBin();
00441
00445 Entity getEntity() const;
00446
00451 void setEntity(Entity e);
00452
00460 std::string toXML() ;
00461
00462 #ifndef WITHOUT_ACS
00463
00469 asdmIDL::ExecBlockTableIDL *toIDL() ;
00470
00478 void toIDL(asdmIDL::ExecBlockTableIDL& x) const;
00479
00480 #endif
00481
00482 #ifndef WITHOUT_ACS
00483
00489 void fromIDL(asdmIDL::ExecBlockTableIDL x) ;
00490 #endif
00491
00492
00493
00494
00495
00500 ExecBlockRow *newRow();
00501
00502
00548 ExecBlockRow *newRow(ArrayTime startTime, ArrayTime endTime, int execBlockNum, EntityRef execBlockUID, EntityRef projectUID, string configName, string telescopeName, string observerName, int numObservingLog, vector<string > observingLog, EntityRef sessionReference, Length baseRangeMin, Length baseRangeMax, Length baseRmsMinor, Length baseRmsMajor, Angle basePa, bool aborted, int numAntenna, vector<Tag> antennaId, Tag sBSummaryId);
00549
00550
00551
00564 ExecBlockRow *newRow(ExecBlockRow *row);
00565
00566
00567
00568
00569
00570
00571
00572
00582 ExecBlockRow* add(ExecBlockRow* x) ;
00583
00584
00585
00586
00587
00588
00589
00595 std::vector<ExecBlockRow *> get() ;
00596
00603 const std::vector<ExecBlockRow *>& get() const ;
00604
00605
00606
00607
00608
00618 ExecBlockRow* getRowByKey(Tag execBlockId);
00619
00620
00621
00622
00623
00671 ExecBlockRow* lookup(ArrayTime startTime, ArrayTime endTime, int execBlockNum, EntityRef execBlockUID, EntityRef projectUID, string configName, string telescopeName, string observerName, int numObservingLog, vector<string > observingLog, EntityRef sessionReference, Length baseRangeMin, Length baseRangeMax, Length baseRmsMinor, Length baseRmsMajor, Angle basePa, bool aborted, int numAntenna, vector<Tag> antennaId, Tag sBSummaryId);
00672
00673
00674 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00675 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00676
00677 private:
00678
00687 ExecBlockTable (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
00700 std::map<std::string,int> noAutoIncIds;
00701 void autoIncrement(std::string key, ExecBlockRow* x);
00702
00703
00713 ExecBlockRow* checkAndAdd(ExecBlockRow* x, bool skipCheckUniqueness=false) ;
00714
00720 void append(ExecBlockRow* x) ;
00721
00727 void addWithoutCheckingUnique(ExecBlockRow* x) ;
00728
00729
00730
00731
00732
00733
00734
00735
00736 std::vector<ExecBlockRow * > privateRows;
00737
00738
00739
00740 std::vector<ExecBlockRow *> row;
00741
00742
00743 void error() ;
00744
00745
00752 void fromXML(std::string& xmlDoc) ;
00753
00754 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00755
00760 void setFromMIMEFile(const std::string& directory);
00761
00762
00763
00764 void setFromXMLFile(const std::string& directory);
00765
00773 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00774
00775
00782 void setFromMIME(const std::string & mimeMsg);
00783
00787 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00788
00798 void toFile(std::string directory);
00799
00803 bool loadInProgress;
00804 void checkPresenceInMemory() {
00805 if (!presentInMemory && !loadInProgress) {
00806 loadInProgress = true;
00807 setFromFile(getContainer().getDirectory());
00808 presentInMemory = true;
00809 loadInProgress = false;
00810 }
00811 }
00820 void setFromFile(const std::string& directory);
00821
00822 };
00823
00824 }
00825
00826 #endif