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 SeeingTable.h 00032 */ 00033 00034 #ifndef SeeingTable_CLASS 00035 #define SeeingTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 00041 00042 00043 00044 #include <Angle.h> 00045 00046 00047 00048 #include <Length.h> 00049 00050 00051 00052 #include <ArrayTimeInterval.h> 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 #include <ConversionException.h> 00073 #include <DuplicateKey.h> 00074 #include <UniquenessViolationException.h> 00075 #include <NoSuchRow.h> 00076 #include <DuplicateKey.h> 00077 00078 00079 #ifndef WITHOUT_ACS 00080 #include <asdmIDLC.h> 00081 #endif 00082 00083 #include <Representable.h> 00084 00085 namespace asdm { 00086 00087 //class asdm::ASDM; 00088 //class asdm::SeeingRow; 00089 00090 class ASDM; 00091 class SeeingRow; 00160 class SeeingTable : public Representable { 00161 friend class ASDM; 00162 00163 public: 00164 00165 00171 static std::vector<std::string> getKeyName(); 00172 00173 00174 virtual ~SeeingTable(); 00175 00181 ASDM &getContainer() const; 00182 00188 unsigned int size() const; 00189 00197 std::string getName() const; 00198 00206 static std::string name() ; 00207 00212 std::string getVersion() const ; 00213 00219 static const std::vector<std::string>& getAttributesNames(); 00220 00226 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00227 00231 Entity getEntity() const; 00232 00237 void setEntity(Entity e); 00238 00246 std::string toXML() ; 00247 00248 #ifndef WITHOUT_ACS 00249 // Conversion Methods 00255 asdmIDL::SeeingTableIDL *toIDL() ; 00256 #endif 00257 00258 #ifndef WITHOUT_ACS 00259 00265 void fromIDL(asdmIDL::SeeingTableIDL x) ; 00266 #endif 00267 00268 // 00269 // ====> Row creation. 00270 // 00271 00276 SeeingRow *newRow(); 00277 00278 00296 SeeingRow *newRow(ArrayTimeInterval timeInterval, int numBaseLength, vector<Length > baseLength, vector<Angle > phaseRms, float seeing, float exponent); 00297 00298 00299 00312 SeeingRow *newRow(SeeingRow *row); 00313 00314 // 00315 // ====> Append a row to its table. 00316 // 00317 00318 00335 SeeingRow* add(SeeingRow* x) ; 00336 00337 00338 00339 00340 00341 // 00342 // ====> Methods returning rows. 00343 // 00344 00350 std::vector<SeeingRow *> get() ; 00351 00358 const std::vector<SeeingRow *>& get() const ; 00359 00360 00371 std::vector <SeeingRow*> *getByContext(); 00372 00373 00374 00375 00376 00386 SeeingRow* getRowByKey(ArrayTimeInterval timeInterval); 00387 00388 00389 00390 00391 00411 SeeingRow* lookup(ArrayTimeInterval timeInterval, int numBaseLength, vector<Length > baseLength, vector<Angle > phaseRms, float seeing, float exponent); 00412 00413 00414 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00415 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00416 00417 private: 00418 00427 SeeingTable (ASDM & container); 00428 00429 ASDM & container; 00430 00431 bool archiveAsBin; // If true archive binary else archive XML 00432 bool fileAsBin ; // If true file binary else file XML 00433 00434 std::string version ; 00435 00436 Entity entity; 00437 00438 00439 00443 static std::string itsName; 00444 00448 static std::vector<std::string> attributesNames; 00449 00453 static std::vector<std::string> attributesNamesInBin; 00454 00455 00459 static bool initAttributesNames(), initAttributesNamesDone ; 00460 00461 00465 static std::vector<std::string> key; 00466 00467 00475 SeeingRow* checkAndAdd(SeeingRow* x) ; 00476 00482 void append(SeeingRow* x) ; 00483 00489 void addWithoutCheckingUnique(SeeingRow* x) ; 00490 00491 00492 00493 00494 00495 00503 SeeingRow * insertByStartTime(SeeingRow* x, std::vector<SeeingRow* >& row); 00504 00505 00506 00507 // A data structure to store the pointers on the table's rows. 00508 00509 // In all cases we maintain a private vector of SeeingRow s. 00510 std::vector<SeeingRow * > privateRows; 00511 00512 00513 00514 00515 00516 00517 00518 00519 std::vector <SeeingRow *> row; 00520 00521 00522 00523 00524 00525 00526 void error() ; //throw(ConversionException); 00527 00528 00535 void fromXML(std::string& xmlDoc) ; 00536 00537 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00538 00543 void setFromMIMEFile(const std::string& directory); 00544 /* 00545 void openMIMEFile(const std::string& directory); 00546 */ 00547 void setFromXMLFile(const std::string& directory); 00548 00556 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00557 00558 00565 void setFromMIME(const std::string & mimeMsg); 00566 00570 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00571 00581 void toFile(std::string directory); 00582 00586 bool loadInProgress; 00587 void checkPresenceInMemory() { 00588 if (!presentInMemory && !loadInProgress) { 00589 loadInProgress = true; 00590 setFromFile(getContainer().getDirectory()); 00591 presentInMemory = true; 00592 loadInProgress = false; 00593 } 00594 } 00603 void setFromFile(const std::string& directory); 00604 00605 }; 00606 00607 } // End namespace asdm 00608 00609 #endif /* SeeingTable_CLASS */