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 PointingTable.h 00032 */ 00033 00034 #ifndef PointingTable_CLASS 00035 #define PointingTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 00041 00042 00043 00044 #include <ArrayTime.h> 00045 00046 00047 00048 #include <Angle.h> 00049 00050 00051 00052 #include <Tag.h> 00053 00054 00055 00056 #include <ArrayTimeInterval.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 #include "CDirectionReferenceCode.h" 00088 00089 00090 00091 00092 00093 00094 00095 00096 00097 00098 #include <ConversionException.h> 00099 #include <DuplicateKey.h> 00100 #include <UniquenessViolationException.h> 00101 #include <NoSuchRow.h> 00102 #include <DuplicateKey.h> 00103 00104 00105 #ifndef WITHOUT_ACS 00106 #include <asdmIDLC.h> 00107 #endif 00108 00109 #include <Representable.h> 00110 00111 namespace asdm { 00112 00113 //class asdm::ASDM; 00114 //class asdm::PointingRow; 00115 00116 class ASDM; 00117 class PointingRow; 00275 class PointingTable : public Representable { 00276 friend class ASDM; 00277 00278 public: 00279 00280 00286 static std::vector<std::string> getKeyName(); 00287 00288 00289 virtual ~PointingTable(); 00290 00296 ASDM &getContainer() const; 00297 00303 unsigned int size() const; 00304 00312 std::string getName() const; 00313 00321 static std::string name() ; 00322 00327 std::string getVersion() const ; 00328 00334 static const std::vector<std::string>& getAttributesNames(); 00335 00341 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00342 00346 Entity getEntity() const; 00347 00352 void setEntity(Entity e); 00353 00361 std::string toXML() ; 00362 00363 #ifndef WITHOUT_ACS 00364 // Conversion Methods 00370 asdmIDL::PointingTableIDL *toIDL() ; 00371 #endif 00372 00373 #ifndef WITHOUT_ACS 00374 00380 void fromIDL(asdmIDL::PointingTableIDL x) ; 00381 #endif 00382 00383 // 00384 // ====> Row creation. 00385 // 00386 00391 PointingRow *newRow(); 00392 00393 00423 PointingRow *newRow(Tag antennaId, ArrayTimeInterval timeInterval, int numSample, vector<vector<Angle > > encoder, bool pointingTracking, bool usePolynomials, ArrayTime timeOrigin, int numTerm, vector<vector<Angle > > pointingDirection, vector<vector<Angle > > target, vector<vector<Angle > > offset, int pointingModelId); 00424 00425 00426 00439 PointingRow *newRow(PointingRow *row); 00440 00441 // 00442 // ====> Append a row to its table. 00443 // 00444 00445 00462 PointingRow* add(PointingRow* x) ; 00463 00464 00465 00466 00467 00468 // 00469 // ====> Methods returning rows. 00470 // 00471 00477 std::vector<PointingRow *> get() ; 00478 00485 const std::vector<PointingRow *>& get() const ; 00486 00487 00498 std::vector <PointingRow*> *getByContext(Tag antennaId); 00499 00500 00501 00502 00503 00515 PointingRow* getRowByKey(Tag antennaId, ArrayTimeInterval timeInterval); 00516 00517 00518 00519 00520 00552 PointingRow* lookup(Tag antennaId, ArrayTimeInterval timeInterval, int numSample, vector<vector<Angle > > encoder, bool pointingTracking, bool usePolynomials, ArrayTime timeOrigin, int numTerm, vector<vector<Angle > > pointingDirection, vector<vector<Angle > > target, vector<vector<Angle > > offset, int pointingModelId); 00553 00554 00555 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00556 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00557 00558 private: 00559 00568 PointingTable (ASDM & container); 00569 00570 ASDM & container; 00571 00572 bool archiveAsBin; // If true archive binary else archive XML 00573 bool fileAsBin ; // If true file binary else file XML 00574 00575 std::string version ; 00576 00577 Entity entity; 00578 00579 00580 00584 static std::string itsName; 00585 00589 static std::vector<std::string> attributesNames; 00590 00594 static std::vector<std::string> attributesNamesInBin; 00595 00596 00600 static bool initAttributesNames(), initAttributesNamesDone ; 00601 00602 00606 static std::vector<std::string> key; 00607 00608 00616 PointingRow* checkAndAdd(PointingRow* x) ; 00617 00623 void append(PointingRow* x) ; 00624 00630 void addWithoutCheckingUnique(PointingRow* x) ; 00631 00632 00633 00634 00635 00636 00644 PointingRow * insertByStartTime(PointingRow* x, std::vector<PointingRow* >& row); 00645 00646 00647 00648 // A data structure to store the pointers on the table's rows. 00649 00650 // In all cases we maintain a private vector of PointingRow s. 00651 std::vector<PointingRow * > privateRows; 00652 00653 00654 00655 00656 00657 00658 00659 00660 typedef std::vector <PointingRow* > TIME_ROWS; 00661 std::map<std::string, TIME_ROWS > context; 00662 00667 std::string Key(Tag antennaId) ; 00668 00669 00670 00671 00677 void getByKeyNoAutoIncNoTime(std::vector <PointingRow*>& vin, std::vector <PointingRow*>& vout, Tag antennaId); 00678 00679 00680 00681 void error() ; //throw(ConversionException); 00682 00683 00690 void fromXML(std::string& xmlDoc) ; 00691 00692 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00693 00698 void setFromMIMEFile(const std::string& directory); 00699 /* 00700 void openMIMEFile(const std::string& directory); 00701 */ 00702 void setFromXMLFile(const std::string& directory); 00703 00711 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00712 00713 00720 void setFromMIME(const std::string & mimeMsg); 00721 00725 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00726 00736 void toFile(std::string directory); 00737 00741 bool loadInProgress; 00742 void checkPresenceInMemory() { 00743 if (!presentInMemory && !loadInProgress) { 00744 loadInProgress = true; 00745 setFromFile(getContainer().getDirectory()); 00746 presentInMemory = true; 00747 loadInProgress = false; 00748 } 00749 } 00758 void setFromFile(const std::string& directory); 00759 00760 }; 00761 00762 } // End namespace asdm 00763 00764 #endif /* PointingTable_CLASS */