DopplerTable.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 DopplerTable.h
00032  */
00033  
00034 #ifndef DopplerTable_CLASS
00035 #define DopplerTable_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 
00048 
00049 
00050         
00051 
00052         
00053 
00054         
00055 #include "CDopplerReferenceCode.h"
00056 using namespace DopplerReferenceCodeMod;
00057         
00058 
00059 
00060 
00061 #include <ConversionException.h>
00062 #include <DuplicateKey.h>
00063 #include <UniquenessViolationException.h>
00064 #include <NoSuchRow.h>
00065 #include <DuplicateKey.h>
00066 using asdm::DuplicateKey;
00067 using asdm::ConversionException;
00068 using asdm::NoSuchRow;
00069 using asdm::DuplicateKey;
00070 
00071 #ifndef WITHOUT_ACS
00072 #include <asdmIDLC.h>
00073 using asdmIDL::DopplerTableIDL;
00074 #endif
00075 
00076 #include <Representable.h>
00077 
00078 namespace asdm {
00079 
00080 //class asdm::ASDM;
00081 //class asdm::DopplerRow;
00082 
00083 class ASDM;
00084 class DopplerRow;
00141 class DopplerTable : public Representable {
00142         friend class ASDM;
00143 
00144 public:
00145 
00146 
00152         static vector<string> getKeyName();
00153 
00154 
00155         virtual ~DopplerTable();
00156         
00162         ASDM &getContainer() const;
00163         
00169         unsigned int size() ;
00170         
00176         string getName() const;
00177         
00183          static const vector<string>& getAttributesNames();
00184 
00188         Entity getEntity() const;
00189 
00194         void setEntity(Entity e);
00195                 
00203         string toXML()  ;
00204 
00205 #ifndef WITHOUT_ACS
00206         // Conversion Methods
00212         DopplerTableIDL *toIDL() ;
00213 #endif
00214 
00215 #ifndef WITHOUT_ACS
00216 
00222         void fromIDL(DopplerTableIDL x) ;
00223 #endif
00224         
00225         //
00226         // ====> Row creation.
00227         //
00228         
00233         DopplerRow *newRow();
00234         
00235         
00247         DopplerRow *newRow(int sourceId, int transitionIndex, DopplerReferenceCodeMod::DopplerReferenceCode velDef);
00248         
00249 
00250 
00263          DopplerRow *newRow(DopplerRow *row); 
00264 
00265         //
00266         // ====> Append a row to its table.
00267         //
00268 
00269         
00270         
00271         
00281          DopplerRow* add(DopplerRow* x) ;
00282 
00283 
00284 
00285         //
00286         // ====> Methods returning rows.
00287         //
00288                 
00294         vector<DopplerRow *> get() ;
00295         
00296 
00297 
00298  
00299         
00311         DopplerRow* getRowByKey(int dopplerId, int sourceId);
00312 
00313                 
00314         
00322         vector <DopplerRow *>  getRowByDopplerId(int);
00323 
00324 
00325 
00339         DopplerRow* lookup(int sourceId, int transitionIndex, DopplerReferenceCodeMod::DopplerReferenceCode velDef); 
00340 
00341 
00342 private:
00343 
00352         DopplerTable (ASDM & container);
00353 
00354         ASDM & container;
00355         
00356         bool archiveAsBin; // If true archive binary else archive XML
00357         bool fileAsBin ; // If true file binary else file XML   
00358         
00359         Entity entity;
00360         
00361 
00362         // A map for the autoincrementation algorithm
00363         map<string,int>  noAutoIncIds;
00364         void autoIncrement(string key, DopplerRow* x);
00365 
00366 
00370         static string tableName;
00371         
00375         static const vector<string> attributesNames;
00376         
00380         static vector<string> initAttributesNames();
00381 
00382 
00386         static vector<string> key;
00387 
00388 
00398         DopplerRow* checkAndAdd(DopplerRow* x) ;
00399 
00400 
00401 
00402 // A data structure to store the pointers on the table's rows.
00403 
00404 // In all cases we maintain a private vector of DopplerRow s.
00405    vector<DopplerRow * > privateRows;
00406    
00407 
00408                         
00409         vector<DopplerRow *> row;
00410 
00411         
00412         void error() ; //throw(ConversionException);
00413 
00414         
00421         void fromXML(string xmlDoc) ;
00422                 
00427         void setFromMIMEFile(const string& directory);
00428         void setFromXMLFile(const string& directory);
00429         
00437         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00438   
00439         
00446          void setFromMIME(const string & mimeMsg);
00447         
00451         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00452         
00462           void toFile(string directory);
00463           
00472          void setFromFile(const string& directory);     
00473  
00474 };
00475 
00476 } // End namespace asdm
00477 
00478 #endif /* DopplerTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines