casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CalHolographyTable.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 CalHolographyTable.h
00032  */
00033  
00034 #ifndef CalHolographyTable_CLASS
00035 #define CalHolographyTable_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 #include <EntityRef.h>
00069         
00070 
00071 
00072 
00073 
00074         
00075 
00076         
00077 #include "CAntennaMake.h"
00078         
00079 
00080         
00081 
00082         
00083 
00084         
00085 
00086         
00087 
00088         
00089 
00090         
00091 
00092         
00093 
00094         
00095 #include "CPolarizationType.h"
00096         
00097 
00098         
00099 
00100         
00101 #include "CReceiverBand.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 #include <ConversionException.h>
00133 #include <DuplicateKey.h>
00134 #include <UniquenessViolationException.h>
00135 #include <NoSuchRow.h>
00136 #include <DuplicateKey.h>
00137 
00138 
00139 #ifndef WITHOUT_ACS
00140 #include <asdmIDLC.h>
00141 #endif
00142 
00143 #include <Representable.h>
00144 
00145 namespace asdm {
00146 
00147 //class asdm::ASDM;
00148 //class asdm::CalHolographyRow;
00149 
00150 class ASDM;
00151 class CalHolographyRow;
00374 class CalHolographyTable : public Representable {
00375         friend class ASDM;
00376 
00377 public:
00378 
00379 
00385         static std::vector<std::string> getKeyName();
00386 
00387 
00388         virtual ~CalHolographyTable();
00389         
00395         ASDM &getContainer() const;
00396         
00402         unsigned int size() const;
00403         
00411         std::string getName() const;
00412         
00420         static std::string name() ;     
00421         
00426          std::string getVersion() const ;
00427         
00433          static const std::vector<std::string>& getAttributesNames();
00434 
00440          static const std::vector<std::string>& defaultAttributesNamesInBin();
00441          
00445         Entity getEntity() const;
00446 
00451         void setEntity(Entity e);
00452                 
00460         std::string toXML()  ;
00461 
00462 #ifndef WITHOUT_ACS
00463         // Conversion Methods
00469         asdmIDL::CalHolographyTableIDL *toIDL() ;
00470 #endif
00471 
00472 #ifndef WITHOUT_ACS
00473 
00479         void fromIDL(asdmIDL::CalHolographyTableIDL x) ;
00480 #endif
00481         
00482         //
00483         // ====> Row creation.
00484         //
00485         
00490         CalHolographyRow *newRow();
00491         
00492         
00536         CalHolographyRow *newRow(string antennaName, Tag calDataId, Tag calReductionId, AntennaMakeMod::AntennaMake antennaMake, ArrayTime startValidTime, ArrayTime endValidTime, Temperature ambientTemperature, vector<Length > focusPosition, vector<Frequency > frequencyRange, double illuminationTaper, int numReceptor, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, int numPanelModes, ReceiverBandMod::ReceiverBand receiverBand, EntityRef beamMapUID, Length rawRMS, Length weightedRMS, EntityRef surfaceMapUID, vector<Angle > direction);
00537         
00538 
00539 
00552          CalHolographyRow *newRow(CalHolographyRow *row); 
00553 
00554         //
00555         // ====> Append a row to its table.
00556         //
00557  
00558         
00571         CalHolographyRow* add(CalHolographyRow* x) ; 
00572 
00573  
00574 
00575 
00576 
00577         //
00578         // ====> Methods returning rows.
00579         //
00580                 
00586         std::vector<CalHolographyRow *> get() ;
00587         
00594          const std::vector<CalHolographyRow *>& get() const ;
00595         
00596 
00597 
00598  
00599         
00613         CalHolographyRow* getRowByKey(string antennaName, Tag calDataId, Tag calReductionId);
00614 
00615                 
00616 
00617 
00618 
00664         CalHolographyRow* lookup(string antennaName, Tag calDataId, Tag calReductionId, AntennaMakeMod::AntennaMake antennaMake, ArrayTime startValidTime, ArrayTime endValidTime, Temperature ambientTemperature, vector<Length > focusPosition, vector<Frequency > frequencyRange, double illuminationTaper, int numReceptor, vector<PolarizationTypeMod::PolarizationType > polarizationTypes, int numPanelModes, ReceiverBandMod::ReceiverBand receiverBand, EntityRef beamMapUID, Length rawRMS, Length weightedRMS, EntityRef surfaceMapUID, vector<Angle > direction); 
00665 
00666 
00667         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00668         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00669 
00670 private:
00671 
00680         CalHolographyTable (ASDM & container);
00681 
00682         ASDM & container;
00683         
00684         bool archiveAsBin; // If true archive binary else archive XML
00685         bool fileAsBin ; // If true file binary else file XML   
00686         
00687         std::string version ; 
00688         
00689         Entity entity;
00690         
00691 
00692 
00696         static std::string itsName;
00697         
00701         static std::vector<std::string> attributesNames;
00702         
00706         static std::vector<std::string> attributesNamesInBin;
00707         
00708 
00712         static bool initAttributesNames(), initAttributesNamesDone ;
00713         
00714 
00718         static std::vector<std::string> key;
00719 
00720 
00728         CalHolographyRow* checkAndAdd(CalHolographyRow* x) ;
00729         
00735          void append(CalHolographyRow* x) ;
00736          
00742          void addWithoutCheckingUnique(CalHolographyRow* x) ;
00743          
00744          
00745 
00746 
00747 
00748 // A data structure to store the pointers on the table's rows.
00749 
00750 // In all cases we maintain a private vector of CalHolographyRow s.
00751    std::vector<CalHolographyRow * > privateRows;
00752    
00753 
00754                         
00755         std::vector<CalHolographyRow *> row;
00756 
00757         
00758         void error() ; //throw(ConversionException);
00759 
00760         
00767         void fromXML(std::string& xmlDoc) ;
00768                 
00769         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00770 
00775         void setFromMIMEFile(const std::string& directory);
00776         /*
00777         void openMIMEFile(const std::string& directory);
00778         */
00779         void setFromXMLFile(const std::string& directory);
00780         
00788         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00789   
00790         
00797          void setFromMIME(const std::string & mimeMsg);
00798         
00802         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00803         
00813           void toFile(std::string directory);
00814           
00818           bool loadInProgress;
00819           void checkPresenceInMemory() {
00820                 if (!presentInMemory && !loadInProgress) {
00821                         loadInProgress = true;
00822                         setFromFile(getContainer().getDirectory());
00823                         presentInMemory = true;
00824                         loadInProgress = false;
00825                 }
00826           }
00835          void setFromFile(const std::string& directory);        
00836  
00837 };
00838 
00839 } // End namespace asdm
00840 
00841 #endif /* CalHolographyTable_CLASS */