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 FreqOffsetTable.h 00032 */ 00033 00034 #ifndef FreqOffsetTable_CLASS 00035 #define FreqOffsetTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 00041 00042 00043 00044 #include <Tag.h> 00045 00046 00047 00048 #include <Frequency.h> 00049 00050 00051 00052 #include <ArrayTimeInterval.h> 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 #include <ConversionException.h> 00065 #include <DuplicateKey.h> 00066 #include <UniquenessViolationException.h> 00067 #include <NoSuchRow.h> 00068 #include <DuplicateKey.h> 00069 00070 00071 #ifndef WITHOUT_ACS 00072 #include <asdmIDLC.h> 00073 #endif 00074 00075 #include <Representable.h> 00076 00077 #include <pthread.h> 00078 00079 namespace asdm { 00080 00081 //class asdm::ASDM; 00082 //class asdm::FreqOffsetRow; 00083 00084 class ASDM; 00085 class FreqOffsetRow; 00153 class FreqOffsetTable : public Representable { 00154 friend class ASDM; 00155 00156 public: 00157 00158 00164 static const std::vector<std::string>& getKeyName(); 00165 00166 00167 virtual ~FreqOffsetTable(); 00168 00174 ASDM &getContainer() const; 00175 00181 unsigned int size() const; 00182 00190 std::string getName() const; 00191 00199 static std::string name() ; 00200 00205 std::string getVersion() const ; 00206 00212 static const std::vector<std::string>& getAttributesNames(); 00213 00219 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00220 00224 Entity getEntity() const; 00225 00230 void setEntity(Entity e); 00231 00239 std::string toXML() ; 00240 00241 #ifndef WITHOUT_ACS 00242 // Conversion Methods 00248 asdmIDL::FreqOffsetTableIDL *toIDL() ; 00249 00257 void toIDL(asdmIDL::FreqOffsetTableIDL& x) const; 00258 00259 #endif 00260 00261 #ifndef WITHOUT_ACS 00262 00268 void fromIDL(asdmIDL::FreqOffsetTableIDL x) ; 00269 #endif 00270 00271 // 00272 // ====> Row creation. 00273 // 00274 00279 FreqOffsetRow *newRow(); 00280 00281 00297 FreqOffsetRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, Frequency offset); 00298 00299 00300 00313 FreqOffsetRow *newRow(FreqOffsetRow *row); 00314 00315 // 00316 // ====> Append a row to its table. 00317 // 00318 00319 00336 FreqOffsetRow* add(FreqOffsetRow* x) ; 00337 00338 00339 00340 00341 00342 // 00343 // ====> Methods returning rows. 00344 // 00345 00351 std::vector<FreqOffsetRow *> get() ; 00352 00359 const std::vector<FreqOffsetRow *>& get() const ; 00360 00361 00372 std::vector <FreqOffsetRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId); 00373 00374 00375 00376 00377 00393 FreqOffsetRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId); 00394 00395 00396 00397 00398 00416 FreqOffsetRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, Frequency offset); 00417 00418 00419 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00420 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00421 00422 private: 00423 00432 FreqOffsetTable (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 00452 FreqOffsetRow* checkAndAdd(FreqOffsetRow* x, bool skipCheckUniqueness=false) ; 00453 00459 void append(FreqOffsetRow* x) ; 00460 00466 void addWithoutCheckingUnique(FreqOffsetRow* x) ; 00467 00468 00469 00470 00471 00472 00480 FreqOffsetRow * insertByStartTime(FreqOffsetRow* x, std::vector<FreqOffsetRow* >& row); 00481 00482 00483 00484 // A data structure to store the pointers on the table's rows. 00485 00486 // In all cases we maintain a private vector of FreqOffsetRow s. 00487 std::vector<FreqOffsetRow * > privateRows; 00488 00489 00490 00491 00492 00493 00494 00495 00496 typedef std::vector <FreqOffsetRow* > TIME_ROWS; 00497 std::map<std::string, TIME_ROWS > context; 00498 00503 std::string Key(Tag antennaId, Tag spectralWindowId, int feedId) ; 00504 00505 00506 00507 00513 void getByKeyNoAutoIncNoTime(std::vector <FreqOffsetRow*>& vin, std::vector <FreqOffsetRow*>& vout, Tag antennaId, Tag spectralWindowId, int feedId); 00514 00515 00516 00517 void error() ; //throw(ConversionException); 00518 00519 00526 void fromXML(std::string& xmlDoc) ; 00527 00528 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00529 00534 void setFromMIMEFile(const std::string& directory); 00535 /* 00536 void openMIMEFile(const std::string& directory); 00537 */ 00538 void setFromXMLFile(const std::string& directory); 00539 00547 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00548 00549 00556 void setFromMIME(const std::string & mimeMsg); 00557 00561 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00562 00572 void toFile(std::string directory); 00573 00577 bool loadInProgress; 00578 void checkPresenceInMemory() { 00579 if (!presentInMemory && !loadInProgress) { 00580 loadInProgress = true; 00581 setFromFile(getContainer().getDirectory()); 00582 presentInMemory = true; 00583 loadInProgress = false; 00584 } 00585 } 00594 void setFromFile(const std::string& directory); 00595 00596 }; 00597 00598 } // End namespace asdm 00599 00600 #endif /* FreqOffsetTable_CLASS */