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 namespace asdm { 00140 00141 //class asdm::ASDM; 00142 //class asdm::SpectralWindowRow; 00143 00144 class ASDM; 00145 class SpectralWindowRow; 00392 class SpectralWindowTable : public Representable { 00393 friend class ASDM; 00394 00395 public: 00396 00397 00403 static std::vector<std::string> getKeyName(); 00404 00405 00406 virtual ~SpectralWindowTable(); 00407 00413 ASDM &getContainer() const; 00414 00420 unsigned int size() const; 00421 00429 std::string getName() const; 00430 00438 static std::string name() ; 00439 00444 std::string getVersion() const ; 00445 00451 static const std::vector<std::string>& getAttributesNames(); 00452 00458 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00459 00463 Entity getEntity() const; 00464 00469 void setEntity(Entity e); 00470 00478 std::string toXML() ; 00479 00480 #ifndef WITHOUT_ACS 00481 // Conversion Methods 00487 asdmIDL::SpectralWindowTableIDL *toIDL() ; 00488 #endif 00489 00490 #ifndef WITHOUT_ACS 00491 00497 void fromIDL(asdmIDL::SpectralWindowTableIDL x) ; 00498 #endif 00499 00500 // 00501 // ====> Row creation. 00502 // 00503 00508 SpectralWindowRow *newRow(); 00509 00510 00530 SpectralWindowRow *newRow(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband netSideband, int numChan, Frequency refFreq, SidebandProcessingModeMod::SidebandProcessingMode sidebandProcessingMode, Frequency totBandwidth, WindowFunctionMod::WindowFunction windowFunction); 00531 00532 00533 00546 SpectralWindowRow *newRow(SpectralWindowRow *row); 00547 00548 // 00549 // ====> Append a row to its table. 00550 // 00551 00552 00553 00554 00564 SpectralWindowRow* add(SpectralWindowRow* x) ; 00565 00566 00567 00568 // 00569 // ====> Methods returning rows. 00570 // 00571 00577 std::vector<SpectralWindowRow *> get() ; 00578 00585 const std::vector<SpectralWindowRow *>& get() const ; 00586 00587 00588 00589 00590 00600 SpectralWindowRow* getRowByKey(Tag spectralWindowId); 00601 00602 00603 00604 00605 00627 SpectralWindowRow* lookup(BasebandNameMod::BasebandName basebandName, NetSidebandMod::NetSideband netSideband, int numChan, Frequency refFreq, SidebandProcessingModeMod::SidebandProcessingMode sidebandProcessingMode, Frequency totBandwidth, WindowFunctionMod::WindowFunction windowFunction); 00628 00629 00630 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00631 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00632 00633 private: 00634 00643 SpectralWindowTable (ASDM & container); 00644 00645 ASDM & container; 00646 00647 bool archiveAsBin; // If true archive binary else archive XML 00648 bool fileAsBin ; // If true file binary else file XML 00649 00650 std::string version ; 00651 00652 Entity entity; 00653 00654 00655 // A map for the autoincrementation algorithm 00656 std::map<std::string,int> noAutoIncIds; 00657 void autoIncrement(std::string key, SpectralWindowRow* x); 00658 00659 00663 static std::string itsName; 00664 00668 static std::vector<std::string> attributesNames; 00669 00673 static std::vector<std::string> attributesNamesInBin; 00674 00675 00679 static bool initAttributesNames(), initAttributesNamesDone ; 00680 00681 00685 static std::vector<std::string> key; 00686 00687 00697 SpectralWindowRow* checkAndAdd(SpectralWindowRow* x) ; 00698 00704 void append(SpectralWindowRow* x) ; 00705 00711 void addWithoutCheckingUnique(SpectralWindowRow* x) ; 00712 00713 00714 00715 00716 00717 // A data structure to store the pointers on the table's rows. 00718 00719 // In all cases we maintain a private vector of SpectralWindowRow s. 00720 std::vector<SpectralWindowRow * > privateRows; 00721 00722 00723 00724 std::vector<SpectralWindowRow *> row; 00725 00726 00727 void error() ; //throw(ConversionException); 00728 00729 00736 void fromXML(std::string& xmlDoc) ; 00737 00738 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00739 00744 void setFromMIMEFile(const std::string& directory); 00745 /* 00746 void openMIMEFile(const std::string& directory); 00747 */ 00748 void setFromXMLFile(const std::string& directory); 00749 00757 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00758 00759 00766 void setFromMIME(const std::string & mimeMsg); 00767 00771 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00772 00782 void toFile(std::string directory); 00783 00787 bool loadInProgress; 00788 void checkPresenceInMemory() { 00789 if (!presentInMemory && !loadInProgress) { 00790 loadInProgress = true; 00791 setFromFile(getContainer().getDirectory()); 00792 presentInMemory = true; 00793 loadInProgress = false; 00794 } 00795 } 00804 void setFromFile(const std::string& directory); 00805 00806 }; 00807 00808 } // End namespace asdm 00809 00810 #endif /* SpectralWindowTable_CLASS */