CalGainTable.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 CalGainTable_CLASS
00035 #define CalGainTable_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
00066
00067
00068
00069
00070
00071
00072
00073
00074 #include <ConversionException.h>
00075 #include <DuplicateKey.h>
00076 #include <UniquenessViolationException.h>
00077 #include <NoSuchRow.h>
00078 #include <DuplicateKey.h>
00079
00080
00081 #ifndef WITHOUT_ACS
00082 #include <asdmIDLC.h>
00083 #endif
00084
00085 #include <Representable.h>
00086
00087 #include <pthread.h>
00088
00089 namespace asdm {
00090
00091
00092
00093
00094 class ASDM;
00095 class CalGainRow;
00201 class CalGainTable : public Representable {
00202 friend class ASDM;
00203
00204 public:
00205
00206
00212 static const std::vector<std::string>& getKeyName();
00213
00214
00215 virtual ~CalGainTable();
00216
00222 ASDM &getContainer() const;
00223
00229 unsigned int size() const;
00230
00238 std::string getName() const;
00239
00247 static std::string name() ;
00248
00253 std::string getVersion() const ;
00254
00260 static const std::vector<std::string>& getAttributesNames();
00261
00267 static const std::vector<std::string>& defaultAttributesNamesInBin();
00268
00272 Entity getEntity() const;
00273
00278 void setEntity(Entity e);
00279
00287 std::string toXML() ;
00288
00289 #ifndef WITHOUT_ACS
00290
00296 asdmIDL::CalGainTableIDL *toIDL() ;
00297
00305 void toIDL(asdmIDL::CalGainTableIDL& x) const;
00306
00307 #endif
00308
00309 #ifndef WITHOUT_ACS
00310
00316 void fromIDL(asdmIDL::CalGainTableIDL x) ;
00317 #endif
00318
00319
00320
00321
00322
00327 CalGainRow *newRow();
00328
00329
00357 CalGainRow *newRow(Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, float gain, bool gainValid, float fit, float fitWeight, bool totalGainValid, float totalFit, float totalFitWeight);
00358
00359
00360
00373 CalGainRow *newRow(CalGainRow *row);
00374
00375
00376
00377
00378
00379
00392 CalGainRow* add(CalGainRow* x) ;
00393
00394
00395
00396
00397
00398
00399
00400
00401
00407 std::vector<CalGainRow *> get() ;
00408
00415 const std::vector<CalGainRow *>& get() const ;
00416
00417
00418
00419
00420
00432 CalGainRow* getRowByKey(Tag calDataId, Tag calReductionId);
00433
00434
00435
00436
00437
00467 CalGainRow* lookup(Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, float gain, bool gainValid, float fit, float fitWeight, bool totalGainValid, float totalFit, float totalFitWeight);
00468
00469
00470 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00471 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00472
00473 private:
00474
00483 CalGainTable (ASDM & container);
00484
00485 ASDM & container;
00486
00487 bool archiveAsBin;
00488 bool fileAsBin ;
00489
00490 std::string version ;
00491
00492 Entity entity;
00493
00494
00495
00503 CalGainRow* checkAndAdd(CalGainRow* x, bool skipCheckUniqueness=false) ;
00504
00510 void append(CalGainRow* x) ;
00511
00517 void addWithoutCheckingUnique(CalGainRow* x) ;
00518
00519
00520
00521
00522
00523
00524
00525
00526 std::vector<CalGainRow * > privateRows;
00527
00528
00529
00530 std::vector<CalGainRow *> row;
00531
00532
00533 void error() ;
00534
00535
00542 void fromXML(std::string& xmlDoc) ;
00543
00544 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00545
00550 void setFromMIMEFile(const std::string& directory);
00551
00552
00553
00554 void setFromXMLFile(const std::string& directory);
00555
00563 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00564
00565
00572 void setFromMIME(const std::string & mimeMsg);
00573
00577 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00578
00588 void toFile(std::string directory);
00589
00593 bool loadInProgress;
00594 void checkPresenceInMemory() {
00595 if (!presentInMemory && !loadInProgress) {
00596 loadInProgress = true;
00597 setFromFile(getContainer().getDirectory());
00598 presentInMemory = true;
00599 loadInProgress = false;
00600 }
00601 }
00610 void setFromFile(const std::string& directory);
00611
00612 };
00613
00614 }
00615
00616 #endif