casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CalFocusTable.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 CalFocusTable.h
00032  */
00033  
00034 #ifndef CalFocusTable_CLASS
00035 #define CalFocusTable_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 <Length.h>
00061         
00062 
00063         
00064 #include <Frequency.h>
00065         
00066 
00067 
00068 
00069 
00070         
00071 
00072         
00073 
00074         
00075 
00076         
00077 #include "CReceiverBand.h"
00078         
00079 
00080         
00081 
00082         
00083 #include "CAtmPhaseCorrection.h"
00084         
00085 
00086         
00087 #include "CFocusMethod.h"
00088         
00089 
00090         
00091 
00092         
00093 
00094         
00095 
00096         
00097 #include "CPolarizationType.h"
00098         
00099 
00100         
00101 
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 #include <ConversionException.h>
00135 #include <DuplicateKey.h>
00136 #include <UniquenessViolationException.h>
00137 #include <NoSuchRow.h>
00138 #include <DuplicateKey.h>
00139 
00140 
00141 #ifndef WITHOUT_ACS
00142 #include <asdmIDLC.h>
00143 #endif
00144 
00145 #include <Representable.h>
00146 
00147 namespace asdm {
00148 
00149 //class asdm::ASDM;
00150 //class asdm::CalFocusRow;
00151 
00152 class ASDM;
00153 class CalFocusRow;
00392 class CalFocusTable : public Representable {
00393         friend class ASDM;
00394 
00395 public:
00396 
00397 
00403         static std::vector<std::string> getKeyName();
00404 
00405 
00406         virtual ~CalFocusTable();
00407         
00413         ASDM &getContainer() const;
00414         
00420         unsigned int size() const;
00421         
00429         std::string getName() const;
00430         
00438         static std::string name() ;     
00439         
00444          std::string getVersion() const ;
00445         
00451          static const std::vector<std::string>& getAttributesNames();
00452 
00458          static const std::vector<std::string>& defaultAttributesNamesInBin();
00459          
00463         Entity getEntity() const;
00464 
00469         void setEntity(Entity e);
00470                 
00478         std::string toXML()  ;
00479 
00480 #ifndef WITHOUT_ACS
00481         // Conversion Methods
00487         asdmIDL::CalFocusTableIDL *toIDL() ;
00488 #endif
00489 
00490 #ifndef WITHOUT_ACS
00491 
00497         void fromIDL(asdmIDL::CalFocusTableIDL x) ;
00498 #endif
00499         
00500         //
00501         // ====> Row creation.
00502         //
00503         
00508         CalFocusRow *newRow();
00509         
00510         
00554         CalFocusRow *newRow(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, Temperature ambientTemperature, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, FocusMethodMod::FocusMethod focusMethod, vector<Frequency > frequencyRange, vector<Angle > pointingDirection, int numReceptor, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<bool > wereFixed, vector<vector<Length > > offset, vector<vector<Length > > offsetError, vector<vector<bool > > offsetWasTied, vector<vector<double > > reducedChiSquared, vector<vector<Length > > position);
00555         
00556 
00557 
00570          CalFocusRow *newRow(CalFocusRow *row); 
00571 
00572         //
00573         // ====> Append a row to its table.
00574         //
00575  
00576         
00589         CalFocusRow* add(CalFocusRow* x) ; 
00590 
00591  
00592 
00593 
00594 
00595         //
00596         // ====> Methods returning rows.
00597         //
00598                 
00604         std::vector<CalFocusRow *> get() ;
00605         
00612          const std::vector<CalFocusRow *>& get() const ;
00613         
00614 
00615 
00616  
00617         
00633         CalFocusRow* getRowByKey(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
00634 
00635                 
00636 
00637 
00638 
00684         CalFocusRow* lookup(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, Temperature ambientTemperature, AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, FocusMethodMod::FocusMethod focusMethod, vector<Frequency > frequencyRange, vector<Angle > pointingDirection, int numReceptor, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, vector<bool > wereFixed, vector<vector<Length > > offset, vector<vector<Length > > offsetError, vector<vector<bool > > offsetWasTied, vector<vector<double > > reducedChiSquared, vector<vector<Length > > position); 
00685 
00686 
00687         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00688         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00689 
00690 private:
00691 
00700         CalFocusTable (ASDM & container);
00701 
00702         ASDM & container;
00703         
00704         bool archiveAsBin; // If true archive binary else archive XML
00705         bool fileAsBin ; // If true file binary else file XML   
00706         
00707         std::string version ; 
00708         
00709         Entity entity;
00710         
00711 
00712 
00716         static std::string itsName;
00717         
00721         static std::vector<std::string> attributesNames;
00722         
00726         static std::vector<std::string> attributesNamesInBin;
00727         
00728 
00732         static bool initAttributesNames(), initAttributesNamesDone ;
00733         
00734 
00738         static std::vector<std::string> key;
00739 
00740 
00748         CalFocusRow* checkAndAdd(CalFocusRow* x) ;
00749         
00755          void append(CalFocusRow* x) ;
00756          
00762          void addWithoutCheckingUnique(CalFocusRow* x) ;
00763          
00764          
00765 
00766 
00767 
00768 // A data structure to store the pointers on the table's rows.
00769 
00770 // In all cases we maintain a private vector of CalFocusRow s.
00771    std::vector<CalFocusRow * > privateRows;
00772    
00773 
00774                         
00775         std::vector<CalFocusRow *> row;
00776 
00777         
00778         void error() ; //throw(ConversionException);
00779 
00780         
00787         void fromXML(std::string& xmlDoc) ;
00788                 
00789         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00790 
00795         void setFromMIMEFile(const std::string& directory);
00796         /*
00797         void openMIMEFile(const std::string& directory);
00798         */
00799         void setFromXMLFile(const std::string& directory);
00800         
00808         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00809   
00810         
00817          void setFromMIME(const std::string & mimeMsg);
00818         
00822         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00823         
00833           void toFile(std::string directory);
00834           
00838           bool loadInProgress;
00839           void checkPresenceInMemory() {
00840                 if (!presentInMemory && !loadInProgress) {
00841                         loadInProgress = true;
00842                         setFromFile(getContainer().getDirectory());
00843                         presentInMemory = true;
00844                         loadInProgress = false;
00845                 }
00846           }
00855          void setFromFile(const std::string& directory);        
00856  
00857 };
00858 
00859 } // End namespace asdm
00860 
00861 #endif /* CalFocusTable_CLASS */