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 SpectralWindowTable.h 00032 */ 00033 00034 #ifndef SpectralWindowTable_CLASS 00035 #define SpectralWindowTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 00041 00042 00043 00044 #include <Tag.h> 00045 00046 00047 00048 #include <Frequency.h> 00049 00050 00051 00052 00053 00054 00055 00056 00057 #include "CBasebandName.h" 00058 00059 00060 00061 #include "CNetSideband.h" 00062 00063 00064 00065 00066 00067 00068 00069 #include "CSidebandProcessingMode.h" 00070 00071 00072 00073 00074 00075 #include "CWindowFunction.h" 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 #include "CCorrelationBit.h" 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 00103 #include "CFrequencyReferenceCode.h" 00104 00105 00106 00107 00108 00109 00110 00111 00112 00113 00114 00115 00116 00117 00118 00119 00120 00121 #include "CSpectralResolutionType.h" 00122 00123 00124 00125 00126 #include <ConversionException.h> 00127 #include <DuplicateKey.h> 00128 #include <UniquenessViolationException.h> 00129 #include <NoSuchRow.h> 00130 #include <DuplicateKey.h> 00131 00132 00133 #ifndef WITHOUT_ACS 00134 #include <asdmIDLC.h> 00135 #endif 00136 00137 #include <Representable.h> 00138 00139 #include <pthread.h> 00140 00141 namespace asdm { 00142 00143 //class asdm::ASDM; 00144 //class asdm::SpectralWindowRow; 00145 00146 class ASDM; 00147 class SpectralWindowRow; 00394 class SpectralWindowTable : public Representable { 00395 friend class ASDM; 00396 00397 public: 00398 00399 00405 static const std::vector<std::string>& getKeyName(); 00406 00407 00408 virtual ~SpectralWindowTable(); 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::SpectralWindowTableIDL *toIDL() ; 00490 00498 void toIDL(asdmIDL::SpectralWindowTableIDL& x) const; 00499 00500 #endif 00501 00502 #ifndef WITHOUT_ACS 00503 00509 void fromIDL(asdmIDL::SpectralWindowTableIDL x) ; 00510 #endif 00511 00512 // 00513 // ====> Row creation. 00514 // 00515 00520 SpectralWindowRow *newRow(); 00521 00522 00542 SpectralWindowRow *newRow(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband netSideband, int numChan, Frequency refFreq, SidebandProcessingModeMod::SidebandProcessingMode sidebandProcessingMode, Frequency totBandwidth, WindowFunctionMod::WindowFunction windowFunction); 00543 00544 00545 00558 SpectralWindowRow *newRow(SpectralWindowRow *row); 00559 00560 // 00561 // ====> Append a row to its table. 00562 // 00563 00564 00565 00566 00576 SpectralWindowRow* add(SpectralWindowRow* x) ; 00577 00578 00579 00580 // 00581 // ====> Methods returning rows. 00582 // 00583 00589 std::vector<SpectralWindowRow *> get() ; 00590 00597 const std::vector<SpectralWindowRow *>& get() const ; 00598 00599 00600 00601 00602 00612 SpectralWindowRow* getRowByKey(Tag spectralWindowId); 00613 00614 00615 00616 00617 00639 SpectralWindowRow* lookup(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband netSideband, int numChan, Frequency refFreq, SidebandProcessingModeMod::SidebandProcessingMode sidebandProcessingMode, Frequency totBandwidth, WindowFunctionMod::WindowFunction windowFunction); 00640 00641 00642 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00643 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00644 00645 private: 00646 00655 SpectralWindowTable (ASDM & container); 00656 00657 ASDM & container; 00658 00659 bool archiveAsBin; // If true archive binary else archive XML 00660 bool fileAsBin ; // If true file binary else file XML 00661 00662 std::string version ; 00663 00664 Entity entity; 00665 00666 00667 // A map for the autoincrementation algorithm 00668 std::map<std::string,int> noAutoIncIds; 00669 void autoIncrement(std::string key, SpectralWindowRow* x); 00670 00671 00681 SpectralWindowRow* checkAndAdd(SpectralWindowRow* x, bool skipCheckUniqueness=false) ; 00682 00688 void append(SpectralWindowRow* x) ; 00689 00695 void addWithoutCheckingUnique(SpectralWindowRow* x) ; 00696 00697 00698 00699 00700 00701 // A data structure to store the pointers on the table's rows. 00702 00703 // In all cases we maintain a private vector of SpectralWindowRow s. 00704 std::vector<SpectralWindowRow * > privateRows; 00705 00706 00707 00708 std::vector<SpectralWindowRow *> row; 00709 00710 00711 void error() ; //throw(ConversionException); 00712 00713 00720 void fromXML(std::string& xmlDoc) ; 00721 00722 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00723 00728 void setFromMIMEFile(const std::string& directory); 00729 /* 00730 void openMIMEFile(const std::string& directory); 00731 */ 00732 void setFromXMLFile(const std::string& directory); 00733 00741 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00742 00743 00750 void setFromMIME(const std::string & mimeMsg); 00751 00755 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00756 00766 void toFile(std::string directory); 00767 00771 bool loadInProgress; 00772 void checkPresenceInMemory() { 00773 if (!presentInMemory && !loadInProgress) { 00774 loadInProgress = true; 00775 setFromFile(getContainer().getDirectory()); 00776 presentInMemory = true; 00777 loadInProgress = false; 00778 } 00779 } 00788 void setFromFile(const std::string& directory); 00789 00790 }; 00791 00792 } // End namespace asdm 00793 00794 #endif /* SpectralWindowTable_CLASS */