FieldTable.h

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 FieldTable.h
00032  */
00033  
00034 #ifndef FieldTable_CLASS
00035 #define FieldTable_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 #include <Angle.h>
00046 #include <AngularRate.h>
00047 #include <ArrayTime.h>
00048 #include <ArrayTimeInterval.h>
00049 #include <Complex.h>
00050 #include <Entity.h>
00051 #include <EntityId.h>
00052 #include <EntityRef.h>
00053 #include <Flux.h>
00054 #include <Frequency.h>
00055 #include <Humidity.h>
00056 #include <Interval.h>
00057 #include <Length.h>
00058 #include <PartId.h>
00059 #include <Pressure.h>
00060 #include <Speed.h>
00061 #include <Tag.h>
00062 #include <Temperature.h>
00063 #include <ConversionException.h>
00064 #include <DuplicateKey.h>
00065 #include <UniquenessViolationException.h>
00066 #include <NoSuchRow.h>
00067 #include <DuplicateKey.h>
00068 
00069 /*
00070 #include <Enumerations.h>
00071 using namespace enumerations;
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 #ifndef WITHOUT_ACS
00099 #include <asdmIDLC.h>
00100 using asdmIDL::FieldTableIDL;
00101 #endif
00102 
00103 using asdm::Angle;
00104 using asdm::AngularRate;
00105 using asdm::ArrayTime;
00106 using asdm::Complex;
00107 using asdm::Entity;
00108 using asdm::EntityId;
00109 using asdm::EntityRef;
00110 using asdm::Flux;
00111 using asdm::Frequency;
00112 using asdm::Humidity;
00113 using asdm::Interval;
00114 using asdm::Length;
00115 using asdm::PartId;
00116 using asdm::Pressure;
00117 using asdm::Speed;
00118 using asdm::Tag;
00119 using asdm::Temperature;
00120 
00121 using asdm::DuplicateKey;
00122 using asdm::ConversionException;
00123 using asdm::NoSuchRow;
00124 using asdm::DuplicateKey;
00125 
00126 #include <Representable.h>
00127 
00128 namespace asdm {
00129 
00130 //class asdm::ASDM;
00131 //class asdm::FieldRow;
00132 
00133 class ASDM;
00134 class FieldRow;
00237 class FieldTable : public Representable {
00238         friend class asdm::ASDM;
00239 
00240 public:
00241 
00242 
00248         static vector<string> getKeyName();
00249 
00250 
00251         virtual ~FieldTable();
00252         
00258         ASDM &getContainer() const;
00259         
00265         unsigned int size() ;
00266         
00272         string getName() const;
00273 
00277         Entity getEntity() const;
00278 
00283         void setEntity(Entity e);
00284 
00285         //
00286         // ====> Row creation.
00287         //
00288         
00293         FieldRow *newRow();
00294         
00299         FieldRow* newRowEmpty();
00300 
00301         
00323         FieldRow *newRow(string fieldName, string code, ArrayTime time, int numPoly, vector<vector<Angle > > delayDir, vector<vector<Angle > > phaseDir, vector<vector<Angle > > referenceDir, bool flagRow);
00324         
00329         FieldRow *newRowFull(string fieldName, string code, ArrayTime time, int numPoly, vector<vector<Angle > > delayDir, vector<vector<Angle > > phaseDir, vector<vector<Angle > > referenceDir, bool flagRow);
00330 
00331 
00344          FieldRow *newRow(FieldRow *row); 
00345 
00350          FieldRow *newRowCopy(FieldRow *row); 
00351 
00352         //
00353         // ====> Append a row to its table.
00354         //
00355 
00356         
00357         
00358         
00368          FieldRow* add(FieldRow* x) ;
00369 
00370 
00371 
00372         //
00373         // ====> Methods returning rows.
00374         //
00375                 
00381         vector<FieldRow *> get() ;
00382         
00383 
00384 
00385  
00386         
00396         FieldRow* FieldTable::getRowByKey(Tag fieldId);
00397 
00398                 
00399 
00400 
00401 
00425         FieldRow* lookup(string fieldName, string code, ArrayTime time, int numPoly, vector<vector<Angle > > delayDir, vector<vector<Angle > > phaseDir, vector<vector<Angle > > referenceDir, bool flagRow); 
00426 
00427 
00428 #ifndef WITHOUT_ACS
00429         // Conversion Methods
00435         FieldTableIDL *toIDL() ;
00436 #endif
00437 
00438 #ifndef WITHOUT_ACS
00439 
00445         void fromIDL(FieldTableIDL x) throw(DuplicateKey,ConversionException);
00446 #endif
00447 
00451         char *toFITS() const throw(ConversionException);
00452 
00456         void fromFITS(char *fits) throw(ConversionException);
00457 
00461         string toVOTable() const throw(ConversionException);
00462 
00466         void fromVOTable(string vo) throw(ConversionException);
00467 
00474         string toXML()  throw(ConversionException);
00475         
00481         void fromXML(string xmlDoc) throw(ConversionException);
00482         
00488         string toMIME();
00489         
00496          void setFromMIME(const string & mimeMsg);
00497         
00507           void toFile(string directory);
00508           
00517          void setFromFile(const string& directory);     
00518 
00519 private:
00520 
00529         FieldTable (ASDM & container);
00530 
00531         ASDM & container;
00532         
00533         bool archiveAsBin; // If true archive binary else archive XML
00534         bool fileAsBin ; // If true file binary else file XML   
00535         
00536         Entity entity;
00537         
00538 
00539         // A map for the autoincrementation algorithm
00540         map<string,int>  noAutoIncIds;
00541         void autoIncrement(string key, FieldRow* x);
00542 
00543 
00547         static string tableName;
00548 
00549 
00553         static vector<string> key;
00554 
00555 
00561         FieldRow* checkAndAdd(FieldRow* x) throw (DuplicateKey, UniquenessViolationException);
00562 
00563 
00564 
00565 // A data structure to store the pointers on the table's rows.
00566 
00567 // In all cases we maintain a private ArrayList of FieldRow s.
00568    vector<FieldRow * > privateRows;
00569    
00570 
00571                         
00572         vector<FieldRow *> row;
00573 
00574 
00575         void error() throw(ConversionException);
00576 
00577 };
00578 
00579 } // End namespace asdm
00580 
00581 #endif /* FieldTable_CLASS */

Generated on Thu Nov 29 16:46:46 2007 for ASDM C++ Implementation by  doxygen 1.5.1