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 SysCalTable.h 00032 */ 00033 00034 #ifndef SysCalTable_CLASS 00035 #define SysCalTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 00041 00042 00043 00044 #include <Tag.h> 00045 00046 00047 00048 #include <Temperature.h> 00049 00050 00051 00052 #include <ArrayTimeInterval.h> 00053 00054 00055 00056 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 #include <ConversionException.h> 00095 #include <DuplicateKey.h> 00096 #include <UniquenessViolationException.h> 00097 #include <NoSuchRow.h> 00098 #include <DuplicateKey.h> 00099 00100 00101 #ifndef WITHOUT_ACS 00102 #include <asdmIDLC.h> 00103 #endif 00104 00105 #include <Representable.h> 00106 00107 #include <pthread.h> 00108 00109 namespace asdm { 00110 00111 //class asdm::ASDM; 00112 //class asdm::SysCalRow; 00113 00114 class ASDM; 00115 class SysCalRow; 00291 class SysCalTable : public Representable { 00292 friend class ASDM; 00293 00294 public: 00295 00296 00302 static const std::vector<std::string>& getKeyName(); 00303 00304 00305 virtual ~SysCalTable(); 00306 00312 ASDM &getContainer() const; 00313 00319 unsigned int size() const; 00320 00328 std::string getName() const; 00329 00337 static std::string name() ; 00338 00343 std::string getVersion() const ; 00344 00350 static const std::vector<std::string>& getAttributesNames(); 00351 00357 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00358 00362 Entity getEntity() const; 00363 00368 void setEntity(Entity e); 00369 00377 std::string toXML() ; 00378 00379 #ifndef WITHOUT_ACS 00380 // Conversion Methods 00386 asdmIDL::SysCalTableIDL *toIDL() ; 00387 00395 void toIDL(asdmIDL::SysCalTableIDL& x) const; 00396 00397 #endif 00398 00399 #ifndef WITHOUT_ACS 00400 00406 void fromIDL(asdmIDL::SysCalTableIDL x) ; 00407 #endif 00408 00409 // 00410 // ====> Row creation. 00411 // 00412 00417 SysCalRow *newRow(); 00418 00419 00437 SysCalRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numReceptor, int numChan); 00438 00439 00440 00453 SysCalRow *newRow(SysCalRow *row); 00454 00455 // 00456 // ====> Append a row to its table. 00457 // 00458 00459 00476 SysCalRow* add(SysCalRow* x) ; 00477 00478 00479 00480 00481 00482 // 00483 // ====> Methods returning rows. 00484 // 00485 00491 std::vector<SysCalRow *> get() ; 00492 00499 const std::vector<SysCalRow *>& get() const ; 00500 00501 00512 std::vector <SysCalRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId); 00513 00514 00515 00516 00517 00533 SysCalRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId); 00534 00535 00536 00537 00538 00558 SysCalRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numReceptor, int numChan); 00559 00560 00561 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00562 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00563 00564 private: 00565 00574 SysCalTable (ASDM & container); 00575 00576 ASDM & container; 00577 00578 bool archiveAsBin; // If true archive binary else archive XML 00579 bool fileAsBin ; // If true file binary else file XML 00580 00581 std::string version ; 00582 00583 Entity entity; 00584 00585 00586 00594 SysCalRow* checkAndAdd(SysCalRow* x, bool skipCheckUniqueness=false) ; 00595 00601 void append(SysCalRow* x) ; 00602 00608 void addWithoutCheckingUnique(SysCalRow* x) ; 00609 00610 00611 00612 00613 00614 00622 SysCalRow * insertByStartTime(SysCalRow* x, std::vector<SysCalRow* >& row); 00623 00624 00625 00626 // A data structure to store the pointers on the table's rows. 00627 00628 // In all cases we maintain a private vector of SysCalRow s. 00629 std::vector<SysCalRow * > privateRows; 00630 00631 00632 00633 00634 00635 00636 00637 00638 typedef std::vector <SysCalRow* > TIME_ROWS; 00639 std::map<std::string, TIME_ROWS > context; 00640 00645 std::string Key(Tag antennaId, Tag spectralWindowId, int feedId) ; 00646 00647 00648 00649 00655 void getByKeyNoAutoIncNoTime(std::vector <SysCalRow*>& vin, std::vector <SysCalRow*>& vout, Tag antennaId, Tag spectralWindowId, int feedId); 00656 00657 00658 00659 void error() ; //throw(ConversionException); 00660 00661 00668 void fromXML(std::string& xmlDoc) ; 00669 00670 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00671 00676 void setFromMIMEFile(const std::string& directory); 00677 /* 00678 void openMIMEFile(const std::string& directory); 00679 */ 00680 void setFromXMLFile(const std::string& directory); 00681 00689 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00690 00691 00698 void setFromMIME(const std::string & mimeMsg); 00699 00703 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00704 00714 void toFile(std::string directory); 00715 00719 bool loadInProgress; 00720 void checkPresenceInMemory() { 00721 if (!presentInMemory && !loadInProgress) { 00722 loadInProgress = true; 00723 setFromFile(getContainer().getDirectory()); 00724 presentInMemory = true; 00725 loadInProgress = false; 00726 } 00727 } 00736 void setFromFile(const std::string& directory); 00737 00738 }; 00739 00740 } // End namespace asdm 00741 00742 #endif /* SysCalTable_CLASS */