StateTable.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 StateTable.h
00032  */
00033  
00034 #ifndef StateTable_CLASS
00035 #define StateTable_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 #include "CCalibrationDevice.h"
00089 using namespace CalibrationDeviceMod;
00090         
00091 
00092         
00093 
00094 
00095 #ifndef WITHOUT_ACS
00096 #include <asdmIDLC.h>
00097 using asdmIDL::StateTableIDL;
00098 #endif
00099 
00100 using asdm::Angle;
00101 using asdm::AngularRate;
00102 using asdm::ArrayTime;
00103 using asdm::Complex;
00104 using asdm::Entity;
00105 using asdm::EntityId;
00106 using asdm::EntityRef;
00107 using asdm::Flux;
00108 using asdm::Frequency;
00109 using asdm::Humidity;
00110 using asdm::Interval;
00111 using asdm::Length;
00112 using asdm::PartId;
00113 using asdm::Pressure;
00114 using asdm::Speed;
00115 using asdm::Tag;
00116 using asdm::Temperature;
00117 
00118 using asdm::DuplicateKey;
00119 using asdm::ConversionException;
00120 using asdm::NoSuchRow;
00121 using asdm::DuplicateKey;
00122 
00123 #include <Representable.h>
00124 
00125 namespace asdm {
00126 
00127 //class asdm::ASDM;
00128 //class asdm::StateRow;
00129 
00130 class ASDM;
00131 class StateRow;
00198 class StateTable : public Representable {
00199         friend class asdm::ASDM;
00200 
00201 public:
00202 
00203 
00209         static vector<string> getKeyName();
00210 
00211 
00212         virtual ~StateTable();
00213         
00219         ASDM &getContainer() const;
00220         
00226         unsigned int size() ;
00227         
00233         string getName() const;
00234 
00238         Entity getEntity() const;
00239 
00244         void setEntity(Entity e);
00245 
00246         //
00247         // ====> Row creation.
00248         //
00249         
00254         StateRow *newRow();
00255         
00260         StateRow* newRowEmpty();
00261 
00262         
00278         StateRow *newRow(bool sig, bool ref, bool onSky, CalibrationDevice calDeviceName, bool flagRow);
00279         
00284         StateRow *newRowFull(bool sig, bool ref, bool onSky, CalibrationDevice calDeviceName, bool flagRow);
00285 
00286 
00299          StateRow *newRow(StateRow *row); 
00300 
00305          StateRow *newRowCopy(StateRow *row); 
00306 
00307         //
00308         // ====> Append a row to its table.
00309         //
00310 
00311         
00312         
00313         
00323          StateRow* add(StateRow* x) ;
00324 
00325 
00326 
00327         //
00328         // ====> Methods returning rows.
00329         //
00330                 
00336         vector<StateRow *> get() ;
00337         
00338 
00339 
00340  
00341         
00351         StateRow* StateTable::getRowByKey(Tag stateId);
00352 
00353                 
00354 
00355 
00356 
00374         StateRow* lookup(bool sig, bool ref, bool onSky, CalibrationDevice calDeviceName, bool flagRow); 
00375 
00376 
00377 #ifndef WITHOUT_ACS
00378         // Conversion Methods
00384         StateTableIDL *toIDL() ;
00385 #endif
00386 
00387 #ifndef WITHOUT_ACS
00388 
00394         void fromIDL(StateTableIDL x) throw(DuplicateKey,ConversionException);
00395 #endif
00396 
00400         char *toFITS() const throw(ConversionException);
00401 
00405         void fromFITS(char *fits) throw(ConversionException);
00406 
00410         string toVOTable() const throw(ConversionException);
00411 
00415         void fromVOTable(string vo) throw(ConversionException);
00416 
00423         string toXML()  throw(ConversionException);
00424         
00430         void fromXML(string xmlDoc) throw(ConversionException);
00431         
00437         string toMIME();
00438         
00445          void setFromMIME(const string & mimeMsg);
00446         
00456           void toFile(string directory);
00457           
00466          void setFromFile(const string& directory);     
00467 
00468 private:
00469 
00478         StateTable (ASDM & container);
00479 
00480         ASDM & container;
00481         
00482         bool archiveAsBin; // If true archive binary else archive XML
00483         bool fileAsBin ; // If true file binary else file XML   
00484         
00485         Entity entity;
00486         
00487 
00488         // A map for the autoincrementation algorithm
00489         map<string,int>  noAutoIncIds;
00490         void autoIncrement(string key, StateRow* x);
00491 
00492 
00496         static string tableName;
00497 
00498 
00502         static vector<string> key;
00503 
00504 
00510         StateRow* checkAndAdd(StateRow* x) throw (DuplicateKey, UniquenessViolationException);
00511 
00512 
00513 
00514 // A data structure to store the pointers on the table's rows.
00515 
00516 // In all cases we maintain a private ArrayList of StateRow s.
00517    vector<StateRow * > privateRows;
00518    
00519 
00520                         
00521         vector<StateRow *> row;
00522 
00523 
00524         void error() throw(ConversionException);
00525 
00526 };
00527 
00528 } // End namespace asdm
00529 
00530 #endif /* StateTable_CLASS */

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