GainTrackingTable.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 GainTrackingTable_CLASS
00035 #define GainTrackingTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <Tag.h>
00045
00046
00047
00048 #include <ArrayTimeInterval.h>
00049
00050
00051
00052 #include <ComplexWrapper.h>
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 #include "CPolarizationType.h"
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078 #include <ConversionException.h>
00079 #include <DuplicateKey.h>
00080 #include <UniquenessViolationException.h>
00081 #include <NoSuchRow.h>
00082 #include <DuplicateKey.h>
00083
00084
00085 #ifndef WITHOUT_ACS
00086 #include <asdmIDLC.h>
00087 #endif
00088
00089 #include <Representable.h>
00090
00091 #include <pthread.h>
00092
00093 namespace asdm {
00094
00095
00096
00097
00098 class ASDM;
00099 class GainTrackingRow;
00212 class GainTrackingTable : public Representable {
00213 friend class ASDM;
00214
00215 public:
00216
00217
00223 static const std::vector<std::string>& getKeyName();
00224
00225
00226 virtual ~GainTrackingTable();
00227
00233 ASDM &getContainer() const;
00234
00240 unsigned int size() const;
00241
00249 std::string getName() const;
00250
00258 static std::string name() ;
00259
00264 std::string getVersion() const ;
00265
00271 static const std::vector<std::string>& getAttributesNames();
00272
00278 static const std::vector<std::string>& defaultAttributesNamesInBin();
00279
00283 Entity getEntity() const;
00284
00289 void setEntity(Entity e);
00290
00298 std::string toXML() ;
00299
00300 #ifndef WITHOUT_ACS
00301
00307 asdmIDL::GainTrackingTableIDL *toIDL() ;
00308
00316 void toIDL(asdmIDL::GainTrackingTableIDL& x) const;
00317
00318 #endif
00319
00320 #ifndef WITHOUT_ACS
00321
00327 void fromIDL(asdmIDL::GainTrackingTableIDL x) ;
00328 #endif
00329
00330
00331
00332
00333
00338 GainTrackingRow *newRow();
00339
00340
00360 GainTrackingRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numReceptor, vector<float > attenuator, vector<PolarizationTypeMod::PolarizationType > polarizationType);
00361
00362
00363
00376 GainTrackingRow *newRow(GainTrackingRow *row);
00377
00378
00379
00380
00381
00382
00399 GainTrackingRow* add(GainTrackingRow* x) ;
00400
00401
00402
00403
00404
00405
00406
00407
00408
00414 std::vector<GainTrackingRow *> get() ;
00415
00422 const std::vector<GainTrackingRow *>& get() const ;
00423
00424
00435 std::vector <GainTrackingRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId);
00436
00437
00438
00439
00440
00456 GainTrackingRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId);
00457
00458
00459
00460
00461
00483 GainTrackingRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numReceptor, vector<float > attenuator, vector<PolarizationTypeMod::PolarizationType > polarizationType);
00484
00485
00486 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00487 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00488
00489 private:
00490
00499 GainTrackingTable (ASDM & container);
00500
00501 ASDM & container;
00502
00503 bool archiveAsBin;
00504 bool fileAsBin ;
00505
00506 std::string version ;
00507
00508 Entity entity;
00509
00510
00511
00519 GainTrackingRow* checkAndAdd(GainTrackingRow* x, bool skipCheckUniqueness=false) ;
00520
00526 void append(GainTrackingRow* x) ;
00527
00533 void addWithoutCheckingUnique(GainTrackingRow* x) ;
00534
00535
00536
00537
00538
00539
00547 GainTrackingRow * insertByStartTime(GainTrackingRow* x, std::vector<GainTrackingRow* >& row);
00548
00549
00550
00551
00552
00553
00554 std::vector<GainTrackingRow * > privateRows;
00555
00556
00557
00558
00559
00560
00561
00562
00563 typedef std::vector <GainTrackingRow* > TIME_ROWS;
00564 std::map<std::string, TIME_ROWS > context;
00565
00570 std::string Key(Tag antennaId, Tag spectralWindowId, int feedId) ;
00571
00572
00573
00574
00580 void getByKeyNoAutoIncNoTime(std::vector <GainTrackingRow*>& vin, std::vector <GainTrackingRow*>& vout, Tag antennaId, Tag spectralWindowId, int feedId);
00581
00582
00583
00584 void error() ;
00585
00586
00593 void fromXML(std::string& xmlDoc) ;
00594
00595 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00596
00601 void setFromMIMEFile(const std::string& directory);
00602
00603
00604
00605 void setFromXMLFile(const std::string& directory);
00606
00614 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00615
00616
00623 void setFromMIME(const std::string & mimeMsg);
00624
00628 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00629
00639 void toFile(std::string directory);
00640
00644 bool loadInProgress;
00645 void checkPresenceInMemory() {
00646 if (!presentInMemory && !loadInProgress) {
00647 loadInProgress = true;
00648 setFromFile(getContainer().getDirectory());
00649 presentInMemory = true;
00650 loadInProgress = false;
00651 }
00652 }
00661 void setFromFile(const std::string& directory);
00662
00663 };
00664
00665 }
00666
00667 #endif