casa
$Rev:20696$
|
00001 00002 /* 00003 * ALMA - Atacama Large Millimeter Array 00004 * (c) European Southern Observatory, 2002 00005 * (c) Associated Universities Inc., 2002 00006 * Copyright by ESO (in the framework of the ALMA collaboration), 00007 * Copyright by AUI (in the framework of the ALMA collaboration), 00008 * All rights reserved. 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Lesser General Public 00012 * License as published by the Free software Foundation; either 00013 * version 2.1 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY, without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Lesser General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Lesser General Public 00021 * License along with this library; if not, write to the Free Software 00022 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, 00023 * MA 02111-1307 USA 00024 * 00025 * Warning! 00026 * -------------------------------------------------------------------- 00027 * | This is generated code! Do not modify this file. | 00028 * | If you do, all changes will be lost when the file is re-generated. | 00029 * -------------------------------------------------------------------- 00030 * 00031 * File CalWVRTable.h 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 //class asdm::ASDM; 00120 //class asdm::CalWVRRow; 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 // Conversion Methods 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 // ====> Row creation. 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 // ====> Append a row to its table. 00470 // 00471 00472 00485 CalWVRRow* add(CalWVRRow* x) ; 00486 00487 00488 00489 00490 00491 // 00492 // ====> Methods returning rows. 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; // If true archive binary else archive XML 00597 bool fileAsBin ; // If true file binary else file XML 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 // A data structure to store the pointers on the table's rows. 00633 00634 // In all cases we maintain a private vector of CalWVRRow s. 00635 std::vector<CalWVRRow * > privateRows; 00636 00637 00638 00639 std::vector<CalWVRRow *> row; 00640 00641 00642 void error() ; //throw(ConversionException); 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 void openMIMEFile(const std::string& directory); 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 } // End namespace asdm 00724 00725 #endif /* CalWVRTable_CLASS */