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 CalDeviceTable.h 00032 */ 00033 00034 #ifndef CalDeviceTable_CLASS 00035 #define CalDeviceTable_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 #include "CCalibrationDevice.h" 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 #include <ConversionException.h> 00079 #include <DuplicateKey.h> 00080 #include <UniquenessViolationException.h> 00081 #include <NoSuchRow.h> 00082 #include <DuplicateKey.h> 00083 00084 00085 #ifndef WITHOUT_ACS 00086 #include <asdmIDLC.h> 00087 #endif 00088 00089 #include <Representable.h> 00090 00091 namespace asdm { 00092 00093 //class asdm::ASDM; 00094 //class asdm::CalDeviceRow; 00095 00096 class ASDM; 00097 class CalDeviceRow; 00210 class CalDeviceTable : public Representable { 00211 friend class ASDM; 00212 00213 public: 00214 00215 00221 static std::vector<std::string> getKeyName(); 00222 00223 00224 virtual ~CalDeviceTable(); 00225 00231 ASDM &getContainer() const; 00232 00238 unsigned int size() const; 00239 00247 std::string getName() const; 00248 00256 static std::string name() ; 00257 00262 std::string getVersion() const ; 00263 00269 static const std::vector<std::string>& getAttributesNames(); 00270 00276 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00277 00281 Entity getEntity() const; 00282 00287 void setEntity(Entity e); 00288 00296 std::string toXML() ; 00297 00298 #ifndef WITHOUT_ACS 00299 // Conversion Methods 00305 asdmIDL::CalDeviceTableIDL *toIDL() ; 00306 #endif 00307 00308 #ifndef WITHOUT_ACS 00309 00315 void fromIDL(asdmIDL::CalDeviceTableIDL x) ; 00316 #endif 00317 00318 // 00319 // ====> Row creation. 00320 // 00321 00326 CalDeviceRow *newRow(); 00327 00328 00346 CalDeviceRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numCalload, vector<CalibrationDeviceMod::CalibrationDevice > calLoadNames); 00347 00348 00349 00362 CalDeviceRow *newRow(CalDeviceRow *row); 00363 00364 // 00365 // ====> Append a row to its table. 00366 // 00367 00368 00385 CalDeviceRow* add(CalDeviceRow* x) ; 00386 00387 00388 00389 00390 00391 // 00392 // ====> Methods returning rows. 00393 // 00394 00400 std::vector<CalDeviceRow *> get() ; 00401 00408 const std::vector<CalDeviceRow *>& get() const ; 00409 00410 00421 std::vector <CalDeviceRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId); 00422 00423 00424 00425 00426 00442 CalDeviceRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId); 00443 00444 00445 00446 00447 00467 CalDeviceRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numCalload, vector<CalibrationDeviceMod::CalibrationDevice > calLoadNames); 00468 00469 00470 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00471 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00472 00473 private: 00474 00483 CalDeviceTable (ASDM & container); 00484 00485 ASDM & container; 00486 00487 bool archiveAsBin; // If true archive binary else archive XML 00488 bool fileAsBin ; // If true file binary else file XML 00489 00490 std::string version ; 00491 00492 Entity entity; 00493 00494 00495 00499 static std::string itsName; 00500 00504 static std::vector<std::string> attributesNames; 00505 00509 static std::vector<std::string> attributesNamesInBin; 00510 00511 00515 static bool initAttributesNames(), initAttributesNamesDone ; 00516 00517 00521 static std::vector<std::string> key; 00522 00523 00531 CalDeviceRow* checkAndAdd(CalDeviceRow* x) ; 00532 00538 void append(CalDeviceRow* x) ; 00539 00545 void addWithoutCheckingUnique(CalDeviceRow* x) ; 00546 00547 00548 00549 00550 00551 00559 CalDeviceRow * insertByStartTime(CalDeviceRow* x, std::vector<CalDeviceRow* >& row); 00560 00561 00562 00563 // A data structure to store the pointers on the table's rows. 00564 00565 // In all cases we maintain a private vector of CalDeviceRow s. 00566 std::vector<CalDeviceRow * > privateRows; 00567 00568 00569 00570 00571 00572 00573 00574 00575 typedef std::vector <CalDeviceRow* > TIME_ROWS; 00576 std::map<std::string, TIME_ROWS > context; 00577 00582 std::string Key(Tag antennaId, Tag spectralWindowId, int feedId) ; 00583 00584 00585 00586 00592 void getByKeyNoAutoIncNoTime(std::vector <CalDeviceRow*>& vin, std::vector <CalDeviceRow*>& vout, Tag antennaId, Tag spectralWindowId, int feedId); 00593 00594 00595 00596 void error() ; //throw(ConversionException); 00597 00598 00605 void fromXML(std::string& xmlDoc) ; 00606 00607 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00608 00613 void setFromMIMEFile(const std::string& directory); 00614 /* 00615 void openMIMEFile(const std::string& directory); 00616 */ 00617 void setFromXMLFile(const std::string& directory); 00618 00626 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00627 00628 00635 void setFromMIME(const std::string & mimeMsg); 00636 00640 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00641 00651 void toFile(std::string directory); 00652 00656 bool loadInProgress; 00657 void checkPresenceInMemory() { 00658 if (!presentInMemory && !loadInProgress) { 00659 loadInProgress = true; 00660 setFromFile(getContainer().getDirectory()); 00661 presentInMemory = true; 00662 loadInProgress = false; 00663 } 00664 } 00673 void setFromFile(const std::string& directory); 00674 00675 }; 00676 00677 } // End namespace asdm 00678 00679 #endif /* CalDeviceTable_CLASS */