HolographyTable.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 HolographyTable.h
00032  */
00033  
00034 #ifndef HolographyTable_CLASS
00035 #define HolographyTable_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 #include <Length.h>
00051 using  asdm::Length;
00052 
00053 
00054 
00055 
00056         
00057 
00058         
00059 
00060         
00061 
00062         
00063 
00064         
00065 #include "CHolographyChannelType.h"
00066 using namespace HolographyChannelTypeMod;
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::HolographyTableIDL;
00084 #endif
00085 
00086 #include <Representable.h>
00087 
00088 namespace asdm {
00089 
00090 //class asdm::ASDM;
00091 //class asdm::HolographyRow;
00092 
00093 class ASDM;
00094 class HolographyRow;
00156 class HolographyTable : public Representable {
00157         friend class ASDM;
00158 
00159 public:
00160 
00161 
00167         static vector<string> getKeyName();
00168 
00169 
00170         virtual ~HolographyTable();
00171         
00177         ASDM &getContainer() const;
00178         
00184         unsigned int size() ;
00185         
00191         string getName() const;
00192         
00198          static const vector<string>& getAttributesNames();
00199 
00203         Entity getEntity() const;
00204 
00209         void setEntity(Entity e);
00210                 
00218         string toXML()  ;
00219 
00220 #ifndef WITHOUT_ACS
00221         // Conversion Methods
00227         HolographyTableIDL *toIDL() ;
00228 #endif
00229 
00230 #ifndef WITHOUT_ACS
00231 
00237         void fromIDL(HolographyTableIDL x) ;
00238 #endif
00239         
00240         //
00241         // ====> Row creation.
00242         //
00243         
00248         HolographyRow *newRow();
00249         
00250         
00264         HolographyRow *newRow(Length distance, Length focus, int numCorr, vector<HolographyChannelTypeMod::HolographyChannelType > type);
00265         
00266 
00267 
00280          HolographyRow *newRow(HolographyRow *row); 
00281 
00282         //
00283         // ====> Append a row to its table.
00284         //
00285 
00286         
00287         
00288         
00298          HolographyRow* add(HolographyRow* x) ;
00299 
00300 
00301 
00302         //
00303         // ====> Methods returning rows.
00304         //
00305                 
00311         vector<HolographyRow *> get() ;
00312         
00313 
00314 
00315  
00316         
00326         HolographyRow* getRowByKey(Tag holographyId);
00327 
00328                 
00329 
00330 
00331 
00347         HolographyRow* lookup(Length distance, Length focus, int numCorr, vector<HolographyChannelTypeMod::HolographyChannelType > type); 
00348 
00349 
00350 private:
00351 
00360         HolographyTable (ASDM & container);
00361 
00362         ASDM & container;
00363         
00364         bool archiveAsBin; // If true archive binary else archive XML
00365         bool fileAsBin ; // If true file binary else file XML   
00366         
00367         Entity entity;
00368         
00369 
00370         // A map for the autoincrementation algorithm
00371         map<string,int>  noAutoIncIds;
00372         void autoIncrement(string key, HolographyRow* x);
00373 
00374 
00378         static string tableName;
00379         
00383         static const vector<string> attributesNames;
00384         
00388         static vector<string> initAttributesNames();
00389 
00390 
00394         static vector<string> key;
00395 
00396 
00406         HolographyRow* checkAndAdd(HolographyRow* x) ;
00407 
00408 
00409 
00410 // A data structure to store the pointers on the table's rows.
00411 
00412 // In all cases we maintain a private vector of HolographyRow s.
00413    vector<HolographyRow * > privateRows;
00414    
00415 
00416                         
00417         vector<HolographyRow *> row;
00418 
00419         
00420         void error() ; //throw(ConversionException);
00421 
00422         
00429         void fromXML(string xmlDoc) ;
00430                 
00435         void setFromMIMEFile(const string& directory);
00436         void setFromXMLFile(const string& directory);
00437         
00445         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00446   
00447         
00454          void setFromMIME(const string & mimeMsg);
00455         
00459         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00460         
00470           void toFile(string directory);
00471           
00480          void setFromFile(const string& directory);     
00481  
00482 };
00483 
00484 } // End namespace asdm
00485 
00486 #endif /* HolographyTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines