casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CalPointingModelTable.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 CalPointingModelTable.h
00032  */
00033  
00034 #ifndef CalPointingModelTable_CLASS
00035 #define CalPointingModelTable_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 
00057 
00058         
00059 
00060         
00061 #include "CReceiverBand.h"
00062         
00063 
00064         
00065 
00066         
00067 
00068         
00069 #include "CAntennaMake.h"
00070         
00071 
00072         
00073 #include "CPointingModelMode.h"
00074         
00075 
00076         
00077 #include "CPolarizationType.h"
00078         
00079 
00080         
00081 
00082         
00083 
00084         
00085 
00086         
00087 
00088         
00089 
00090         
00091 
00092         
00093 
00094         
00095 
00096         
00097 
00098         
00099 
00100         
00101 
00102 
00103 
00104 #include <ConversionException.h>
00105 #include <DuplicateKey.h>
00106 #include <UniquenessViolationException.h>
00107 #include <NoSuchRow.h>
00108 #include <DuplicateKey.h>
00109 
00110 
00111 #ifndef WITHOUT_ACS
00112 #include <asdmIDLC.h>
00113 #endif
00114 
00115 #include <Representable.h>
00116 
00117 #include <pthread.h>
00118 
00119 namespace asdm {
00120 
00121 //class asdm::ASDM;
00122 //class asdm::CalPointingModelRow;
00123 
00124 class ASDM;
00125 class CalPointingModelRow;
00301 class CalPointingModelTable : public Representable {
00302         friend class ASDM;
00303 
00304 public:
00305 
00306 
00312         static const std::vector<std::string>& getKeyName();
00313 
00314 
00315         virtual ~CalPointingModelTable();
00316         
00322         ASDM &getContainer() const;
00323         
00329         unsigned int size() const;
00330         
00338         std::string getName() const;
00339         
00347         static std::string name() ;     
00348         
00353          std::string getVersion() const ;
00354         
00360          static const std::vector<std::string>& getAttributesNames();
00361 
00367          static const std::vector<std::string>& defaultAttributesNamesInBin();
00368          
00372         Entity getEntity() const;
00373 
00378         void setEntity(Entity e);
00379                 
00387         std::string toXML()  ;
00388 
00389 #ifndef WITHOUT_ACS
00390         // Conversion Methods
00396         asdmIDL::CalPointingModelTableIDL *toIDL() ;
00397         
00405          void toIDL(asdmIDL::CalPointingModelTableIDL& x) const;
00406          
00407 #endif
00408 
00409 #ifndef WITHOUT_ACS
00410 
00416         void fromIDL(asdmIDL::CalPointingModelTableIDL x) ;
00417 #endif
00418         
00419         //
00420         // ====> Row creation.
00421         //
00422         
00427         CalPointingModelRow *newRow();
00428         
00429         
00471         CalPointingModelRow *newRow(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, PointingModelModeMod::PointingModelMode pointingModelMode, PolarizationTypeMod::PolarizationType polarizationType, int numCoeff, vector<string > coeffName, vector<float > coeffVal, vector<float > coeffError, vector<bool > coeffFixed, Angle azimuthRMS, Angle elevationRms, Angle skyRMS, double reducedChiSquared);
00472         
00473 
00474 
00487          CalPointingModelRow *newRow(CalPointingModelRow *row); 
00488 
00489         //
00490         // ====> Append a row to its table.
00491         //
00492  
00493         
00506         CalPointingModelRow* add(CalPointingModelRow* x) ; 
00507 
00508  
00509 
00510 
00511 
00512         //
00513         // ====> Methods returning rows.
00514         //
00515                 
00521         std::vector<CalPointingModelRow *> get() ;
00522         
00529          const std::vector<CalPointingModelRow *>& get() const ;
00530         
00531 
00532 
00533  
00534         
00550         CalPointingModelRow* getRowByKey(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
00551 
00552                 
00553 
00554 
00555 
00599         CalPointingModelRow* lookup(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, AntennaMakeMod::AntennaMake antennaMake, PointingModelModeMod::PointingModelMode pointingModelMode, PolarizationTypeMod::PolarizationType polarizationType, int numCoeff, vector<string > coeffName, vector<float > coeffVal, vector<float > coeffError, vector<bool > coeffFixed, Angle azimuthRMS, Angle elevationRms, Angle skyRMS, double reducedChiSquared); 
00600 
00601 
00602         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00603         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00604 
00605 private:
00606 
00615         CalPointingModelTable (ASDM & container);
00616 
00617         ASDM & container;
00618         
00619         bool archiveAsBin; // If true archive binary else archive XML
00620         bool fileAsBin ; // If true file binary else file XML   
00621         
00622         std::string version ; 
00623         
00624         Entity entity;
00625         
00626 
00627 
00635         CalPointingModelRow* checkAndAdd(CalPointingModelRow* x, bool skipCheckUniqueness=false) ;
00636         
00642          void append(CalPointingModelRow* x) ;
00643          
00649          void addWithoutCheckingUnique(CalPointingModelRow* x) ;
00650          
00651          
00652 
00653 
00654 
00655 // A data structure to store the pointers on the table's rows.
00656 
00657 // In all cases we maintain a private vector of CalPointingModelRow s.
00658    std::vector<CalPointingModelRow * > privateRows;
00659    
00660 
00661                         
00662         std::vector<CalPointingModelRow *> row;
00663 
00664         
00665         void error() ; //throw(ConversionException);
00666 
00667         
00674         void fromXML(std::string& xmlDoc) ;
00675                 
00676         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00677 
00682         void setFromMIMEFile(const std::string& directory);
00683         /*
00684         void openMIMEFile(const std::string& directory);
00685         */
00686         void setFromXMLFile(const std::string& directory);
00687         
00695         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00696   
00697         
00704          void setFromMIME(const std::string & mimeMsg);
00705         
00709         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00710         
00720           void toFile(std::string directory);
00721           
00725           bool loadInProgress;
00726           void checkPresenceInMemory() {
00727                 if (!presentInMemory && !loadInProgress) {
00728                         loadInProgress = true;
00729                         setFromFile(getContainer().getDirectory());
00730                         presentInMemory = true;
00731                         loadInProgress = false;
00732                 }
00733           }
00742          void setFromFile(const std::string& directory);        
00743  
00744 };
00745 
00746 } // End namespace asdm
00747 
00748 #endif /* CalPointingModelTable_CLASS */