casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
CalSeeingTable.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 CalSeeingTable.h
00032  */
00033  
00034 #ifndef CalSeeingTable_CLASS
00035 #define CalSeeingTable_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 <Interval.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 #include "CAtmPhaseCorrection.h"
00072         
00073 
00074         
00075 
00076         
00077 
00078         
00079 
00080         
00081 
00082         
00083 
00084         
00085 
00086         
00087 
00088         
00089 
00090         
00091 
00092         
00093 
00094         
00095 
00096         
00097 
00098 
00099 
00100 #include <ConversionException.h>
00101 #include <DuplicateKey.h>
00102 #include <UniquenessViolationException.h>
00103 #include <NoSuchRow.h>
00104 #include <DuplicateKey.h>
00105 
00106 
00107 #ifndef WITHOUT_ACS
00108 #include <asdmIDLC.h>
00109 #endif
00110 
00111 #include <Representable.h>
00112 
00113 namespace asdm {
00114 
00115 //class asdm::ASDM;
00116 //class asdm::CalSeeingRow;
00117 
00118 class ASDM;
00119 class CalSeeingRow;
00258 class CalSeeingTable : public Representable {
00259         friend class ASDM;
00260 
00261 public:
00262 
00263 
00269         static std::vector<std::string> getKeyName();
00270 
00271 
00272         virtual ~CalSeeingTable();
00273         
00279         ASDM &getContainer() const;
00280         
00286         unsigned int size() const;
00287         
00295         std::string getName() const;
00296         
00304         static std::string name() ;     
00305         
00310          std::string getVersion() const ;
00311         
00317          static const std::vector<std::string>& getAttributesNames();
00318 
00324          static const std::vector<std::string>& defaultAttributesNamesInBin();
00325          
00329         Entity getEntity() const;
00330 
00335         void setEntity(Entity e);
00336                 
00344         std::string toXML()  ;
00345 
00346 #ifndef WITHOUT_ACS
00347         // Conversion Methods
00353         asdmIDL::CalSeeingTableIDL *toIDL() ;
00354 #endif
00355 
00356 #ifndef WITHOUT_ACS
00357 
00363         void fromIDL(asdmIDL::CalSeeingTableIDL x) ;
00364 #endif
00365         
00366         //
00367         // ====> Row creation.
00368         //
00369         
00374         CalSeeingRow *newRow();
00375         
00376         
00406         CalSeeingRow *newRow(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, vector<Frequency > frequencyRange, Interval integrationTime, int numBaseLengths, vector<Length > baselineLengths, vector<Angle > phaseRMS, Angle seeing, Angle seeingError);
00407         
00408 
00409 
00422          CalSeeingRow *newRow(CalSeeingRow *row); 
00423 
00424         //
00425         // ====> Append a row to its table.
00426         //
00427  
00428         
00441         CalSeeingRow* add(CalSeeingRow* x) ; 
00442 
00443  
00444 
00445 
00446 
00447         //
00448         // ====> Methods returning rows.
00449         //
00450                 
00456         std::vector<CalSeeingRow *> get() ;
00457         
00464          const std::vector<CalSeeingRow *>& get() const ;
00465         
00466 
00467 
00468  
00469         
00483         CalSeeingRow* getRowByKey(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId);
00484 
00485                 
00486 
00487 
00488 
00520         CalSeeingRow* lookup(AtmPhaseCorrectionMod::AtmPhaseCorrection atmPhaseCorrection, Tag calDataId, Tag calReductionId, ArrayTime startValidTime, ArrayTime endValidTime, vector<Frequency > frequencyRange, Interval integrationTime, int numBaseLengths, vector<Length > baselineLengths, vector<Angle > phaseRMS, Angle seeing, Angle seeingError); 
00521 
00522 
00523         void setUnknownAttributeBinaryReader(const std::string& attributeName, BinaryAttributeReaderFunctor* barFctr);
00524         BinaryAttributeReaderFunctor* getUnknownAttributeBinaryReader(const std::string& attributeName) const;
00525 
00526 private:
00527 
00536         CalSeeingTable (ASDM & container);
00537 
00538         ASDM & container;
00539         
00540         bool archiveAsBin; // If true archive binary else archive XML
00541         bool fileAsBin ; // If true file binary else file XML   
00542         
00543         std::string version ; 
00544         
00545         Entity entity;
00546         
00547 
00548 
00552         static std::string itsName;
00553         
00557         static std::vector<std::string> attributesNames;
00558         
00562         static std::vector<std::string> attributesNamesInBin;
00563         
00564 
00568         static bool initAttributesNames(), initAttributesNamesDone ;
00569         
00570 
00574         static std::vector<std::string> key;
00575 
00576 
00584         CalSeeingRow* checkAndAdd(CalSeeingRow* x) ;
00585         
00591          void append(CalSeeingRow* x) ;
00592          
00598          void addWithoutCheckingUnique(CalSeeingRow* x) ;
00599          
00600          
00601 
00602 
00603 
00604 // A data structure to store the pointers on the table's rows.
00605 
00606 // In all cases we maintain a private vector of CalSeeingRow s.
00607    std::vector<CalSeeingRow * > privateRows;
00608    
00609 
00610                         
00611         std::vector<CalSeeingRow *> row;
00612 
00613         
00614         void error() ; //throw(ConversionException);
00615 
00616         
00623         void fromXML(std::string& xmlDoc) ;
00624                 
00625         std::map<std::string, BinaryAttributeReaderFunctor *> unknownAttributes2Functors;
00626 
00631         void setFromMIMEFile(const std::string& directory);
00632         /*
00633         void openMIMEFile(const std::string& directory);
00634         */
00635         void setFromXMLFile(const std::string& directory);
00636         
00644         std::string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00645   
00646         
00653          void setFromMIME(const std::string & mimeMsg);
00654         
00658         std::string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00659         
00669           void toFile(std::string directory);
00670           
00674           bool loadInProgress;
00675           void checkPresenceInMemory() {
00676                 if (!presentInMemory && !loadInProgress) {
00677                         loadInProgress = true;
00678                         setFromFile(getContainer().getDirectory());
00679                         presentInMemory = true;
00680                         loadInProgress = false;
00681                 }
00682           }
00691          void setFromFile(const std::string& directory);        
00692  
00693 };
00694 
00695 } // End namespace asdm
00696 
00697 #endif /* CalSeeingTable_CLASS */