SourceTable.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 SourceTable.h
00032  */
00033  
00034 #ifndef SourceTable_CLASS
00035 #define SourceTable_CLASS
00036 
00037 #include <string>
00038 #include <vector>
00039 #include <map>
00040 #include <set>
00041 using std::string;
00042 using std::vector;
00043 using std::map;
00044 
00045 
00046 
00047 #include <ArrayTime.h>
00048 using  asdm::ArrayTime;
00049 
00050 #include <AngularRate.h>
00051 using  asdm::AngularRate;
00052 
00053 #include <Angle.h>
00054 using  asdm::Angle;
00055 
00056 #include <Speed.h>
00057 using  asdm::Speed;
00058 
00059 #include <Flux.h>
00060 using  asdm::Flux;
00061 
00062 #include <Tag.h>
00063 using  asdm::Tag;
00064 
00065 #include <Length.h>
00066 using  asdm::Length;
00067 
00068 #include <Frequency.h>
00069 using  asdm::Frequency;
00070 
00071 #include <ArrayTimeInterval.h>
00072 using  asdm::ArrayTimeInterval;
00073 
00074 
00075 
00076 
00077         
00078 
00079         
00080 
00081         
00082 
00083         
00084 
00085         
00086 
00087         
00088 
00089         
00090 #include "CDirectionReferenceCode.h"
00091 using namespace DirectionReferenceCodeMod;
00092         
00093 
00094         
00095 
00096         
00097 
00098         
00099 
00100         
00101 
00102         
00103 
00104         
00105 
00106         
00107 
00108         
00109 
00110         
00111 
00112         
00113 
00114         
00115 #include "CSourceModel.h"
00116 using namespace SourceModelMod;
00117         
00118 
00119         
00120 #include "CFrequencyReferenceCode.h"
00121 using namespace FrequencyReferenceCodeMod;
00122         
00123 
00124         
00125 
00126         
00127 
00128         
00129 
00130         
00131 
00132         
00133 #include "CStokesParameter.h"
00134 using namespace StokesParameterMod;
00135         
00136 
00137         
00138 
00139         
00140 
00141         
00142 
00143         
00144 
00145         
00146 
00147         
00148 
00149 
00150 
00151 #include <ConversionException.h>
00152 #include <DuplicateKey.h>
00153 #include <UniquenessViolationException.h>
00154 #include <NoSuchRow.h>
00155 #include <DuplicateKey.h>
00156 using asdm::DuplicateKey;
00157 using asdm::ConversionException;
00158 using asdm::NoSuchRow;
00159 using asdm::DuplicateKey;
00160 
00161 #ifndef WITHOUT_ACS
00162 #include <asdmIDLC.h>
00163 using asdmIDL::SourceTableIDL;
00164 #endif
00165 
00166 #include <Representable.h>
00167 
00168 namespace asdm {
00169 
00170 //class asdm::ASDM;
00171 //class asdm::SourceRow;
00172 
00173 class ASDM;
00174 class SourceRow;
00425 class SourceTable : public Representable {
00426         friend class ASDM;
00427 
00428 public:
00429 
00430 
00436         static vector<string> getKeyName();
00437 
00438 
00439         virtual ~SourceTable();
00440         
00446         ASDM &getContainer() const;
00447         
00453         unsigned int size() ;
00454         
00460         string getName() const;
00461         
00467          static const vector<string>& getAttributesNames();
00468 
00472         Entity getEntity() const;
00473 
00478         void setEntity(Entity e);
00479                 
00487         string toXML()  ;
00488 
00489 #ifndef WITHOUT_ACS
00490         // Conversion Methods
00496         SourceTableIDL *toIDL() ;
00497 #endif
00498 
00499 #ifndef WITHOUT_ACS
00500 
00506         void fromIDL(SourceTableIDL x) ;
00507 #endif
00508         
00509         //
00510         // ====> Row creation.
00511         //
00512         
00517         SourceRow *newRow();
00518         
00519         
00537         SourceRow *newRow(ArrayTimeInterval timeInterval, Tag spectralWindowId, string code, vector<Angle > direction, vector<AngularRate > properMotion, string sourceName);
00538         
00539 
00540 
00553          SourceRow *newRow(SourceRow *row); 
00554 
00555         //
00556         // ====> Append a row to its table.
00557         //
00558 
00559         
00560          
00561         
00562         
00572          SourceRow* add(SourceRow* x) ;
00573 
00574 
00575 
00576         //
00577         // ====> Methods returning rows.
00578         //
00579                 
00585         vector<SourceRow *> get() ;
00586         
00587 
00588 
00589  
00590         
00604         SourceRow* getRowByKey(int sourceId, ArrayTimeInterval timeInterval, Tag spectralWindowId);
00605 
00606                 
00607         
00615         vector <SourceRow *>  getRowBySourceId(int);
00616 
00617 
00618 
00638         SourceRow* lookup(ArrayTimeInterval timeInterval, Tag spectralWindowId, string code, vector<Angle > direction, vector<AngularRate > properMotion, string sourceName); 
00639 
00640 
00641 private:
00642 
00651         SourceTable (ASDM & container);
00652 
00653         ASDM & container;
00654         
00655         bool archiveAsBin; // If true archive binary else archive XML
00656         bool fileAsBin ; // If true file binary else file XML   
00657         
00658         Entity entity;
00659         
00660 
00661 
00665         static string tableName;
00666         
00670         static const vector<string> attributesNames;
00671         
00675         static vector<string> initAttributesNames();
00676 
00677 
00681         static vector<string> key;
00682 
00683 
00693         SourceRow* checkAndAdd(SourceRow* x) ;
00694 
00695 
00696         
00697         
00705          SourceRow * insertByStartTime(SourceRow* x, vector<SourceRow* >& row);
00706           
00707 
00708 
00709 // A data structure to store the pointers on the table's rows.
00710 
00711 // In all cases we maintain a private vector of SourceRow s.
00712    vector<SourceRow * > privateRows;
00713    
00714 
00715         
00716 
00717         
00718         
00719                 
00720                 
00721         typedef vector <vector <SourceRow* > > ID_TIME_ROWS;
00722         map<string, ID_TIME_ROWS > context;
00723         
00728          string Key(Tag spectralWindowId) ;
00729                 
00730                 
00731         
00732         
00738         void getByKeyNoAutoIncNoTime(vector <SourceRow*>& vin, vector <SourceRow*>& vout,  Tag spectralWindowId);
00739         
00740 
00741         
00742         void error() ; //throw(ConversionException);
00743 
00744         
00751         void fromXML(string xmlDoc) ;
00752                 
00757         void setFromMIMEFile(const string& directory);
00758         void setFromXMLFile(const string& directory);
00759         
00767         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00768   
00769         
00776          void setFromMIME(const string & mimeMsg);
00777         
00781         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00782         
00792           void toFile(string directory);
00793           
00802          void setFromFile(const string& directory);     
00803  
00804 };
00805 
00806 } // End namespace asdm
00807 
00808 #endif /* SourceTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines