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 FeedTable.h 00032 */ 00033 00034 #ifndef FeedTable_CLASS 00035 #define FeedTable_CLASS 00036 00037 #include <string> 00038 #include <vector> 00039 #include <map> 00040 00041 00042 00043 00044 #include <Angle.h> 00045 00046 00047 00048 #include <Tag.h> 00049 00050 00051 00052 #include <Length.h> 00053 00054 00055 00056 #include <ArrayTimeInterval.h> 00057 00058 00059 00060 #include <ComplexWrapper.h> 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 00073 00074 00075 00076 00077 #include "CPolarizationType.h" 00078 00079 00080 00081 00082 00083 00084 00085 00086 00087 00088 00089 00090 00091 00092 #include <ConversionException.h> 00093 #include <DuplicateKey.h> 00094 #include <UniquenessViolationException.h> 00095 #include <NoSuchRow.h> 00096 #include <DuplicateKey.h> 00097 00098 00099 #ifndef WITHOUT_ACS 00100 #include <asdmIDLC.h> 00101 #endif 00102 00103 #include <Representable.h> 00104 00105 namespace asdm { 00106 00107 //class asdm::ASDM; 00108 //class asdm::FeedRow; 00109 00110 class ASDM; 00111 class FeedRow; 00245 class FeedTable : public Representable { 00246 friend class ASDM; 00247 00248 public: 00249 00250 00256 static std::vector<std::string> getKeyName(); 00257 00258 00259 virtual ~FeedTable(); 00260 00266 ASDM &getContainer() const; 00267 00273 unsigned int size() const; 00274 00282 std::string getName() const; 00283 00291 static std::string name() ; 00292 00297 std::string getVersion() const ; 00298 00304 static const std::vector<std::string>& getAttributesNames(); 00305 00311 static const std::vector<std::string>& defaultAttributesNamesInBin(); 00312 00316 Entity getEntity() const; 00317 00322 void setEntity(Entity e); 00323 00331 std::string toXML() ; 00332 00333 #ifndef WITHOUT_ACS 00334 // Conversion Methods 00340 asdmIDL::FeedTableIDL *toIDL() ; 00341 #endif 00342 00343 #ifndef WITHOUT_ACS 00344 00350 void fromIDL(asdmIDL::FeedTableIDL x) ; 00351 #endif 00352 00353 // 00354 // ====> Row creation. 00355 // 00356 00361 FeedRow *newRow(); 00362 00363 00389 FeedRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numReceptor, vector<vector<double > > beamOffset, vector<vector<Length > > focusReference, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<Complex > > polResponse, vector<Angle > receptorAngle, vector<int> receiverId); 00390 00391 00392 00405 FeedRow *newRow(FeedRow *row); 00406 00407 // 00408 // ====> Append a row to its table. 00409 // 00410 00411 00412 00413 00414 00424 FeedRow* add(FeedRow* x) ; 00425 00426 00427 00428 // 00429 // ====> Methods returning rows. 00430 // 00431 00437 std::vector<FeedRow *> get() ; 00438 00445 const std::vector<FeedRow *>& get() const ; 00446 00447 00448 00449 00450 00466 FeedRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId); 00467 00468 00469 00477 std::vector <FeedRow *> getRowByFeedId(int); 00478 00479 00480 00508 FeedRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int numReceptor, vector<vector<double > > beamOffset, vector<vector<Length > > focusReference, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<Complex > > polResponse, vector<Angle > receptorAngle, vector<int> receiverId); 00509 00510 00511 void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr); 00512 BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const; 00513 00514 private: 00515 00524 FeedTable (ASDM & container); 00525 00526 ASDM & container; 00527 00528 bool archiveAsBin; // If true archive binary else archive XML 00529 bool fileAsBin ; // If true file binary else file XML 00530 00531 std::string version ; 00532 00533 Entity entity; 00534 00535 00536 00540 static std::string itsName; 00541 00545 static std::vector<std::string> attributesNames; 00546 00550 static std::vector<std::string> attributesNamesInBin; 00551 00552 00556 static bool initAttributesNames(), initAttributesNamesDone ; 00557 00558 00562 static std::vector<std::string> key; 00563 00564 00574 FeedRow* checkAndAdd(FeedRow* x) ; 00575 00581 void append(FeedRow* x) ; 00582 00588 void addWithoutCheckingUnique(FeedRow* x) ; 00589 00590 00591 00592 00593 00594 00602 FeedRow * insertByStartTime(FeedRow* x, std::vector<FeedRow* >& row); 00603 00604 00605 00606 // A data structure to store the pointers on the table's rows. 00607 00608 // In all cases we maintain a private vector of FeedRow s. 00609 std::vector<FeedRow * > privateRows; 00610 00611 00612 00613 00614 00615 00616 00617 00618 typedef std::vector <std::vector <FeedRow* > > ID_TIME_ROWS; 00619 std::map<std::string, ID_TIME_ROWS > context; 00620 00625 std::string Key(Tag antennaId, Tag spectralWindowId) ; 00626 00627 00628 00629 00635 void getByKeyNoAutoIncNoTime(std::vector <FeedRow*>& vin, std::vector <FeedRow*>& vout, Tag antennaId, Tag spectralWindowId); 00636 00637 00638 00639 void error() ; //throw(ConversionException); 00640 00641 00648 void fromXML(std::string& xmlDoc) ; 00649 00650 std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors; 00651 00656 void setFromMIMEFile(const std::string& directory); 00657 /* 00658 void openMIMEFile(const std::string& directory); 00659 */ 00660 void setFromXMLFile(const std::string& directory); 00661 00669 std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00670 00671 00678 void setFromMIME(const std::string & mimeMsg); 00679 00683 std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity); 00684 00694 void toFile(std::string directory); 00695 00699 bool loadInProgress; 00700 void checkPresenceInMemory() { 00701 if (!presentInMemory && !loadInProgress) { 00702 loadInProgress = true; 00703 setFromFile(getContainer().getDirectory()); 00704 presentInMemory = true; 00705 loadInProgress = false; 00706 } 00707 } 00716 void setFromFile(const std::string& directory); 00717 00718 }; 00719 00720 } // End namespace asdm 00721 00722 #endif /* FeedTable_CLASS */