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 ScanTable.h 00032 */ 00033 00034 #ifndef ScanTable_CLASS 00035 #define ScanTable_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 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 #include "CScanIntent.h" 00066 00067 00068 00069 #include "CCalDataOrigin.h" 00070 00071 00072 00073 00074 00075 #include "CCalibrationFunction.h" 00076 00077 00078 00079 #include "CCalibrationSet.h" 00080 00081 00082 00083 #include "CAntennaMotionPattern.h" 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 namespace asdm { 00108 00109 //class asdm::ASDM; 00110 //class asdm::ScanRow; 00111 00112 class ASDM; 00113 class ScanRow; 00250 class ScanTable : public Representable { 00251 friend class ASDM; 00252 00253 public: 00254 00255 00261 static std::vector<std::string> getKeyName(); 00262 00263 00264 virtual ~ScanTable(); 00265 00271 ASDM &getContainer() const; 00272 00278 unsigned int size() const; 00279 00287 std::string getName() const; 00288 00296 static std::string name() ; 00297 00302 std::string getVersion() const ; 00303 00309 static const std::vector<std::string>& getAttributesNames(); 00310 00316 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00317 00321 Entity getEntity() const; 00322 00327 void setEntity(Entity e); 00328 00336 std::string toXML() ; 00337 00338 #ifndef WITHOUT_ACS 00339 // Conversion Methods 00345 asdmIDL::ScanTableIDL *toIDL() ; 00346 #endif 00347 00348 #ifndef WITHOUT_ACS 00349 00355 void fromIDL(asdmIDL::ScanTableIDL x) ; 00356 #endif 00357 00358 // 00359 // ====> Row creation. 00360 // 00361 00366 ScanRow *newRow(); 00367 00368 00392 ScanRow *newRow(Tag execBlockId, int scanNumber, ArrayTime startTime, ArrayTime endTime, int numIntent, int numSubscan, vector<ScanIntentMod::ScanIntent > scanIntent, vector<CalDataOriginMod::CalDataOrigin > calDataType, vector<bool > calibrationOnLine); 00393 00394 00395 00408 ScanRow *newRow(ScanRow *row); 00409 00410 // 00411 // ====> Append a row to its table. 00412 // 00413 00414 00427 ScanRow* add(ScanRow* x) ; 00428 00429 00430 00431 00432 00433 // 00434 // ====> Methods returning rows. 00435 // 00436 00442 std::vector<ScanRow *> get() ; 00443 00450 const std::vector<ScanRow *>& get() const ; 00451 00452 00453 00454 00455 00467 ScanRow* getRowByKey(Tag execBlockId, int scanNumber); 00468 00469 00470 00471 00472 00498 ScanRow* lookup(Tag execBlockId, int scanNumber, ArrayTime startTime, ArrayTime endTime, int numIntent, int numSubscan, vector<ScanIntentMod::ScanIntent > scanIntent, vector<CalDataOriginMod::CalDataOrigin > calDataType, vector<bool > calibrationOnLine); 00499 00500 00501 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00502 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00503 00504 private: 00505 00514 ScanTable (ASDM & container); 00515 00516 ASDM & container; 00517 00518 bool archiveAsBin; // If true archive binary else archive XML 00519 bool fileAsBin ; // If true file binary else file XML 00520 00521 std::string version ; 00522 00523 Entity entity; 00524 00525 00526 00530 static std::string itsName; 00531 00535 static std::vector<std::string> attributesNames; 00536 00540 static std::vector<std::string> attributesNamesInBin; 00541 00542 00546 static bool initAttributesNames(), initAttributesNamesDone ; 00547 00548 00552 static std::vector<std::string> key; 00553 00554 00562 ScanRow* checkAndAdd(ScanRow* x) ; 00563 00569 void append(ScanRow* x) ; 00570 00576 void addWithoutCheckingUnique(ScanRow* x) ; 00577 00578 00579 00580 00581 00582 // A data structure to store the pointers on the table's rows. 00583 00584 // In all cases we maintain a private vector of ScanRow s. 00585 std::vector<ScanRow * > privateRows; 00586 00587 00588 00589 std::vector<ScanRow *> row; 00590 00591 00592 void error() ; //throw(ConversionException); 00593 00594 00601 void fromXML(std::string& xmlDoc) ; 00602 00603 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00604 00609 void setFromMIMEFile(const std::string& directory); 00610 /* 00611 void openMIMEFile(const std::string& directory); 00612 */ 00613 void setFromXMLFile(const std::string& directory); 00614 00622 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00623 00624 00631 void setFromMIME(const std::string & mimeMsg); 00632 00636 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00637 00647 void toFile(std::string directory); 00648 00652 bool loadInProgress; 00653 void checkPresenceInMemory() { 00654 if (!presentInMemory && !loadInProgress) { 00655 loadInProgress = true; 00656 setFromFile(getContainer().getDirectory()); 00657 presentInMemory = true; 00658 loadInProgress = false; 00659 } 00660 } 00669 void setFromFile(const std::string& directory); 00670 00671 }; 00672 00673 } // End namespace asdm 00674 00675 #endif /* ScanTable_CLASS */