PolarizationTable.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 PolarizationTable.h
00032  */
00033  
00034 #ifndef PolarizationTable_CLASS
00035 #define PolarizationTable_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 <Tag.h>
00048 using  asdm::Tag;
00049 
00050 
00051 
00052 
00053         
00054 
00055         
00056 
00057         
00058 #include "CStokesParameter.h"
00059 using namespace StokesParameterMod;
00060         
00061 
00062         
00063 #include "CPolarizationType.h"
00064 using namespace PolarizationTypeMod;
00065         
00066 
00067         
00068 
00069 
00070 
00071 #include <ConversionException.h>
00072 #include <DuplicateKey.h>
00073 #include <UniquenessViolationException.h>
00074 #include <NoSuchRow.h>
00075 #include <DuplicateKey.h>
00076 using asdm::DuplicateKey;
00077 using asdm::ConversionException;
00078 using asdm::NoSuchRow;
00079 using asdm::DuplicateKey;
00080 
00081 #ifndef WITHOUT_ACS
00082 #include <asdmIDLC.h>
00083 using asdmIDL::PolarizationTableIDL;
00084 #endif
00085 
00086 #include <Representable.h>
00087 
00088 namespace asdm {
00089 
00090 //class asdm::ASDM;
00091 //class asdm::PolarizationRow;
00092 
00093 class ASDM;
00094 class PolarizationRow;
00159 class PolarizationTable : public Representable {
00160         friend class ASDM;
00161 
00162 public:
00163 
00164 
00170         static vector<string> getKeyName();
00171 
00172 
00173         virtual ~PolarizationTable();
00174         
00180         ASDM &getContainer() const;
00181         
00187         unsigned int size() ;
00188         
00194         string getName() const;
00195         
00201          static const vector<string>& getAttributesNames();
00202 
00206         Entity getEntity() const;
00207 
00212         void setEntity(Entity e);
00213                 
00221         string toXML()  ;
00222 
00223 #ifndef WITHOUT_ACS
00224         // Conversion Methods
00230         PolarizationTableIDL *toIDL() ;
00231 #endif
00232 
00233 #ifndef WITHOUT_ACS
00234 
00240         void fromIDL(PolarizationTableIDL x) ;
00241 #endif
00242         
00243         //
00244         // ====> Row creation.
00245         //
00246         
00251         PolarizationRow *newRow();
00252         
00253         
00265         PolarizationRow *newRow(int numCorr, vector<StokesParameterMod::StokesParameter > corrType, vector<vector<PolarizationTypeMod::PolarizationType > > corrProduct);
00266         
00267 
00268 
00281          PolarizationRow *newRow(PolarizationRow *row); 
00282 
00283         //
00284         // ====> Append a row to its table.
00285         //
00286 
00287         
00288         
00289         
00299          PolarizationRow* add(PolarizationRow* x) ;
00300 
00301 
00302 
00303         //
00304         // ====> Methods returning rows.
00305         //
00306                 
00312         vector<PolarizationRow *> get() ;
00313         
00314 
00315 
00316  
00317         
00327         PolarizationRow* getRowByKey(Tag polarizationId);
00328 
00329                 
00330 
00331 
00332 
00346         PolarizationRow* lookup(int numCorr, vector<StokesParameterMod::StokesParameter > corrType, vector<vector<PolarizationTypeMod::PolarizationType > > corrProduct); 
00347 
00348 
00349 private:
00350 
00359         PolarizationTable (ASDM & container);
00360 
00361         ASDM & container;
00362         
00363         bool archiveAsBin; // If true archive binary else archive XML
00364         bool fileAsBin ; // If true file binary else file XML   
00365         
00366         Entity entity;
00367         
00368 
00369         // A map for the autoincrementation algorithm
00370         map<string,int>  noAutoIncIds;
00371         void autoIncrement(string key, PolarizationRow* x);
00372 
00373 
00377         static string tableName;
00378         
00382         static const vector<string> attributesNames;
00383         
00387         static vector<string> initAttributesNames();
00388 
00389 
00393         static vector<string> key;
00394 
00395 
00405         PolarizationRow* checkAndAdd(PolarizationRow* x) ;
00406 
00407 
00408 
00409 // A data structure to store the pointers on the table's rows.
00410 
00411 // In all cases we maintain a private vector of PolarizationRow s.
00412    vector<PolarizationRow * > privateRows;
00413    
00414 
00415                         
00416         vector<PolarizationRow *> row;
00417 
00418         
00419         void error() ; //throw(ConversionException);
00420 
00421         
00428         void fromXML(string xmlDoc) ;
00429                 
00434         void setFromMIMEFile(const string& directory);
00435         void setFromXMLFile(const string& directory);
00436         
00444         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00445   
00446         
00453          void setFromMIME(const string & mimeMsg);
00454         
00458         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00459         
00469           void toFile(string directory);
00470           
00479          void setFromFile(const string& directory);     
00480  
00481 };
00482 
00483 } // End namespace asdm
00484 
00485 #endif /* PolarizationTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines