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 FlagCmdTable.h 00032 */ 00033 00034 #ifndef FlagCmdTable_CLASS 00035 #define FlagCmdTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 00041 00042 00043 00044 #include <ArrayTimeInterval.h> 00045 00046 00047 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 #include <ConversionException.h> 00067 #include <DuplicateKey.h> 00068 #include <UniquenessViolationException.h> 00069 #include <NoSuchRow.h> 00070 #include <DuplicateKey.h> 00071 00072 00073 #ifndef WITHOUT_ACS 00074 #include <asdmIDLC.h> 00075 #endif 00076 00077 #include <Representable.h> 00078 00079 namespace asdm { 00080 00081 //class asdm::ASDM; 00082 //class asdm::FlagCmdRow; 00083 00084 class ASDM; 00085 class FlagCmdRow; 00161 class FlagCmdTable : public Representable { 00162 friend class ASDM; 00163 00164 public: 00165 00166 00172 static std::vector<std::string> getKeyName(); 00173 00174 00175 virtual ~FlagCmdTable(); 00176 00182 ASDM &getContainer() const; 00183 00189 unsigned int size() const; 00190 00198 std::string getName() const; 00199 00207 static std::string name() ; 00208 00213 std::string getVersion() const ; 00214 00220 static const std::vector<std::string>& getAttributesNames(); 00221 00227 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00228 00232 Entity getEntity() const; 00233 00238 void setEntity(Entity e); 00239 00247 std::string toXML() ; 00248 00249 #ifndef WITHOUT_ACS 00250 // Conversion Methods 00256 asdmIDL::FlagCmdTableIDL *toIDL() ; 00257 #endif 00258 00259 #ifndef WITHOUT_ACS 00260 00266 void fromIDL(asdmIDL::FlagCmdTableIDL x) ; 00267 #endif 00268 00269 // 00270 // ====> Row creation. 00271 // 00272 00277 FlagCmdRow *newRow(); 00278 00279 00299 FlagCmdRow *newRow(ArrayTimeInterval timeInterval, string type, string reason, int level, int severity, bool applied, string command); 00300 00301 00302 00315 FlagCmdRow *newRow(FlagCmdRow *row); 00316 00317 // 00318 // ====> Append a row to its table. 00319 // 00320 00321 00338 FlagCmdRow* add(FlagCmdRow* x) ; 00339 00340 00341 00342 00343 00344 // 00345 // ====> Methods returning rows. 00346 // 00347 00353 std::vector<FlagCmdRow *> get() ; 00354 00361 const std::vector<FlagCmdRow *>& get() const ; 00362 00363 00374 std::vector <FlagCmdRow*> *getByContext(); 00375 00376 00377 00378 00379 00389 FlagCmdRow* getRowByKey(ArrayTimeInterval timeInterval); 00390 00391 00392 00393 00394 00416 FlagCmdRow* lookup(ArrayTimeInterval timeInterval, string type, string reason, int level, int severity, bool applied, string command); 00417 00418 00419 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00420 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00421 00422 private: 00423 00432 FlagCmdTable (ASDM & container); 00433 00434 ASDM & container; 00435 00436 bool archiveAsBin; // If true archive binary else archive XML 00437 bool fileAsBin ; // If true file binary else file XML 00438 00439 std::string version ; 00440 00441 Entity entity; 00442 00443 00444 00448 static std::string itsName; 00449 00453 static std::vector<std::string> attributesNames; 00454 00458 static std::vector<std::string> attributesNamesInBin; 00459 00460 00464 static bool initAttributesNames(), initAttributesNamesDone ; 00465 00466 00470 static std::vector<std::string> key; 00471 00472 00480 FlagCmdRow* checkAndAdd(FlagCmdRow* x) ; 00481 00487 void append(FlagCmdRow* x) ; 00488 00494 void addWithoutCheckingUnique(FlagCmdRow* x) ; 00495 00496 00497 00498 00499 00500 00508 FlagCmdRow * insertByStartTime(FlagCmdRow* x, std::vector<FlagCmdRow* >& row); 00509 00510 00511 00512 // A data structure to store the pointers on the table's rows. 00513 00514 // In all cases we maintain a private vector of FlagCmdRow s. 00515 std::vector<FlagCmdRow * > privateRows; 00516 00517 00518 00519 00520 00521 00522 00523 00524 std::vector <FlagCmdRow *> row; 00525 00526 00527 00528 00529 00530 00531 void error() ; //throw(ConversionException); 00532 00533 00540 void fromXML(std::string& xmlDoc) ; 00541 00542 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00543 00548 void setFromMIMEFile(const std::string& directory); 00549 /* 00550 void openMIMEFile(const std::string& directory); 00551 */ 00552 void setFromXMLFile(const std::string& directory); 00553 00561 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00562 00563 00570 void setFromMIME(const std::string & mimeMsg); 00571 00575 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00576 00586 void toFile(std::string directory); 00587 00591 bool loadInProgress; 00592 void checkPresenceInMemory() { 00593 if (!presentInMemory && !loadInProgress) { 00594 loadInProgress = true; 00595 setFromFile(getContainer().getDirectory()); 00596 presentInMemory = true; 00597 loadInProgress = false; 00598 } 00599 } 00608 void setFromFile(const std::string& directory); 00609 00610 }; 00611 00612 } // End namespace asdm 00613 00614 #endif /* FlagCmdTable_CLASS */