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 DelayModelFixedParametersTable.h 00032 */ 00033 00034 #ifndef DelayModelFixedParametersTable_CLASS 00035 #define DelayModelFixedParametersTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 00041 00042 00043 00044 #include <Speed.h> 00045 00046 00047 00048 #include <Tag.h> 00049 00050 00051 00052 #include <Length.h> 00053 00054 00055 00056 #include <AngularRate.h> 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 00099 00100 00101 00102 #include <ConversionException.h> 00103 #include <DuplicateKey.h> 00104 #include <UniquenessViolationException.h> 00105 #include <NoSuchRow.h> 00106 #include <DuplicateKey.h> 00107 00108 00109 #ifndef WITHOUT_ACS 00110 #include <asdmIDLC.h> 00111 #endif 00112 00113 #include <Representable.h> 00114 00115 #include <pthread.h> 00116 00117 namespace asdm { 00118 00119 //class asdm::ASDM; 00120 //class asdm::DelayModelFixedParametersRow; 00121 00122 class ASDM; 00123 class DelayModelFixedParametersRow; 00294 class DelayModelFixedParametersTable : public Representable { 00295 friend class ASDM; 00296 00297 public: 00298 00299 00305 static const std::vector<std::string>& getKeyName(); 00306 00307 00308 virtual ~DelayModelFixedParametersTable(); 00309 00315 ASDM &getContainer() const; 00316 00322 unsigned int size() const; 00323 00331 std::string getName() const; 00332 00340 static std::string name() ; 00341 00346 std::string getVersion() const ; 00347 00353 static const std::vector<std::string>& getAttributesNames(); 00354 00360 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00361 00365 Entity getEntity() const; 00366 00371 void setEntity(Entity e); 00372 00380 std::string toXML() ; 00381 00382 #ifndef WITHOUT_ACS 00383 // Conversion Methods 00389 asdmIDL::DelayModelFixedParametersTableIDL *toIDL() ; 00390 00398 void toIDL(asdmIDL::DelayModelFixedParametersTableIDL& x) const; 00399 00400 #endif 00401 00402 #ifndef WITHOUT_ACS 00403 00409 void fromIDL(asdmIDL::DelayModelFixedParametersTableIDL x) ; 00410 #endif 00411 00412 // 00413 // ====> Row creation. 00414 // 00415 00420 DelayModelFixedParametersRow *newRow(); 00421 00422 00432 DelayModelFixedParametersRow *newRow(string delayModelVersion, Tag execBlockId); 00433 00434 00435 00448 DelayModelFixedParametersRow *newRow(DelayModelFixedParametersRow *row); 00449 00450 // 00451 // ====> Append a row to its table. 00452 // 00453 00454 00455 00456 00466 DelayModelFixedParametersRow* add(DelayModelFixedParametersRow* x) ; 00467 00468 00469 00470 // 00471 // ====> Methods returning rows. 00472 // 00473 00479 std::vector<DelayModelFixedParametersRow *> get() ; 00480 00487 const std::vector<DelayModelFixedParametersRow *>& get() const ; 00488 00489 00490 00491 00492 00502 DelayModelFixedParametersRow* getRowByKey(Tag delayModelFixedParametersId); 00503 00504 00505 00506 00507 00519 DelayModelFixedParametersRow* lookup(string delayModelVersion, Tag execBlockId); 00520 00521 00522 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00523 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00524 00525 private: 00526 00535 DelayModelFixedParametersTable (ASDM & container); 00536 00537 ASDM & container; 00538 00539 bool archiveAsBin; // If true archive binary else archive XML 00540 bool fileAsBin ; // If true file binary else file XML 00541 00542 std::string version ; 00543 00544 Entity entity; 00545 00546 00547 00548 00549 00550 // A map for the autoincrementation algorithm 00551 std::map<std::string,int> noAutoIncIds; 00552 void autoIncrement(std::string key, DelayModelFixedParametersRow* x); 00553 00554 00564 DelayModelFixedParametersRow* checkAndAdd(DelayModelFixedParametersRow* x, bool skipCheckUniqueness=false) ; 00565 00571 void append(DelayModelFixedParametersRow* x) ; 00572 00578 void addWithoutCheckingUnique(DelayModelFixedParametersRow* x) ; 00579 00580 00581 00582 00583 00584 // A data structure to store the pointers on the table's rows. 00585 00586 // In all cases we maintain a private vector of DelayModelFixedParametersRow s. 00587 std::vector<DelayModelFixedParametersRow * > privateRows; 00588 00589 00590 00591 std::vector<DelayModelFixedParametersRow *> row; 00592 00593 00594 void error() ; //throw(ConversionException); 00595 00596 00603 void fromXML(std::string& xmlDoc) ; 00604 00605 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00606 00611 void setFromMIMEFile(const std::string& directory); 00612 /* 00613 void openMIMEFile(const std::string& directory); 00614 */ 00615 void setFromXMLFile(const std::string& directory); 00616 00624 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00625 00626 00633 void setFromMIME(const std::string & mimeMsg); 00634 00638 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00639 00649 void toFile(std::string directory); 00650 00654 bool loadInProgress; 00655 void checkPresenceInMemory() { 00656 if (!presentInMemory && !loadInProgress) { 00657 loadInProgress = true; 00658 setFromFile(getContainer().getDirectory()); 00659 presentInMemory = true; 00660 loadInProgress = false; 00661 } 00662 } 00671 void setFromFile(const std::string& directory); 00672 00673 }; 00674 00675 } // End namespace asdm 00676 00677 #endif /* DelayModelFixedParametersTable_CLASS */