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 AntennaTable.h 00032 */ 00033 00034 #ifndef AntennaTable_CLASS 00035 #define AntennaTable_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 #include <Length.h> 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 #include "CAntennaMake.h" 00064 00065 00066 00067 #include "CAntennaType.h" 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 #include <ConversionException.h> 00081 #include <DuplicateKey.h> 00082 #include <UniquenessViolationException.h> 00083 #include <NoSuchRow.h> 00084 #include <DuplicateKey.h> 00085 00086 00087 #ifndef WITHOUT_ACS 00088 #include <asdmIDLC.h> 00089 #endif 00090 00091 #include <Representable.h> 00092 00093 namespace asdm { 00094 00095 //class asdm::ASDM; 00096 //class asdm::AntennaRow; 00097 00098 class ASDM; 00099 class AntennaRow; 00199 class AntennaTable : public Representable { 00200 friend class ASDM; 00201 00202 public: 00203 00204 00210 static std::vector<std::string> getKeyName(); 00211 00212 00213 virtual ~AntennaTable(); 00214 00220 ASDM &getContainer() const; 00221 00227 unsigned int size() const; 00228 00236 std::string getName() const; 00237 00245 static std::string name() ; 00246 00251 std::string getVersion() const ; 00252 00258 static const std::vector<std::string>& getAttributesNames(); 00259 00265 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00266 00270 Entity getEntity() const; 00271 00276 void setEntity(Entity e); 00277 00285 std::string toXML() ; 00286 00287 #ifndef WITHOUT_ACS 00288 // Conversion Methods 00294 asdmIDL::AntennaTableIDL *toIDL() ; 00295 #endif 00296 00297 #ifndef WITHOUT_ACS 00298 00304 void fromIDL(asdmIDL::AntennaTableIDL x) ; 00305 #endif 00306 00307 // 00308 // ====> Row creation. 00309 // 00310 00315 AntennaRow *newRow(); 00316 00317 00339 AntennaRow *newRow(string name, AntennaMakeMod::AntennaMake antennaMake, AntennaTypeMod::AntennaType antennaType, Length dishDiameter, vector<Length > position, vector<Length > offset, ArrayTime time, Tag stationId); 00340 00341 00342 00355 AntennaRow *newRow(AntennaRow *row); 00356 00357 // 00358 // ====> Append a row to its table. 00359 // 00360 00361 00362 00363 00373 AntennaRow* add(AntennaRow* x) ; 00374 00375 00376 00377 // 00378 // ====> Methods returning rows. 00379 // 00380 00386 std::vector<AntennaRow *> get() ; 00387 00394 const std::vector<AntennaRow *>& get() const ; 00395 00396 00397 00398 00399 00409 AntennaRow* getRowByKey(Tag antennaId); 00410 00411 00412 00413 00414 00438 AntennaRow* lookup(string name, AntennaMakeMod::AntennaMake antennaMake, AntennaTypeMod::AntennaType antennaType, Length dishDiameter, vector<Length > position, vector<Length > offset, ArrayTime time, Tag stationId); 00439 00440 00441 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00442 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00443 00444 private: 00445 00454 AntennaTable (ASDM & container); 00455 00456 ASDM & container; 00457 00458 bool archiveAsBin; // If true archive binary else archive XML 00459 bool fileAsBin ; // If true file binary else file XML 00460 00461 std::string version ; 00462 00463 Entity entity; 00464 00465 00466 // A map for the autoincrementation algorithm 00467 std::map<std::string,int> noAutoIncIds; 00468 void autoIncrement(std::string key, AntennaRow* x); 00469 00470 00474 static std::string itsName; 00475 00479 static std::vector<std::string> attributesNames; 00480 00484 static std::vector<std::string> attributesNamesInBin; 00485 00486 00490 static bool initAttributesNames(), initAttributesNamesDone ; 00491 00492 00496 static std::vector<std::string> key; 00497 00498 00508 AntennaRow* checkAndAdd(AntennaRow* x) ; 00509 00515 void append(AntennaRow* x) ; 00516 00522 void addWithoutCheckingUnique(AntennaRow* x) ; 00523 00524 00525 00526 00527 00528 // A data structure to store the pointers on the table's rows. 00529 00530 // In all cases we maintain a private vector of AntennaRow s. 00531 std::vector<AntennaRow * > privateRows; 00532 00533 00534 00535 std::vector<AntennaRow *> row; 00536 00537 00538 void error() ; //throw(ConversionException); 00539 00540 00547 void fromXML(std::string& xmlDoc) ; 00548 00549 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00550 00555 void setFromMIMEFile(const std::string& directory); 00556 /* 00557 void openMIMEFile(const std::string& directory); 00558 */ 00559 void setFromXMLFile(const std::string& directory); 00560 00568 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00569 00570 00577 void setFromMIME(const std::string & mimeMsg); 00578 00582 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00583 00593 void toFile(std::string directory); 00594 00598 bool loadInProgress; 00599 void checkPresenceInMemory() { 00600 if (!presentInMemory && !loadInProgress) { 00601 loadInProgress = true; 00602 setFromFile(getContainer().getDirectory()); 00603 presentInMemory = true; 00604 loadInProgress = false; 00605 } 00606 } 00615 void setFromFile(const std::string& directory); 00616 00617 }; 00618 00619 } // End namespace asdm 00620 00621 #endif /* AntennaTable_CLASS */