TotalPowerTable.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 TotalPowerTable_CLASS
00035 #define TotalPowerTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <ArrayTime.h>
00045
00046
00047
00048 #include <Interval.h>
00049
00050
00051
00052 #include <Tag.h>
00053
00054
00055
00056 #include <Length.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 #include <ConversionException.h>
00089 #include <DuplicateKey.h>
00090 #include <UniquenessViolationException.h>
00091 #include <NoSuchRow.h>
00092 #include <DuplicateKey.h>
00093
00094
00095 #ifndef WITHOUT_ACS
00096 #include <asdmIDLC.h>
00097 #endif
00098
00099 #include <Representable.h>
00100
00101 #include <pthread.h>
00102
00103 namespace asdm {
00104
00105
00106
00107
00108 class ASDM;
00109 class TotalPowerRow;
00255 class TotalPowerTable : public Representable {
00256 friend class ASDM;
00257
00258 public:
00259
00260
00266 static const std::vector<std::string>& getKeyName();
00267
00268
00269 virtual ~TotalPowerTable();
00270
00276 ASDM &getContainer() const;
00277
00283 unsigned int size() const;
00284
00292 std::string getName() const;
00293
00301 static std::string name() ;
00302
00307 std::string getVersion() const ;
00308
00314 static const std::vector<std::string>& getAttributesNames();
00315
00321 static const std::vector<std::string>& defaultAttributesNamesInBin();
00322
00326 Entity getEntity() const;
00327
00332 void setEntity(Entity e);
00333
00341 std::string toXML() ;
00342
00343 #ifndef WITHOUT_ACS
00344
00350 asdmIDL::TotalPowerTableIDL *toIDL() ;
00351
00359 void toIDL(asdmIDL::TotalPowerTableIDL& x) const;
00360
00361 #endif
00362
00363 #ifndef WITHOUT_ACS
00364
00370 void fromIDL(asdmIDL::TotalPowerTableIDL x) ;
00371 #endif
00372
00373
00374
00375
00376
00381 TotalPowerRow *newRow();
00382
00383
00419 TotalPowerRow *newRow(ArrayTime time, Tag configDescriptionId, Tag fieldId, int scanNumber, int subscanNumber, int integrationNumber, vector<vector<Length > > uvw, vector<vector<Interval > > exposure, vector<vector<ArrayTime > > timeCentroid, vector<vector<vector<float > > > floatData, vector<int > flagAnt, vector<vector<int > > flagPol, Interval interval, vector<Tag> stateId, Tag execBlockId);
00420
00421
00422
00435 TotalPowerRow *newRow(TotalPowerRow *row);
00436
00437
00438
00439
00440
00441
00458 TotalPowerRow* add(TotalPowerRow* x) ;
00459
00460
00461
00462
00463
00464
00465
00466
00467
00473 std::vector<TotalPowerRow *> get() ;
00474
00481 const std::vector<TotalPowerRow *>& get() const ;
00482
00483
00494 std::vector <TotalPowerRow*> *getByContext(Tag configDescriptionId, Tag fieldId);
00495
00496
00497
00498
00499
00513 TotalPowerRow* getRowByKey(ArrayTime time, Tag configDescriptionId, Tag fieldId);
00514
00515
00516
00517
00518
00556 TotalPowerRow* lookup(ArrayTime time, Tag configDescriptionId, Tag fieldId, int scanNumber, int subscanNumber, int integrationNumber, vector<vector<Length > > uvw, vector<vector<Interval > > exposure, vector<vector<ArrayTime > > timeCentroid, vector<vector<vector<float > > > floatData, vector<int > flagAnt, vector<vector<int > > flagPol, Interval interval, vector<Tag> stateId, Tag execBlockId);
00557
00558
00559 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00560 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00561
00562 private:
00563
00572 TotalPowerTable (ASDM & container);
00573
00574 ASDM & container;
00575
00576 bool archiveAsBin;
00577 bool fileAsBin ;
00578
00579 std::string version ;
00580
00581 Entity entity;
00582
00583
00584
00592 TotalPowerRow* checkAndAdd(TotalPowerRow* x, bool skipCheckUniqueness=false) ;
00593
00599 void append(TotalPowerRow* x) ;
00600
00606 void addWithoutCheckingUnique(TotalPowerRow* x) ;
00607
00608
00609
00610
00611
00612
00620 TotalPowerRow * insertByTime(TotalPowerRow* x, std::vector<TotalPowerRow *>&row );
00621
00622
00623
00624
00625
00626
00627 std::vector<TotalPowerRow * > privateRows;
00628
00629
00630
00631
00632
00633
00634
00635
00636 typedef std::vector <TotalPowerRow* > TIME_ROWS;
00637 std::map<std::string, TIME_ROWS > context;
00638
00643 std::string Key(Tag configDescriptionId, Tag fieldId) ;
00644
00645
00646
00647
00653 void getByKeyNoAutoIncNoTime(std::vector <TotalPowerRow*>& vin, std::vector <TotalPowerRow*>& vout, Tag configDescriptionId, Tag fieldId);
00654
00655
00656
00657 void error() ;
00658
00659
00666 void fromXML(std::string& xmlDoc) ;
00667
00668 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00669
00674 void setFromMIMEFile(const std::string& directory);
00675
00676
00677
00678 void setFromXMLFile(const std::string& directory);
00679
00687 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00688
00689
00696 void setFromMIME(const std::string & mimeMsg);
00697
00701 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00702
00712 void toFile(std::string directory);
00713
00717 bool loadInProgress;
00718 void checkPresenceInMemory() {
00719 if (!presentInMemory && !loadInProgress) {
00720 loadInProgress = true;
00721 setFromFile(getContainer().getDirectory());
00722 presentInMemory = true;
00723 loadInProgress = false;
00724 }
00725 }
00734 void setFromFile(const std::string& directory);
00735
00736 };
00737
00738 }
00739
00740 #endif