casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CalPointingTable.h
Go to the documentation of this file.
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 CalPointingTable.h
00032  */
00033  
00034 #ifndef CalPointingTable_CLASS
00035 #define CalPointingTable_CLASS
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 
00041 
00042 
00043         
00044 #include <ArrayTime.h>
00045         
00046 
00047         
00048 #include <Temperature.h>
00049         
00050 
00051         
00052 #include <Angle.h>
00053         
00054 
00055         
00056 #include <Tag.h>
00057         
00058 
00059         
00060 #include <Frequency.h>
00061         
00062 
00063 
00064 
00065 
00066         
00067 
00068         
00069 #include "CReceiverBand.h"
00070         
00071 
00072         
00073 
00074         
00075 
00076         
00077 
00078         
00079 #include "CAntennaMake.h"
00080         
00081 
00082         
00083 #include "CAtmPhaseCorrection.h"
00084         
00085 
00086         
00087 
00088         
00089 
00090         
00091 #include "CPointingModelMode.h"
00092         
00093 
00094         
00095 #include "CPointingMethod.h"
00096         
00097 
00098         
00099 
00100         
00101 #include "CPolarizationType.h"
00102         
00103 
00104         
00105 
00106         
00107 
00108         
00109 
00110         
00111 
00112         
00113 
00114         
00115 
00116         
00117 
00118         
00119 
00120         
00121 
00122         
00123 
00124         
00125 
00126         
00127 
00128         
00129 
00130         
00131 
00132         
00133 
00134         
00135 
00136         
00137 
00138         
00139 
00140 
00141 
00142 #include <ConversionException.h>
00143 #include <DuplicateKey.h>
00144 #include <UniquenessViolationException.h>
00145 #include <NoSuchRow.h>
00146 #include <DuplicateKey.h>
00147 
00148 
00149 #ifndef WITHOUT_ACS
00150 #include <asdmIDLC.h>
00151 #endif
00152 
00153 #include <Representable.h>
00154 
00155 namespace asdm {
00156 
00157 //class asdm::ASDM;
00158 //class asdm::CalPointingRow;
00159 
00160 class ASDM;
00161 class CalPointingRow;
00428 class CalPointingTable : public Representable {
00429         friend class ASDM;
00430 
00431 public:
00432 
00433 
00439         static std::vector<std::string> getKeyName();
00440 
00441 
00442         virtual ~CalPointingTable();
00443         
00449         ASDM &getContainer() const;
00450         
00456         unsigned int size() const;
00457         
00465         std::string getName() const;
00466         
00474         static std::string name() ;     
00475         
00480          std::string getVersion() const ;
00481         
00487          static const std::vector<std::string>& getAttributesNames();
00488 
00494          static const std::vector<std::string>& defaultAttributesNamesInBin();
00495          
00499         Entity getEntity() const;
00500 
00505         void setEntity(Entity e);
00506                 
00514         std::string toXML()  ;
00515 
00516 #ifndef WITHOUT_ACS
00517         // Conversion Methods
00523         asdmIDL::CalPointingTableIDL *toIDL() ;
00524 #endif
00525 
00526 #ifndef WITHOUT_ACS
00527 
00533         void fromIDL(asdmIDL::CalPointingTableIDL x) ;
00534 #endif
00535         
00536         //
00537         // ====> Row creation.
00538         //
00539         
00544         CalPointingRow *newRow();
00545         
00546         
00592         CalPointingRow *newRow(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, Temperature ambientTemperature, AntennaMakeMod::AntennaMake antennaMake, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, vector<Angle > direction, vector<Frequency > frequencyRange, PointingModelModeMod::PointingModelMode pointingModelMode, PointingMethodMod::PointingMethod pointingMethod, int numReceptor, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<Angle > > collOffsetRelative, vector<vector<Angle > > collOffsetAbsolute, vector<vector<Angle > > collError, vector<vector<bool > > collOffsetTied, vector<double > reducedChiSquared);
00593         
00594 
00595 
00608          CalPointingRow *newRow(CalPointingRow *row); 
00609 
00610         //
00611         // ====> Append a row to its table.
00612         //
00613  
00614         
00627         CalPointingRow* add(CalPointingRow* x) ; 
00628 
00629  
00630 
00631 
00632 
00633         //
00634         // ====> Methods returning rows.
00635         //
00636                 
00642         std::vector<CalPointingRow *> get() ;
00643         
00650          const std::vector<CalPointingRow *>& get() const ;
00651         
00652 
00653 
00654  
00655         
00671         CalPointingRow* getRowByKey(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
00672 
00673                 
00674 
00675 
00676 
00724         CalPointingRow* lookup(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, Temperature ambientTemperature, AntennaMakeMod::AntennaMake antennaMake, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, vector<Angle > direction, vector<Frequency > frequencyRange, PointingModelModeMod::PointingModelMode pointingModelMode, PointingMethodMod::PointingMethod pointingMethod, int numReceptor, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<vector<Angle > > collOffsetRelative, vector<vector<Angle > > collOffsetAbsolute, vector<vector<Angle > > collError, vector<vector<bool > > collOffsetTied, vector<double > reducedChiSquared); 
00725 
00726 
00727         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00728         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00729 
00730 private:
00731 
00740         CalPointingTable (ASDM & container);
00741 
00742         ASDM & container;
00743         
00744         bool archiveAsBin; // If true archive binary else archive XML
00745         bool fileAsBin ; // If true file binary else file XML   
00746         
00747         std::string version ; 
00748         
00749         Entity entity;
00750         
00751 
00752 
00756         static std::string itsName;
00757         
00761         static std::vector<std::string> attributesNames;
00762         
00766         static std::vector<std::string> attributesNamesInBin;
00767         
00768 
00772         static bool initAttributesNames(), initAttributesNamesDone ;
00773         
00774 
00778         static std::vector<std::string> key;
00779 
00780 
00788         CalPointingRow* checkAndAdd(CalPointingRow* x) ;
00789         
00795          void append(CalPointingRow* x) ;
00796          
00802          void addWithoutCheckingUnique(CalPointingRow* x) ;
00803          
00804          
00805 
00806 
00807 
00808 // A data structure to store the pointers on the table's rows.
00809 
00810 // In all cases we maintain a private vector of CalPointingRow s.
00811    std::vector<CalPointingRow * > privateRows;
00812    
00813 
00814                         
00815         std::vector<CalPointingRow *> row;
00816 
00817         
00818         void error() ; //throw(ConversionException);
00819 
00820         
00827         void fromXML(std::string& xmlDoc) ;
00828                 
00829         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00830 
00835         void setFromMIMEFile(const std::string& directory);
00836         /*
00837         void openMIMEFile(const std::string& directory);
00838         */
00839         void setFromXMLFile(const std::string& directory);
00840         
00848         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00849   
00850         
00857          void setFromMIME(const std::string & mimeMsg);
00858         
00862         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00863         
00873           void toFile(std::string directory);
00874           
00878           bool loadInProgress;
00879           void checkPresenceInMemory() {
00880                 if (!presentInMemory && !loadInProgress) {
00881                         loadInProgress = true;
00882                         setFromFile(getContainer().getDirectory());
00883                         presentInMemory = true;
00884                         loadInProgress = false;
00885                 }
00886           }
00895          void setFromFile(const std::string& directory);        
00896  
00897 };
00898 
00899 } // End namespace asdm
00900 
00901 #endif /* CalPointingTable_CLASS */