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 EphemerisTable.h 00032 */ 00033 00034 #ifndef EphemerisTable_CLASS 00035 #define EphemerisTable_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 #include <ConversionException.h> 00055 #include <DuplicateKey.h> 00056 #include <UniquenessViolationException.h> 00057 #include <NoSuchRow.h> 00058 #include <DuplicateKey.h> 00059 00060 00061 #ifndef WITHOUT_ACS 00062 #include <asdmIDLC.h> 00063 #endif 00064 00065 #include <Representable.h> 00066 00067 namespace asdm { 00068 00069 //class asdm::ASDM; 00070 //class asdm::EphemerisRow; 00071 00072 class ASDM; 00073 class EphemerisRow; 00104 class EphemerisTable : public Representable { 00105 friend class ASDM; 00106 00107 public: 00108 00109 00115 static std::vector<std::string> getKeyName(); 00116 00117 00118 virtual ~EphemerisTable(); 00119 00125 ASDM &getContainer() const; 00126 00132 unsigned int size() const; 00133 00141 std::string getName() const; 00142 00150 static std::string name() ; 00151 00156 std::string getVersion() const ; 00157 00163 static const std::vector<std::string>& getAttributesNames(); 00164 00170 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00171 00175 Entity getEntity() const; 00176 00181 void setEntity(Entity e); 00182 00190 std::string toXML() ; 00191 00192 #ifndef WITHOUT_ACS 00193 // Conversion Methods 00199 asdmIDL::EphemerisTableIDL *toIDL() ; 00200 #endif 00201 00202 #ifndef WITHOUT_ACS 00203 00209 void fromIDL(asdmIDL::EphemerisTableIDL x) ; 00210 #endif 00211 00212 // 00213 // ====> Row creation. 00214 // 00215 00220 EphemerisRow *newRow(); 00221 00222 00223 00236 EphemerisRow *newRow(EphemerisRow *row); 00237 00238 // 00239 // ====> Append a row to its table. 00240 // 00241 00242 00243 00244 00254 EphemerisRow* add(EphemerisRow* x) ; 00255 00256 00257 00258 // 00259 // ====> Methods returning rows. 00260 // 00261 00267 std::vector<EphemerisRow *> get() ; 00268 00275 const std::vector<EphemerisRow *>& get() const ; 00276 00277 00278 00279 00280 00290 EphemerisRow* getRowByKey(Tag ephemerisId); 00291 00292 00293 00294 00295 00296 00297 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00298 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00299 00300 private: 00301 00310 EphemerisTable (ASDM & container); 00311 00312 ASDM & container; 00313 00314 bool archiveAsBin; // If true archive binary else archive XML 00315 bool fileAsBin ; // If true file binary else file XML 00316 00317 std::string version ; 00318 00319 Entity entity; 00320 00321 00322 // A map for the autoincrementation algorithm 00323 std::map<std::string,int> noAutoIncIds; 00324 void autoIncrement(std::string key, EphemerisRow* x); 00325 00326 00330 static std::string itsName; 00331 00335 static std::vector<std::string> attributesNames; 00336 00340 static std::vector<std::string> attributesNamesInBin; 00341 00342 00346 static bool initAttributesNames(), initAttributesNamesDone ; 00347 00348 00352 static std::vector<std::string> key; 00353 00354 00364 EphemerisRow* checkAndAdd(EphemerisRow* x) ; 00365 00371 void append(EphemerisRow* x) ; 00372 00378 void addWithoutCheckingUnique(EphemerisRow* x) ; 00379 00380 00381 00382 00383 00384 // A data structure to store the pointers on the table's rows. 00385 00386 // In all cases we maintain a private vector of EphemerisRow s. 00387 std::vector<EphemerisRow * > privateRows; 00388 00389 00390 00391 std::vector<EphemerisRow *> row; 00392 00393 00394 void error() ; //throw(ConversionException); 00395 00396 00403 void fromXML(std::string& xmlDoc) ; 00404 00405 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00406 00411 void setFromMIMEFile(const std::string& directory); 00412 /* 00413 void openMIMEFile(const std::string& directory); 00414 */ 00415 void setFromXMLFile(const std::string& directory); 00416 00424 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00425 00426 00433 void setFromMIME(const std::string & mimeMsg); 00434 00438 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00439 00449 void toFile(std::string directory); 00450 00454 bool loadInProgress; 00455 void checkPresenceInMemory() { 00456 if (!presentInMemory && !loadInProgress) { 00457 loadInProgress = true; 00458 setFromFile(getContainer().getDirectory()); 00459 presentInMemory = true; 00460 loadInProgress = false; 00461 } 00462 } 00471 void setFromFile(const std::string& directory); 00472 00473 }; 00474 00475 } // End namespace asdm 00476 00477 #endif /* EphemerisTable_CLASS */