CalReductionTable.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 CalReductionTable_CLASS
00035 #define CalReductionTable_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 #include "CInvalidatingCondition.h"
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 #include <ConversionException.h>
00081 #include <DuplicateKey.h>
00082 #include <UniquenessViolationException.h>
00083 #include <NoSuchRow.h>
00084 #include <DuplicateKey.h>
00085
00086
00087 #ifndef WITHOUT_ACS
00088 #include <asdmIDLC.h>
00089 #endif
00090
00091 #include <Representable.h>
00092
00093 #include <pthread.h>
00094
00095 namespace asdm {
00096
00097
00098
00099
00100 class ASDM;
00101 class CalReductionRow;
00205 class CalReductionTable : public Representable {
00206 friend class ASDM;
00207
00208 public:
00209
00210
00216 static const std::vector<std::string>& getKeyName();
00217
00218
00219 virtual ~CalReductionTable();
00220
00226 ASDM &getContainer() const;
00227
00233 unsigned int size() const;
00234
00242 std::string getName() const;
00243
00251 static std::string name() ;
00252
00257 std::string getVersion() const ;
00258
00264 static const std::vector<std::string>& getAttributesNames();
00265
00271 static const std::vector<std::string>& defaultAttributesNamesInBin();
00272
00276 Entity getEntity() const;
00277
00282 void setEntity(Entity e);
00283
00291 std::string toXML() ;
00292
00293 #ifndef WITHOUT_ACS
00294
00300 asdmIDL::CalReductionTableIDL *toIDL() ;
00301
00309 void toIDL(asdmIDL::CalReductionTableIDL& x) const;
00310
00311 #endif
00312
00313 #ifndef WITHOUT_ACS
00314
00320 void fromIDL(asdmIDL::CalReductionTableIDL x) ;
00321 #endif
00322
00323
00324
00325
00326
00331 CalReductionRow *newRow();
00332
00333
00359 CalReductionRow *newRow(int numApplied, vector<string > appliedCalibrations, int numParam, vector<string > paramSet, int numInvalidConditions, vector<InvalidatingConditionMod::InvalidatingCondition > invalidConditions, ArrayTime timeReduced, string messages, string software, string softwareVersion);
00360
00361
00362
00375 CalReductionRow *newRow(CalReductionRow *row);
00376
00377
00378
00379
00380
00381
00382
00383
00393 CalReductionRow* add(CalReductionRow* x) ;
00394
00395
00396
00397
00398
00399
00400
00406 std::vector<CalReductionRow *> get() ;
00407
00414 const std::vector<CalReductionRow *>& get() const ;
00415
00416
00417
00418
00419
00429 CalReductionRow* getRowByKey(Tag calReductionId);
00430
00431
00432
00433
00434
00462 CalReductionRow* lookup(int numApplied, vector<string > appliedCalibrations, int numParam, vector<string > paramSet, int numInvalidConditions, vector<InvalidatingConditionMod::InvalidatingCondition > invalidConditions, ArrayTime timeReduced, string messages, string software, string softwareVersion);
00463
00464
00465 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00466 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00467
00468 private:
00469
00478 CalReductionTable (ASDM & container);
00479
00480 ASDM & container;
00481
00482 bool archiveAsBin;
00483 bool fileAsBin ;
00484
00485 std::string version ;
00486
00487 Entity entity;
00488
00489
00490
00491 std::map<std::string,int> noAutoIncIds;
00492 void autoIncrement(std::string key, CalReductionRow* x);
00493
00494
00504 CalReductionRow* checkAndAdd(CalReductionRow* x, bool skipCheckUniqueness=false) ;
00505
00511 void append(CalReductionRow* x) ;
00512
00518 void addWithoutCheckingUnique(CalReductionRow* x) ;
00519
00520
00521
00522
00523
00524
00525
00526
00527 std::vector<CalReductionRow * > privateRows;
00528
00529
00530
00531 std::vector<CalReductionRow *> row;
00532
00533
00534 void error() ;
00535
00536
00543 void fromXML(std::string& xmlDoc) ;
00544
00545 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00546
00551 void setFromMIMEFile(const std::string& directory);
00552
00553
00554
00555 void setFromXMLFile(const std::string& directory);
00556
00564 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00565
00566
00573 void setFromMIME(const std::string & mimeMsg);
00574
00578 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00579
00589 void toFile(std::string directory);
00590
00594 bool loadInProgress;
00595 void checkPresenceInMemory() {
00596 if (!presentInMemory && !loadInProgress) {
00597 loadInProgress = true;
00598 setFromFile(getContainer().getDirectory());
00599 presentInMemory = true;
00600 loadInProgress = false;
00601 }
00602 }
00611 void setFromFile(const std::string& directory);
00612
00613 };
00614
00615 }
00616
00617 #endif