CalWVRTable.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 CalWVRTable_CLASS
00035 #define CalWVRTable_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 #include <Temperature.h>
00057
00058
00059
00060 #include <Frequency.h>
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071 #include "CWVRMethod.h"
00072
00073
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
00099
00100
00101
00102 #include <ConversionException.h>
00103 #include <DuplicateKey.h>
00104 #include <UniquenessViolationException.h>
00105 #include <NoSuchRow.h>
00106 #include <DuplicateKey.h>
00107
00108
00109 #ifndef WITHOUT_ACS
00110 #include <asdmIDLC.h>
00111 #endif
00112
00113 #include <Representable.h>
00114
00115 #include <pthread.h>
00116
00117 namespace asdm {
00118
00119
00120
00121
00122 class ASDM;
00123 class CalWVRRow;
00280 class CalWVRTable : public Representable {
00281 friend class ASDM;
00282
00283 public:
00284
00285
00291 static const std::vector<std::string>& getKeyName();
00292
00293
00294 virtual ~CalWVRTable();
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::CalWVRTableIDL *toIDL() ;
00376
00384 void toIDL(asdmIDL::CalWVRTableIDL& x) const;
00385
00386 #endif
00387
00388 #ifndef WITHOUT_ACS
00389
00395 void fromIDL(asdmIDL::CalWVRTableIDL x) ;
00396 #endif
00397
00398
00399
00400
00401
00406 CalWVRRow *newRow();
00407
00408
00450 CalWVRRow *newRow(string antennaName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, WVRMethodMod::WVRMethod wvrMethod, int numInputAntennas, vector<string > inputAntennaNames, int numChan, vector<Frequency > chanFreq, vector<Frequency > chanWidth, vector<vector<Temperature > > refTemp, int numPoly, vector<vector<vector<float > > > pathCoeff, vector<Frequency > polyFreqLimits, vector<float > wetPath, vector<float > dryPath, Length water);
00451
00452
00453
00466 CalWVRRow *newRow(CalWVRRow *row);
00467
00468
00469
00470
00471
00472
00485 CalWVRRow* add(CalWVRRow* x) ;
00486
00487
00488
00489
00490
00491
00492
00493
00494
00500 std::vector<CalWVRRow *> get() ;
00501
00508 const std::vector<CalWVRRow *>& get() const ;
00509
00510
00511
00512
00513
00527 CalWVRRow* getRowByKey(string antennaName, Tag calDataId, Tag calReductionId);
00528
00529
00530
00531
00532
00576 CalWVRRow* lookup(string antennaName, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, WVRMethodMod::WVRMethod wvrMethod, int numInputAntennas, vector<string > inputAntennaNames, int numChan, vector<Frequency > chanFreq, vector<Frequency > chanWidth, vector<vector<Temperature > > refTemp, int numPoly, vector<vector<vector<float > > > pathCoeff, vector<Frequency > polyFreqLimits, vector<float > wetPath, vector<float > dryPath, Length water);
00577
00578
00579 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00580 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00581
00582 private:
00583
00592 CalWVRTable (ASDM & container);
00593
00594 ASDM & container;
00595
00596 bool archiveAsBin;
00597 bool fileAsBin ;
00598
00599 std::string version ;
00600
00601 Entity entity;
00602
00603
00604
00612 CalWVRRow* checkAndAdd(CalWVRRow* x, bool skipCheckUniqueness=false) ;
00613
00619 void append(CalWVRRow* x) ;
00620
00626 void addWithoutCheckingUnique(CalWVRRow* x) ;
00627
00628
00629
00630
00631
00632
00633
00634
00635 std::vector<CalWVRRow * > privateRows;
00636
00637
00638
00639 std::vector<CalWVRRow *> row;
00640
00641
00642 void error() ;
00643
00644
00651 void fromXML(std::string& xmlDoc) ;
00652
00653 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00654
00659 void setFromMIMEFile(const std::string& directory);
00660
00661
00662
00663 void setFromXMLFile(const std::string& directory);
00664
00672 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00673
00674
00681 void setFromMIME(const std::string & mimeMsg);
00682
00686 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00687
00697 void toFile(std::string directory);
00698
00702 bool loadInProgress;
00703 void checkPresenceInMemory() {
00704 if (!presentInMemory && !loadInProgress) {
00705 loadInProgress = true;
00706 setFromFile(getContainer().getDirectory());
00707 presentInMemory = true;
00708 loadInProgress = false;
00709 }
00710 }
00719 void setFromFile(const std::string& directory);
00720
00721 };
00722
00723 }
00724
00725 #endif