CalFocusModelTable.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 CalFocusModelTable_CLASS
00035 #define CalFocusModelTable_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 #include <Length.h>
00053
00054
00055
00056
00057
00058
00059
00060
00061 #include "CReceiverBand.h"
00062
00063
00064
00065 #include "CPolarizationType.h"
00066
00067
00068
00069
00070
00071
00072
00073 #include "CAntennaMake.h"
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098 #include <ConversionException.h>
00099 #include <DuplicateKey.h>
00100 #include <UniquenessViolationException.h>
00101 #include <NoSuchRow.h>
00102 #include <DuplicateKey.h>
00103
00104
00105 #ifndef WITHOUT_ACS
00106 #include <asdmIDLC.h>
00107 #endif
00108
00109 #include <Representable.h>
00110
00111 #include <pthread.h>
00112
00113 namespace asdm {
00114
00115
00116
00117
00118 class ASDM;
00119 class CalFocusModelRow;
00280 class CalFocusModelTable : public Representable {
00281 friend class ASDM;
00282
00283 public:
00284
00285
00291 static const std::vector<std::string>& getKeyName();
00292
00293
00294 virtual ~CalFocusModelTable();
00295
00301 ASDM &getContainer() const;
00302
00308 unsigned int size() const;
00309
00317 std::string getName() const;
00318
00326 static std::string name() ;
00327
00332 std::string getVersion() const ;
00333
00339 static const std::vector<std::string>& getAttributesNames();
00340
00346 static const std::vector<std::string>& defaultAttributesNamesInBin();
00347
00351 Entity getEntity() const;
00352
00357 void setEntity(Entity e);
00358
00366 std::string toXML() ;
00367
00368 #ifndef WITHOUT_ACS
00369
00375 asdmIDL::CalFocusModelTableIDL *toIDL() ;
00376
00384 void toIDL(asdmIDL::CalFocusModelTableIDL& x) const;
00385
00386 #endif
00387
00388 #ifndef WITHOUT_ACS
00389
00395 void fromIDL(asdmIDL::CalFocusModelTableIDL x) ;
00396 #endif
00397
00398
00399
00400
00401
00406 CalFocusModelRow *newRow();
00407
00408
00450 CalFocusModelRow *newRow(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, PolarizationTypeMod::PolarizationType polarizationType, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, int numCoeff, int numSourceObs, vector<string > coeffName, vector<string > coeffFormula, vector<float > coeffValue, vector<float > coeffError, vector<bool > coeffFixed, string focusModel, vector<Length > focusRMS, double reducedChiSquared);
00451
00452
00453
00466 CalFocusModelRow *newRow(CalFocusModelRow *row);
00467
00468
00469
00470
00471
00472
00485 CalFocusModelRow* add(CalFocusModelRow* x) ;
00486
00487
00488
00489
00490
00491
00492
00493
00494
00500 std::vector<CalFocusModelRow *> get() ;
00501
00508 const std::vector<CalFocusModelRow *>& get() const ;
00509
00510
00511
00512
00513
00531 CalFocusModelRow* getRowByKey(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, PolarizationTypeMod::PolarizationType polarizationType, Tag calDataId, Tag calReductionId);
00532
00533
00534
00535
00536
00580 CalFocusModelRow* lookup(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, PolarizationTypeMod::PolarizationType polarizationType, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, int numCoeff, int numSourceObs, vector<string > coeffName, vector<string > coeffFormula, vector<float > coeffValue, vector<float > coeffError, vector<bool > coeffFixed, string focusModel, vector<Length > focusRMS, double reducedChiSquared);
00581
00582
00583 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00584 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00585
00586 private:
00587
00596 CalFocusModelTable (ASDM & container);
00597
00598 ASDM & container;
00599
00600 bool archiveAsBin;
00601 bool fileAsBin ;
00602
00603 std::string version ;
00604
00605 Entity entity;
00606
00607
00608
00616 CalFocusModelRow* checkAndAdd(CalFocusModelRow* x, bool skipCheckUniqueness=false) ;
00617
00623 void append(CalFocusModelRow* x) ;
00624
00630 void addWithoutCheckingUnique(CalFocusModelRow* x) ;
00631
00632
00633
00634
00635
00636
00637
00638
00639 std::vector<CalFocusModelRow * > privateRows;
00640
00641
00642
00643 std::vector<CalFocusModelRow *> row;
00644
00645
00646 void error() ;
00647
00648
00655 void fromXML(std::string& xmlDoc) ;
00656
00657 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00658
00663 void setFromMIMEFile(const std::string& directory);
00664
00665
00666
00667 void setFromXMLFile(const std::string& directory);
00668
00676 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00677
00678
00685 void setFromMIME(const std::string & mimeMsg);
00686
00690 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00691
00701 void toFile(std::string directory);
00702
00706 bool loadInProgress;
00707 void checkPresenceInMemory() {
00708 if (!presentInMemory && !loadInProgress) {
00709 loadInProgress = true;
00710 setFromFile(getContainer().getDirectory());
00711 presentInMemory = true;
00712 loadInProgress = false;
00713 }
00714 }
00723 void setFromFile(const std::string& directory);
00724
00725 };
00726
00727 }
00728
00729 #endif