MainTable.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 MainTable.h
00032  */
00033  
00034 #ifndef MainTable_CLASS
00035 #define MainTable_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 #include "CTimeSampling.h"
00085 using namespace TimeSamplingMod;
00086         
00087 
00088         
00089 
00090         
00091 
00092         
00093 
00094         
00095 
00096 
00097 #ifndef WITHOUT_ACS
00098 #include <asdmIDLC.h>
00099 using asdmIDL::MainTableIDL;
00100 #endif
00101 
00102 using asdm::Angle;
00103 using asdm::AngularRate;
00104 using asdm::ArrayTime;
00105 using asdm::Complex;
00106 using asdm::Entity;
00107 using asdm::EntityId;
00108 using asdm::EntityRef;
00109 using asdm::Flux;
00110 using asdm::Frequency;
00111 using asdm::Humidity;
00112 using asdm::Interval;
00113 using asdm::Length;
00114 using asdm::PartId;
00115 using asdm::Pressure;
00116 using asdm::Speed;
00117 using asdm::Tag;
00118 using asdm::Temperature;
00119 
00120 using asdm::DuplicateKey;
00121 using asdm::ConversionException;
00122 using asdm::NoSuchRow;
00123 using asdm::DuplicateKey;
00124 
00125 #include <Representable.h>
00126 
00127 namespace asdm {
00128 
00129 //class asdm::ASDM;
00130 //class asdm::MainRow;
00131 
00132 class ASDM;
00133 class MainRow;
00231 class MainTable : public Representable {
00232         friend class asdm::ASDM;
00233 
00234 public:
00235 
00236 
00242         static vector<string> getKeyName();
00243 
00244 
00245         virtual ~MainTable();
00246         
00252         ASDM &getContainer() const;
00253         
00259         unsigned int size() ;
00260         
00266         string getName() const;
00267 
00271         Entity getEntity() const;
00272 
00277         void setEntity(Entity e);
00278 
00279         //
00280         // ====> Row creation.
00281         //
00282         
00287         MainRow *newRow();
00288         
00293         MainRow* newRowEmpty();
00294 
00295         
00325         MainRow *newRow(Tag configDescriptionId, Tag fieldId, ArrayTime time, Tag execBlockId, vector<Tag>  stateId, int scanNumber, int subscanNumber, TimeSampling timeSampling, int numIntegration, EntityRef dataOid, bool flagRow, Interval interval);
00326         
00331         MainRow *newRowFull(Tag configDescriptionId, Tag fieldId, ArrayTime time, Tag execBlockId, vector<Tag>  stateId, int scanNumber, int subscanNumber, TimeSampling timeSampling, int numIntegration, EntityRef dataOid, bool flagRow, Interval interval);
00332 
00333 
00346          MainRow *newRow(MainRow *row); 
00347 
00352          MainRow *newRowCopy(MainRow *row); 
00353 
00354         //
00355         // ====> Append a row to its table.
00356         //
00357  
00358         
00375         MainRow* add(MainRow* x) ; 
00376 
00377  
00378 
00379 
00380 
00381         //
00382         // ====> Methods returning rows.
00383         //
00384                 
00390         vector<MainRow *> get() ;
00391         
00392 
00400          vector <MainRow*> *getByContext(Tag configDescriptionId, Tag fieldId);
00401          
00402 
00403 
00404  
00405         
00419         MainRow* MainTable::getRowByKey(Tag configDescriptionId, Tag fieldId, ArrayTime time);
00420 
00421                 
00422 
00423 
00424 
00456         MainRow* lookup(Tag configDescriptionId, Tag fieldId, ArrayTime time, Tag execBlockId, vector<Tag>  stateId, int scanNumber, int subscanNumber, TimeSampling timeSampling, int numIntegration, EntityRef dataOid, bool flagRow, Interval interval); 
00457 
00458 
00459 #ifndef WITHOUT_ACS
00460         // Conversion Methods
00466         MainTableIDL *toIDL() ;
00467 #endif
00468 
00469 #ifndef WITHOUT_ACS
00470 
00476         void fromIDL(MainTableIDL x) throw(DuplicateKey,ConversionException);
00477 #endif
00478 
00482         char *toFITS() const throw(ConversionException);
00483 
00487         void fromFITS(char *fits) throw(ConversionException);
00488 
00492         string toVOTable() const throw(ConversionException);
00493 
00497         void fromVOTable(string vo) throw(ConversionException);
00498 
00505         string toXML()  throw(ConversionException);
00506         
00512         void fromXML(string xmlDoc) throw(ConversionException);
00513         
00519         string toMIME();
00520         
00527          void setFromMIME(const string & mimeMsg);
00528         
00538           void toFile(string directory);
00539           
00548          void setFromFile(const string& directory);     
00549 
00550 private:
00551 
00560         MainTable (ASDM & container);
00561 
00562         ASDM & container;
00563         
00564         bool archiveAsBin; // If true archive binary else archive XML
00565         bool fileAsBin ; // If true file binary else file XML   
00566         
00567         Entity entity;
00568         
00569 
00570 
00574         static string tableName;
00575 
00576 
00580         static vector<string> key;
00581 
00582 
00588         MainRow* checkAndAdd(MainRow* x) throw (DuplicateKey);
00589 
00590 
00591         
00592         
00600         MainRow * MainTable::insertByTime(MainRow* x, vector<MainRow *>&row );
00601          
00602 
00603 
00604 // A data structure to store the pointers on the table's rows.
00605 
00606 // In all cases we maintain a private ArrayList of MainRow s.
00607    vector<MainRow * > privateRows;
00608    
00609 
00610         
00611 
00612         
00613         
00614                 
00615                                 
00616         typedef vector <MainRow* > TIME_ROWS;
00617         map<string, TIME_ROWS > context;
00618                 
00623          string Key(Tag configDescriptionId, Tag fieldId) ;
00624                  
00625                 
00626         
00627         
00633         void getByKeyNoAutoIncNoTime(vector <MainRow*>& vin, vector <MainRow*>& vout,  Tag configDescriptionId, Tag fieldId);
00634         
00635 
00636 
00637         void error() throw(ConversionException);
00638 
00639 };
00640 
00641 } // End namespace asdm
00642 
00643 #endif /* MainTable_CLASS */

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