CalDeviceTable.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 CalDeviceTable.h
00032  */
00033  
00034 #ifndef CalDeviceTable_CLASS
00035 #define CalDeviceTable_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 <Temperature.h>
00051 using  asdm::Temperature;
00052 
00053 #include <ArrayTimeInterval.h>
00054 using  asdm::ArrayTimeInterval;
00055 
00056 
00057 
00058 
00059         
00060 
00061         
00062 
00063         
00064 #include "CCalibrationDevice.h"
00065 using namespace CalibrationDeviceMod;
00066         
00067 
00068         
00069 
00070         
00071 
00072         
00073 
00074         
00075 
00076 
00077 
00078 #include <ConversionException.h>
00079 #include <DuplicateKey.h>
00080 #include <UniquenessViolationException.h>
00081 #include <NoSuchRow.h>
00082 #include <DuplicateKey.h>
00083 using asdm::DuplicateKey;
00084 using asdm::ConversionException;
00085 using asdm::NoSuchRow;
00086 using asdm::DuplicateKey;
00087 
00088 #ifndef WITHOUT_ACS
00089 #include <asdmIDLC.h>
00090 using asdmIDL::CalDeviceTableIDL;
00091 #endif
00092 
00093 #include <Representable.h>
00094 
00095 namespace asdm {
00096 
00097 //class asdm::ASDM;
00098 //class asdm::CalDeviceRow;
00099 
00100 class ASDM;
00101 class CalDeviceRow;
00207 class CalDeviceTable : public Representable {
00208         friend class ASDM;
00209 
00210 public:
00211 
00212 
00218         static vector<string> getKeyName();
00219 
00220 
00221         virtual ~CalDeviceTable();
00222         
00228         ASDM &getContainer() const;
00229         
00235         unsigned int size() ;
00236         
00242         string getName() const;
00243         
00249          static const vector<string>& getAttributesNames();
00250 
00254         Entity getEntity() const;
00255 
00260         void setEntity(Entity e);
00261                 
00269         string toXML()  ;
00270 
00271 #ifndef WITHOUT_ACS
00272         // Conversion Methods
00278         CalDeviceTableIDL *toIDL() ;
00279 #endif
00280 
00281 #ifndef WITHOUT_ACS
00282 
00288         void fromIDL(CalDeviceTableIDL x) ;
00289 #endif
00290         
00291         //
00292         // ====> Row creation.
00293         //
00294         
00299         CalDeviceRow *newRow();
00300         
00301         
00319         CalDeviceRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numCalload, vector<CalibrationDeviceMod::CalibrationDevice > calLoadNames);
00320         
00321 
00322 
00335          CalDeviceRow *newRow(CalDeviceRow *row); 
00336 
00337         //
00338         // ====> Append a row to its table.
00339         //
00340  
00341         
00358         CalDeviceRow* add(CalDeviceRow* x) ; 
00359 
00360  
00361 
00362 
00363 
00364         //
00365         // ====> Methods returning rows.
00366         //
00367                 
00373         vector<CalDeviceRow *> get() ;
00374         
00375 
00383          vector <CalDeviceRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId);
00384          
00385 
00386 
00387  
00388         
00404         CalDeviceRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId);
00405 
00406                 
00407 
00408 
00409 
00429         CalDeviceRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, int numCalload, vector<CalibrationDeviceMod::CalibrationDevice > calLoadNames); 
00430 
00431 
00432 private:
00433 
00442         CalDeviceTable (ASDM & container);
00443 
00444         ASDM & container;
00445         
00446         bool archiveAsBin; // If true archive binary else archive XML
00447         bool fileAsBin ; // If true file binary else file XML   
00448         
00449         Entity entity;
00450         
00451 
00452 
00456         static string tableName;
00457         
00461         static const vector<string> attributesNames;
00462         
00466         static vector<string> initAttributesNames();
00467 
00468 
00472         static vector<string> key;
00473 
00474 
00482         CalDeviceRow* checkAndAdd(CalDeviceRow* x) ;
00483 
00484 
00485         
00486         
00494          CalDeviceRow * insertByStartTime(CalDeviceRow* x, vector<CalDeviceRow* >& row);
00495           
00496 
00497 
00498 // A data structure to store the pointers on the table's rows.
00499 
00500 // In all cases we maintain a private vector of CalDeviceRow s.
00501    vector<CalDeviceRow * > privateRows;
00502    
00503 
00504         
00505 
00506         
00507         
00508                 
00509                                 
00510         typedef vector <CalDeviceRow* > TIME_ROWS;
00511         map<string, TIME_ROWS > context;
00512                 
00517          string Key(Tag antennaId, Tag spectralWindowId, int feedId) ;
00518                  
00519                 
00520         
00521         
00527         void getByKeyNoAutoIncNoTime(vector <CalDeviceRow*>& vin, vector <CalDeviceRow*>& vout,  Tag antennaId, Tag spectralWindowId, int feedId);
00528         
00529 
00530         
00531         void error() ; //throw(ConversionException);
00532 
00533         
00540         void fromXML(string xmlDoc) ;
00541                 
00546         void setFromMIMEFile(const string& directory);
00547         void setFromXMLFile(const string& directory);
00548         
00556         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00557   
00558         
00565          void setFromMIME(const string & mimeMsg);
00566         
00570         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00571         
00581           void toFile(string directory);
00582           
00591          void setFromFile(const string& directory);     
00592  
00593 };
00594 
00595 } // End namespace asdm
00596 
00597 #endif /* CalDeviceTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines