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 DelayModelTable.h 00032 */ 00033 00034 #ifndef DelayModelTable_CLASS 00035 #define DelayModelTable_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 <Frequency.h> 00053 00054 00055 00056 #include <ArrayTimeInterval.h> 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 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 00103 00104 00105 #include "CPolarizationType.h" 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 00122 #include <ConversionException.h> 00123 #include <DuplicateKey.h> 00124 #include <UniquenessViolationException.h> 00125 #include <NoSuchRow.h> 00126 #include <DuplicateKey.h> 00127 00128 00129 #ifndef WITHOUT_ACS 00130 #include <asdmIDLC.h> 00131 #endif 00132 00133 #include <Representable.h> 00134 00135 #include <pthread.h> 00136 00137 namespace asdm { 00138 00139 //class asdm::ASDM; 00140 //class asdm::DelayModelRow; 00141 00142 class ASDM; 00143 class DelayModelRow; 00394 class DelayModelTable : public Representable { 00395 friend class ASDM; 00396 00397 public: 00398 00399 00405 static const std::vector<std::string>& getKeyName(); 00406 00407 00408 virtual ~DelayModelTable(); 00409 00415 ASDM &getContainer() const; 00416 00422 unsigned int size() const; 00423 00431 std::string getName() const; 00432 00440 static std::string name() ; 00441 00446 std::string getVersion() const ; 00447 00453 static const std::vector<std::string>& getAttributesNames(); 00454 00460 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00461 00465 Entity getEntity() const; 00466 00471 void setEntity(Entity e); 00472 00480 std::string toXML() ; 00481 00482 #ifndef WITHOUT_ACS 00483 // Conversion Methods 00489 asdmIDL::DelayModelTableIDL *toIDL() ; 00490 00498 void toIDL(asdmIDL::DelayModelTableIDL& x) const; 00499 00500 #endif 00501 00502 #ifndef WITHOUT_ACS 00503 00509 void fromIDL(asdmIDL::DelayModelTableIDL x) ; 00510 #endif 00511 00512 // 00513 // ====> Row creation. 00514 // 00515 00520 DelayModelRow *newRow(); 00521 00522 00546 DelayModelRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numPoly, vector<double > phaseDelay, vector<double > phaseDelayRate, vector<double > groupDelay, vector<double > groupDelayRate, Tag fieldId); 00547 00548 00549 00562 DelayModelRow *newRow(DelayModelRow *row); 00563 00564 // 00565 // ====> Append a row to its table. 00566 // 00567 00568 00585 DelayModelRow* add(DelayModelRow* x) ; 00586 00587 00588 00589 00590 00591 // 00592 // ====> Methods returning rows. 00593 // 00594 00600 std::vector<DelayModelRow *> get() ; 00601 00608 const std::vector<DelayModelRow *>& get() const ; 00609 00610 00621 std::vector <DelayModelRow*> *getByContext(Tag antennaId, Tag spectralWindowId); 00622 00623 00624 00625 00626 00640 DelayModelRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval); 00641 00642 00643 00644 00645 00671 DelayModelRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numPoly, vector<double > phaseDelay, vector<double > phaseDelayRate, vector<double > groupDelay, vector<double > groupDelayRate, Tag fieldId); 00672 00673 00674 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00675 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00676 00677 private: 00678 00687 DelayModelTable (ASDM & container); 00688 00689 ASDM & container; 00690 00691 bool archiveAsBin; // If true archive binary else archive XML 00692 bool fileAsBin ; // If true file binary else file XML 00693 00694 std::string version ; 00695 00696 Entity entity; 00697 00698 00699 00707 DelayModelRow* checkAndAdd(DelayModelRow* x, bool skipCheckUniqueness=false) ; 00708 00714 void append(DelayModelRow* x) ; 00715 00721 void addWithoutCheckingUnique(DelayModelRow* x) ; 00722 00723 00724 00725 00726 00727 00735 DelayModelRow * insertByStartTime(DelayModelRow* x, std::vector<DelayModelRow* >& row); 00736 00737 00738 00739 // A data structure to store the pointers on the table's rows. 00740 00741 // In all cases we maintain a private vector of DelayModelRow s. 00742 std::vector<DelayModelRow * > privateRows; 00743 00744 00745 00746 00747 00748 00749 00750 00751 typedef std::vector <DelayModelRow* > TIME_ROWS; 00752 std::map<std::string, TIME_ROWS > context; 00753 00758 std::string Key(Tag antennaId, Tag spectralWindowId) ; 00759 00760 00761 00762 00768 void getByKeyNoAutoIncNoTime(std::vector <DelayModelRow*>& vin, std::vector <DelayModelRow*>& vout, Tag antennaId, Tag spectralWindowId); 00769 00770 00771 00772 void error() ; //throw(ConversionException); 00773 00774 00781 void fromXML(std::string& xmlDoc) ; 00782 00783 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00784 00789 void setFromMIMEFile(const std::string& directory); 00790 /* 00791 void openMIMEFile(const std::string& directory); 00792 */ 00793 void setFromXMLFile(const std::string& directory); 00794 00802 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00803 00804 00811 void setFromMIME(const std::string & mimeMsg); 00812 00816 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00817 00827 void toFile(std::string directory); 00828 00832 bool loadInProgress; 00833 void checkPresenceInMemory() { 00834 if (!presentInMemory && !loadInProgress) { 00835 loadInProgress = true; 00836 setFromFile(getContainer().getDirectory()); 00837 presentInMemory = true; 00838 loadInProgress = false; 00839 } 00840 } 00849 void setFromFile(const std::string& directory); 00850 00851 }; 00852 00853 } // End namespace asdm 00854 00855 #endif /* DelayModelTable_CLASS */