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 namespace asdm {
00118 
00119 //class asdm::ASDM;
00120 //class asdm::CalPointingModelRow;
00121 
00122 class ASDM;
00123 class CalPointingModelRow;
00299 class CalPointingModelTable : public Representable {
00300         friend class ASDM;
00301 
00302 public:
00303 
00304 
00310         static std::vector<std::string> getKeyName();
00311 
00312 
00313         virtual ~CalPointingModelTable();
00314         
00320         ASDM &getContainer() const;
00321         
00327         unsigned int size() const;
00328         
00336         std::string getName() const;
00337         
00345         static std::string name() ;     
00346         
00351          std::string getVersion() const ;
00352         
00358          static const std::vector<std::string>& getAttributesNames();
00359 
00365          static const std::vector<std::string>& defaultAttributesNamesInBin();
00366          
00370         Entity getEntity() const;
00371 
00376         void setEntity(Entity e);
00377                 
00385         std::string toXML()  ;
00386 
00387 #ifndef WITHOUT_ACS
00388         // Conversion Methods
00394         asdmIDL::CalPointingModelTableIDL *toIDL() ;
00395 #endif
00396 
00397 #ifndef WITHOUT_ACS
00398 
00404         void fromIDL(asdmIDL::CalPointingModelTableIDL x) ;
00405 #endif
00406         
00407         //
00408         // ====> Row creation.
00409         //
00410         
00415         CalPointingModelRow *newRow();
00416         
00417         
00459         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);
00460         
00461 
00462 
00475          CalPointingModelRow *newRow(CalPointingModelRow *row); 
00476 
00477         //
00478         // ====> Append a row to its table.
00479         //
00480  
00481         
00494         CalPointingModelRow* add(CalPointingModelRow* x) ; 
00495 
00496  
00497 
00498 
00499 
00500         //
00501         // ====> Methods returning rows.
00502         //
00503                 
00509         std::vector<CalPointingModelRow *> get() ;
00510         
00517          const std::vector<CalPointingModelRow *>& get() const ;
00518         
00519 
00520 
00521  
00522         
00538         CalPointingModelRow* getRowByKey(string antennaName, ReceiverBandMod::ReceiverBand receiverBand, Tag calDataId, Tag calReductionId);
00539 
00540                 
00541 
00542 
00543 
00587         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); 
00588 
00589 
00590         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00591         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00592 
00593 private:
00594 
00603         CalPointingModelTable (ASDM & container);
00604 
00605         ASDM & container;
00606         
00607         bool archiveAsBin; // If true archive binary else archive XML
00608         bool fileAsBin ; // If true file binary else file XML   
00609         
00610         std::string version ; 
00611         
00612         Entity entity;
00613         
00614 
00615 
00619         static std::string itsName;
00620         
00624         static std::vector<std::string> attributesNames;
00625         
00629         static std::vector<std::string> attributesNamesInBin;
00630         
00631 
00635         static bool initAttributesNames(), initAttributesNamesDone ;
00636         
00637 
00641         static std::vector<std::string> key;
00642 
00643 
00651         CalPointingModelRow* checkAndAdd(CalPointingModelRow* x) ;
00652         
00658          void append(CalPointingModelRow* x) ;
00659          
00665          void addWithoutCheckingUnique(CalPointingModelRow* x) ;
00666          
00667          
00668 
00669 
00670 
00671 // A data structure to store the pointers on the table's rows.
00672 
00673 // In all cases we maintain a private vector of CalPointingModelRow s.
00674    std::vector<CalPointingModelRow * > privateRows;
00675    
00676 
00677                         
00678         std::vector<CalPointingModelRow *> row;
00679 
00680         
00681         void error() ; //throw(ConversionException);
00682 
00683         
00690         void fromXML(std::string& xmlDoc) ;
00691                 
00692         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00693 
00698         void setFromMIMEFile(const std::string& directory);
00699         /*
00700         void openMIMEFile(const std::string& directory);
00701         */
00702         void setFromXMLFile(const std::string& directory);
00703         
00711         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00712   
00713         
00720          void setFromMIME(const std::string & mimeMsg);
00721         
00725         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00726         
00736           void toFile(std::string directory);
00737           
00741           bool loadInProgress;
00742           void checkPresenceInMemory() {
00743                 if (!presentInMemory && !loadInProgress) {
00744                         loadInProgress = true;
00745                         setFromFile(getContainer().getDirectory());
00746                         presentInMemory = true;
00747                         loadInProgress = false;
00748                 }
00749           }
00758          void setFromFile(const std::string& directory);        
00759  
00760 };
00761 
00762 } // End namespace asdm
00763 
00764 #endif /* CalPointingModelTable_CLASS */