ScanTable.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 ScanTable_CLASS
00035 #define ScanTable_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
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 #include "CScanIntent.h"
00066
00067
00068
00069 #include "CCalDataOrigin.h"
00070
00071
00072
00073
00074
00075 #include "CCalibrationFunction.h"
00076
00077
00078
00079 #include "CCalibrationSet.h"
00080
00081
00082
00083 #include "CAntennaMotionPattern.h"
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 #include <ConversionException.h>
00095 #include <DuplicateKey.h>
00096 #include <UniquenessViolationException.h>
00097 #include <NoSuchRow.h>
00098 #include <DuplicateKey.h>
00099
00100
00101 #ifndef WITHOUT_ACS
00102 #include <asdmIDLC.h>
00103 #endif
00104
00105 #include <Representable.h>
00106
00107 #include <pthread.h>
00108
00109 namespace asdm {
00110
00111
00112
00113
00114 class ASDM;
00115 class ScanRow;
00252 class ScanTable : public Representable {
00253 friend class ASDM;
00254
00255 public:
00256
00257
00263 static const std::vector<std::string>& getKeyName();
00264
00265
00266 virtual ~ScanTable();
00267
00273 ASDM &getContainer() const;
00274
00280 unsigned int size() const;
00281
00289 std::string getName() const;
00290
00298 static std::string name() ;
00299
00304 std::string getVersion() const ;
00305
00311 static const std::vector<std::string>& getAttributesNames();
00312
00318 static const std::vector<std::string>& defaultAttributesNamesInBin();
00319
00323 Entity getEntity() const;
00324
00329 void setEntity(Entity e);
00330
00338 std::string toXML() ;
00339
00340 #ifndef WITHOUT_ACS
00341
00347 asdmIDL::ScanTableIDL *toIDL() ;
00348
00356 void toIDL(asdmIDL::ScanTableIDL& x) const;
00357
00358 #endif
00359
00360 #ifndef WITHOUT_ACS
00361
00367 void fromIDL(asdmIDL::ScanTableIDL x) ;
00368 #endif
00369
00370
00371
00372
00373
00378 ScanRow *newRow();
00379
00380
00404 ScanRow *newRow(Tag execBlockId, int scanNumber, ArrayTime startTime, ArrayTime endTime, int numIntent, int numSubscan, vector<ScanIntentMod::ScanIntent > scanIntent, vector<CalDataOriginMod::CalDataOrigin > calDataType, vector<bool > calibrationOnLine);
00405
00406
00407
00420 ScanRow *newRow(ScanRow *row);
00421
00422
00423
00424
00425
00426
00439 ScanRow* add(ScanRow* x) ;
00440
00441
00442
00443
00444
00445
00446
00447
00448
00454 std::vector<ScanRow *> get() ;
00455
00462 const std::vector<ScanRow *>& get() const ;
00463
00464
00465
00466
00467
00479 ScanRow* getRowByKey(Tag execBlockId, int scanNumber);
00480
00481
00482
00483
00484
00510 ScanRow* lookup(Tag execBlockId, int scanNumber, ArrayTime startTime, ArrayTime endTime, int numIntent, int numSubscan, vector<ScanIntentMod::ScanIntent > scanIntent, vector<CalDataOriginMod::CalDataOrigin > calDataType, vector<bool > calibrationOnLine);
00511
00512
00513 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00514 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00515
00516 private:
00517
00526 ScanTable (ASDM & container);
00527
00528 ASDM & container;
00529
00530 bool archiveAsBin;
00531 bool fileAsBin ;
00532
00533 std::string version ;
00534
00535 Entity entity;
00536
00537
00538
00546 ScanRow* checkAndAdd(ScanRow* x, bool skipCheckUniqueness=false) ;
00547
00553 void append(ScanRow* x) ;
00554
00560 void addWithoutCheckingUnique(ScanRow* x) ;
00561
00562
00563
00564
00565
00566
00567
00568
00569 std::vector<ScanRow * > privateRows;
00570
00571
00572
00573 std::vector<ScanRow *> row;
00574
00575
00576 void error() ;
00577
00578
00585 void fromXML(std::string& xmlDoc) ;
00586
00587 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00588
00593 void setFromMIMEFile(const std::string& directory);
00594
00595
00596
00597 void setFromXMLFile(const std::string& directory);
00598
00606 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00607
00608
00615 void setFromMIME(const std::string & mimeMsg);
00616
00620 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00621
00631 void toFile(std::string directory);
00632
00636 bool loadInProgress;
00637 void checkPresenceInMemory() {
00638 if (!presentInMemory && !loadInProgress) {
00639 loadInProgress = true;
00640 setFromFile(getContainer().getDirectory());
00641 presentInMemory = true;
00642 loadInProgress = false;
00643 }
00644 }
00653 void setFromFile(const std::string& directory);
00654
00655 };
00656
00657 }
00658
00659 #endif