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 AlmaRadiometerTable.h 00032 */ 00033 00034 #ifndef AlmaRadiometerTable_CLASS 00035 #define AlmaRadiometerTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 00041 00042 00043 00044 #include <Tag.h> 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 #include <ConversionException.h> 00057 #include <DuplicateKey.h> 00058 #include <UniquenessViolationException.h> 00059 #include <NoSuchRow.h> 00060 #include <DuplicateKey.h> 00061 00062 00063 #ifndef WITHOUT_ACS 00064 #include <asdmIDLC.h> 00065 #endif 00066 00067 #include <Representable.h> 00068 00069 namespace asdm { 00070 00071 //class asdm::ASDM; 00072 //class asdm::AlmaRadiometerRow; 00073 00074 class ASDM; 00075 class AlmaRadiometerRow; 00123 class AlmaRadiometerTable : public Representable { 00124 friend class ASDM; 00125 00126 public: 00127 00128 00134 static std::vector<std::string> getKeyName(); 00135 00136 00137 virtual ~AlmaRadiometerTable(); 00138 00144 ASDM &getContainer() const; 00145 00151 unsigned int size() const; 00152 00160 std::string getName() const; 00161 00169 static std::string name() ; 00170 00175 std::string getVersion() const ; 00176 00182 static const std::vector<std::string>& getAttributesNames(); 00183 00189 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00190 00194 Entity getEntity() const; 00195 00200 void setEntity(Entity e); 00201 00209 std::string toXML() ; 00210 00211 #ifndef WITHOUT_ACS 00212 // Conversion Methods 00218 asdmIDL::AlmaRadiometerTableIDL *toIDL() ; 00219 #endif 00220 00221 #ifndef WITHOUT_ACS 00222 00228 void fromIDL(asdmIDL::AlmaRadiometerTableIDL x) ; 00229 #endif 00230 00231 // 00232 // ====> Row creation. 00233 // 00234 00239 AlmaRadiometerRow *newRow(); 00240 00241 00242 00255 AlmaRadiometerRow *newRow(AlmaRadiometerRow *row); 00256 00257 // 00258 // ====> Append a row to its table. 00259 // 00260 00261 00262 00263 00273 AlmaRadiometerRow* add(AlmaRadiometerRow* x) ; 00274 00275 00276 00277 // 00278 // ====> Methods returning rows. 00279 // 00280 00286 std::vector<AlmaRadiometerRow *> get() ; 00287 00294 const std::vector<AlmaRadiometerRow *>& get() const ; 00295 00296 00297 00298 00299 00309 AlmaRadiometerRow* getRowByKey(Tag almaRadiometerId); 00310 00311 00312 00313 00314 00315 00316 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00317 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00318 00319 private: 00320 00329 AlmaRadiometerTable (ASDM & container); 00330 00331 ASDM & container; 00332 00333 bool archiveAsBin; // If true archive binary else archive XML 00334 bool fileAsBin ; // If true file binary else file XML 00335 00336 std::string version ; 00337 00338 Entity entity; 00339 00340 00341 // A map for the autoincrementation algorithm 00342 std::map<std::string,int> noAutoIncIds; 00343 void autoIncrement(std::string key, AlmaRadiometerRow* x); 00344 00345 00349 static std::string itsName; 00350 00354 static std::vector<std::string> attributesNames; 00355 00359 static std::vector<std::string> attributesNamesInBin; 00360 00361 00365 static bool initAttributesNames(), initAttributesNamesDone ; 00366 00367 00371 static std::vector<std::string> key; 00372 00373 00383 AlmaRadiometerRow* checkAndAdd(AlmaRadiometerRow* x) ; 00384 00390 void append(AlmaRadiometerRow* x) ; 00391 00397 void addWithoutCheckingUnique(AlmaRadiometerRow* x) ; 00398 00399 00400 00401 00402 00403 // A data structure to store the pointers on the table's rows. 00404 00405 // In all cases we maintain a private vector of AlmaRadiometerRow s. 00406 std::vector<AlmaRadiometerRow * > privateRows; 00407 00408 00409 00410 std::vector<AlmaRadiometerRow *> row; 00411 00412 00413 void error() ; //throw(ConversionException); 00414 00415 00422 void fromXML(std::string& xmlDoc) ; 00423 00424 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00425 00430 void setFromMIMEFile(const std::string& directory); 00431 /* 00432 void openMIMEFile(const std::string& directory); 00433 */ 00434 void setFromXMLFile(const std::string& directory); 00435 00443 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00444 00445 00452 void setFromMIME(const std::string & mimeMsg); 00453 00457 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00458 00468 void toFile(std::string directory); 00469 00473 bool loadInProgress; 00474 void checkPresenceInMemory() { 00475 if (!presentInMemory && !loadInProgress) { 00476 loadInProgress = true; 00477 setFromFile(getContainer().getDirectory()); 00478 presentInMemory = true; 00479 loadInProgress = false; 00480 } 00481 } 00490 void setFromFile(const std::string& directory); 00491 00492 }; 00493 00494 } // End namespace asdm 00495 00496 #endif /* AlmaRadiometerTable_CLASS */