FocusTable.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 FocusTable.h
00032  */
00033  
00034 #ifndef FocusTable_CLASS
00035 #define FocusTable_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 #include <ArrayTimeInterval.h>
00054 using  asdm::ArrayTimeInterval;
00055 
00056 
00057 
00058 
00059         
00060 
00061         
00062 
00063         
00064 
00065         
00066 
00067 
00068 
00069 #include <ConversionException.h>
00070 #include <DuplicateKey.h>
00071 #include <UniquenessViolationException.h>
00072 #include <NoSuchRow.h>
00073 #include <DuplicateKey.h>
00074 using asdm::DuplicateKey;
00075 using asdm::ConversionException;
00076 using asdm::NoSuchRow;
00077 using asdm::DuplicateKey;
00078 
00079 #ifndef WITHOUT_ACS
00080 #include <asdmIDLC.h>
00081 using asdmIDL::FocusTableIDL;
00082 #endif
00083 
00084 #include <Representable.h>
00085 
00086 namespace asdm {
00087 
00088 //class asdm::ASDM;
00089 //class asdm::FocusRow;
00090 
00091 class ASDM;
00092 class FocusRow;
00166 class FocusTable : public Representable {
00167         friend class ASDM;
00168 
00169 public:
00170 
00171 
00177         static vector<string> getKeyName();
00178 
00179 
00180         virtual ~FocusTable();
00181         
00187         ASDM &getContainer() const;
00188         
00194         unsigned int size() ;
00195         
00201         string getName() const;
00202         
00208          static const vector<string>& getAttributesNames();
00209 
00213         Entity getEntity() const;
00214 
00219         void setEntity(Entity e);
00220                 
00228         string toXML()  ;
00229 
00230 #ifndef WITHOUT_ACS
00231         // Conversion Methods
00237         FocusTableIDL *toIDL() ;
00238 #endif
00239 
00240 #ifndef WITHOUT_ACS
00241 
00247         void fromIDL(FocusTableIDL x) ;
00248 #endif
00249         
00250         //
00251         // ====> Row creation.
00252         //
00253         
00258         FocusRow *newRow();
00259         
00260         
00276         FocusRow *newRow(Tag antennaId, ArrayTimeInterval timeInterval, bool focusTracking, vector<Length > focusOffset, int focusModelId);
00277         
00278 
00279 
00292          FocusRow *newRow(FocusRow *row); 
00293 
00294         //
00295         // ====> Append a row to its table.
00296         //
00297  
00298         
00315         FocusRow* add(FocusRow* x) ; 
00316 
00317  
00318 
00319 
00320 
00321         //
00322         // ====> Methods returning rows.
00323         //
00324                 
00330         vector<FocusRow *> get() ;
00331         
00332 
00340          vector <FocusRow*> *getByContext(Tag antennaId);
00341          
00342 
00343 
00344  
00345         
00357         FocusRow* getRowByKey(Tag antennaId, ArrayTimeInterval timeInterval);
00358 
00359                 
00360 
00361 
00362 
00380         FocusRow* lookup(Tag antennaId, ArrayTimeInterval timeInterval, bool focusTracking, vector<Length > focusOffset, int focusModelId); 
00381 
00382 
00383 private:
00384 
00393         FocusTable (ASDM & container);
00394 
00395         ASDM & container;
00396         
00397         bool archiveAsBin; // If true archive binary else archive XML
00398         bool fileAsBin ; // If true file binary else file XML   
00399         
00400         Entity entity;
00401         
00402 
00403 
00407         static string tableName;
00408         
00412         static const vector<string> attributesNames;
00413         
00417         static vector<string> initAttributesNames();
00418 
00419 
00423         static vector<string> key;
00424 
00425 
00433         FocusRow* checkAndAdd(FocusRow* x) ;
00434 
00435 
00436         
00437         
00445          FocusRow * insertByStartTime(FocusRow* x, vector<FocusRow* >& row);
00446           
00447 
00448 
00449 // A data structure to store the pointers on the table's rows.
00450 
00451 // In all cases we maintain a private vector of FocusRow s.
00452    vector<FocusRow * > privateRows;
00453    
00454 
00455         
00456 
00457         
00458         
00459                 
00460                                 
00461         typedef vector <FocusRow* > TIME_ROWS;
00462         map<string, TIME_ROWS > context;
00463                 
00468          string Key(Tag antennaId) ;
00469                  
00470                 
00471         
00472         
00478         void getByKeyNoAutoIncNoTime(vector <FocusRow*>& vin, vector <FocusRow*>& vout,  Tag antennaId);
00479         
00480 
00481         
00482         void error() ; //throw(ConversionException);
00483 
00484         
00491         void fromXML(string xmlDoc) ;
00492                 
00497         void setFromMIMEFile(const string& directory);
00498         void setFromXMLFile(const string& directory);
00499         
00507         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00508   
00509         
00516          void setFromMIME(const string & mimeMsg);
00517         
00521         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00522         
00532           void toFile(string directory);
00533           
00542          void setFromFile(const string& directory);     
00543  
00544 };
00545 
00546 } // End namespace asdm
00547 
00548 #endif /* FocusTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines