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 BeamTable.h 00032 */ 00033 00034 #ifndef BeamTable_CLASS 00035 #define BeamTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 #include <set> 00041 using std::string; 00042 using std::vector; 00043 using std::map; 00044 00045 00046 00047 #include <Tag.h> 00048 using asdm::Tag; 00049 00050 00051 00052 00053 00054 00055 00056 00057 #include <ConversionException.h> 00058 #include <DuplicateKey.h> 00059 #include <UniquenessViolationException.h> 00060 #include <NoSuchRow.h> 00061 #include <DuplicateKey.h> 00062 using asdm::DuplicateKey; 00063 using asdm::ConversionException; 00064 using asdm::NoSuchRow; 00065 using asdm::DuplicateKey; 00066 00067 #ifndef WITHOUT_ACS 00068 #include <asdmIDLC.h> 00069 using asdmIDL::BeamTableIDL; 00070 #endif 00071 00072 #include <Representable.h> 00073 00074 namespace asdm { 00075 00076 //class asdm::ASDM; 00077 //class asdm::BeamRow; 00078 00079 class ASDM; 00080 class BeamRow; 00111 class BeamTable : public Representable { 00112 friend class ASDM; 00113 00114 public: 00115 00116 00122 static vector<string> getKeyName(); 00123 00124 00125 virtual ~BeamTable(); 00126 00132 ASDM &getContainer() const; 00133 00139 unsigned int size() const; 00140 00146 string getName() const; 00147 00153 static const vector<string>& getAttributesNames(); 00154 00158 Entity getEntity() const; 00159 00164 void setEntity(Entity e); 00165 00173 string toXML() ; 00174 00175 #ifndef WITHOUT_ACS 00176 // Conversion Methods 00182 BeamTableIDL *toIDL() ; 00183 #endif 00184 00185 #ifndef WITHOUT_ACS 00186 00192 void fromIDL(BeamTableIDL x) ; 00193 #endif 00194 00195 // 00196 // ====> Row creation. 00197 // 00198 00203 BeamRow *newRow(); 00204 00205 00206 00219 BeamRow *newRow(BeamRow *row); 00220 00221 // 00222 // ====> Append a row to its table. 00223 // 00224 00225 00226 00227 00237 BeamRow* add(BeamRow* x) ; 00238 00239 00240 00241 // 00242 // ====> Methods returning rows. 00243 // 00244 00250 vector<BeamRow *> get() ; 00251 00258 const vector<BeamRow *>& get() const ; 00259 00260 00261 00262 00263 00273 BeamRow* getRowByKey(Tag beamId); 00274 00275 00276 00277 00278 00279 00280 private: 00281 00290 BeamTable (ASDM & container); 00291 00292 ASDM & container; 00293 00294 bool archiveAsBin; // If true archive binary else archive XML 00295 bool fileAsBin ; // If true file binary else file XML 00296 00297 Entity entity; 00298 00299 00300 // A map for the autoincrementation algorithm 00301 map<string,int> noAutoIncIds; 00302 void autoIncrement(string key, BeamRow* x); 00303 00304 00308 static string tableName; 00309 00313 static const vector<string> attributesNames; 00314 00318 static vector<string> initAttributesNames(); 00319 00320 00324 static vector<string> key; 00325 00326 00336 BeamRow* checkAndAdd(BeamRow* x) ; 00337 00338 00339 00340 // A data structure to store the pointers on the table's rows. 00341 00342 // In all cases we maintain a private vector of BeamRow s. 00343 vector<BeamRow * > privateRows; 00344 00345 00346 00347 vector<BeamRow *> row; 00348 00349 00350 void error() ; //throw(ConversionException); 00351 00352 00359 void fromXML(string& xmlDoc) ; 00360 00365 void setFromMIMEFile(const string& directory); 00366 void setFromXMLFile(const string& directory); 00367 00375 string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00376 00377 00384 void setFromMIME(const string & mimeMsg); 00385 00389 string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00390 00400 void toFile(string directory); 00401 00405 bool loadInProgress; 00406 void checkPresenceInMemory() { 00407 if (!presentInMemory && !loadInProgress) { 00408 loadInProgress = true; 00409 setFromFile(getContainer().getDirectory()); 00410 presentInMemory = true; 00411 loadInProgress = false; 00412 } 00413 } 00422 void setFromFile(const string& directory); 00423 00424 }; 00425 00426 } // End namespace asdm 00427 00428 #endif /* BeamTable_CLASS */