CalFluxTable.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 CalFluxTable_CLASS
00035 #define CalFluxTable_CLASS
00036
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040
00041
00042
00043
00044 #include <ArrayTime.h>
00045
00046
00047
00048 #include <Angle.h>
00049
00050
00051
00052 #include <Tag.h>
00053
00054
00055
00056 #include <Frequency.h>
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075 #include "CFluxCalibrationMethod.h"
00076
00077
00078
00079
00080
00081
00082
00083 #include "CStokesParameter.h"
00084
00085
00086
00087
00088
00089 #include "CDirectionReferenceCode.h"
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103 #include "CSourceModel.h"
00104
00105
00106
00107
00108 #include <ConversionException.h>
00109 #include <DuplicateKey.h>
00110 #include <UniquenessViolationException.h>
00111 #include <NoSuchRow.h>
00112 #include <DuplicateKey.h>
00113
00114
00115 #ifndef WITHOUT_ACS
00116 #include <asdmIDLC.h>
00117 #endif
00118
00119 #include <Representable.h>
00120
00121 #include <pthread.h>
00122
00123 namespace asdm {
00124
00125
00126
00127
00128 class ASDM;
00129 class CalFluxRow;
00303 class CalFluxTable : public Representable {
00304 friend class ASDM;
00305
00306 public:
00307
00308
00314 static const std::vector<std::string>& getKeyName();
00315
00316
00317 virtual ~CalFluxTable();
00318
00324 ASDM &getContainer() const;
00325
00331 unsigned int size() const;
00332
00340 std::string getName() const;
00341
00349 static std::string name() ;
00350
00355 std::string getVersion() const ;
00356
00362 static const std::vector<std::string>& getAttributesNames();
00363
00369 static const std::vector<std::string>& defaultAttributesNamesInBin();
00370
00374 Entity getEntity() const;
00375
00380 void setEntity(Entity e);
00381
00389 std::string toXML() ;
00390
00391 #ifndef WITHOUT_ACS
00392
00398 asdmIDL::CalFluxTableIDL *toIDL() ;
00399
00407 void toIDL(asdmIDL::CalFluxTableIDL& x) const;
00408
00409 #endif
00410
00411 #ifndef WITHOUT_ACS
00412
00418 void fromIDL(asdmIDL::CalFluxTableIDL x) ;
00419 #endif
00420
00421
00422
00423
00424
00429 CalFluxRow *newRow();
00430
00431
00461 CalFluxRow *newRow(string sourceName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numFrequencyRanges, int numStokes, vector<vector<Frequency > > frequencyRanges, FluxCalibrationMethodMod::FluxCalibrationMethod fluxMethod, vector<vector<double > > flux, vector<vector<double > > fluxError, vector<StokesParameterMod::StokesParameter > stokes);
00462
00463
00464
00477 CalFluxRow *newRow(CalFluxRow *row);
00478
00479
00480
00481
00482
00483
00496 CalFluxRow* add(CalFluxRow* x) ;
00497
00498
00499
00500
00501
00502
00503
00504
00505
00511 std::vector<CalFluxRow *> get() ;
00512
00519 const std::vector<CalFluxRow *>& get() const ;
00520
00521
00522
00523
00524
00538 CalFluxRow* getRowByKey(string sourceName, Tag calDataId, Tag calReductionId);
00539
00540
00541
00542
00543
00575 CalFluxRow* lookup(string sourceName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, int numFrequencyRanges, int numStokes, vector<vector<Frequency > > frequencyRanges, FluxCalibrationMethodMod::FluxCalibrationMethod fluxMethod, vector<vector<double > > flux, vector<vector<double > > fluxError, vector<StokesParameterMod::StokesParameter > stokes);
00576
00577
00578 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00579 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00580
00581 private:
00582
00591 CalFluxTable (ASDM & container);
00592
00593 ASDM & container;
00594
00595 bool archiveAsBin;
00596 bool fileAsBin ;
00597
00598 std::string version ;
00599
00600 Entity entity;
00601
00602
00603
00611 CalFluxRow* checkAndAdd(CalFluxRow* x, bool skipCheckUniqueness=false) ;
00612
00618 void append(CalFluxRow* x) ;
00619
00625 void addWithoutCheckingUnique(CalFluxRow* x) ;
00626
00627
00628
00629
00630
00631
00632
00633
00634 std::vector<CalFluxRow * > privateRows;
00635
00636
00637
00638 std::vector<CalFluxRow *> row;
00639
00640
00641 void error() ;
00642
00643
00650 void fromXML(std::string& xmlDoc) ;
00651
00652 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00653
00658 void setFromMIMEFile(const std::string& directory);
00659
00660
00661
00662 void setFromXMLFile(const std::string& directory);
00663
00671 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00672
00673
00680 void setFromMIME(const std::string & mimeMsg);
00681
00685 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00686
00696 void toFile(std::string directory);
00697
00701 bool loadInProgress;
00702 void checkPresenceInMemory() {
00703 if (!presentInMemory && !loadInProgress) {
00704 loadInProgress = true;
00705 setFromFile(getContainer().getDirectory());
00706 presentInMemory = true;
00707 loadInProgress = false;
00708 }
00709 }
00718 void setFromFile(const std::string& directory);
00719
00720 };
00721
00722 }
00723
00724 #endif