CalReductionTable.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 CalReductionTable.h
00032  */
00033  
00034 #ifndef CalReductionTable_CLASS
00035 #define CalReductionTable_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 <ArrayTime.h>
00048 using  asdm::ArrayTime;
00049 
00050 #include <Tag.h>
00051 using  asdm::Tag;
00052 
00053 
00054 
00055 
00056         
00057 
00058         
00059 
00060         
00061 
00062         
00063 
00064         
00065 
00066         
00067 
00068         
00069 #include "CInvalidatingCondition.h"
00070 using namespace InvalidatingConditionMod;
00071         
00072 
00073         
00074 
00075         
00076 
00077         
00078 
00079         
00080 
00081 
00082 
00083 #include <ConversionException.h>
00084 #include <DuplicateKey.h>
00085 #include <UniquenessViolationException.h>
00086 #include <NoSuchRow.h>
00087 #include <DuplicateKey.h>
00088 using asdm::DuplicateKey;
00089 using asdm::ConversionException;
00090 using asdm::NoSuchRow;
00091 using asdm::DuplicateKey;
00092 
00093 #ifndef WITHOUT_ACS
00094 #include <asdmIDLC.h>
00095 using asdmIDL::CalReductionTableIDL;
00096 #endif
00097 
00098 #include <Representable.h>
00099 
00100 namespace asdm {
00101 
00102 //class asdm::ASDM;
00103 //class asdm::CalReductionRow;
00104 
00105 class ASDM;
00106 class CalReductionRow;
00210 class CalReductionTable : public Representable {
00211         friend class ASDM;
00212 
00213 public:
00214 
00215 
00221         static vector<string> getKeyName();
00222 
00223 
00224         virtual ~CalReductionTable();
00225         
00231         ASDM &getContainer() const;
00232         
00238         unsigned int size() ;
00239         
00245         string getName() const;
00246         
00252          static const vector<string>& getAttributesNames();
00253 
00257         Entity getEntity() const;
00258 
00263         void setEntity(Entity e);
00264                 
00272         string toXML()  ;
00273 
00274 #ifndef WITHOUT_ACS
00275         // Conversion Methods
00281         CalReductionTableIDL *toIDL() ;
00282 #endif
00283 
00284 #ifndef WITHOUT_ACS
00285 
00291         void fromIDL(CalReductionTableIDL x) ;
00292 #endif
00293         
00294         //
00295         // ====> Row creation.
00296         //
00297         
00302         CalReductionRow *newRow();
00303         
00304         
00330         CalReductionRow *newRow(int numApplied, vector<string > appliedCalibrations, int numParam, vector<string > paramSet, int numInvalidConditions, vector<InvalidatingConditionMod::InvalidatingCondition > invalidConditions, ArrayTime timeReduced, string messages, string software, string softwareVersion);
00331         
00332 
00333 
00346          CalReductionRow *newRow(CalReductionRow *row); 
00347 
00348         //
00349         // ====> Append a row to its table.
00350         //
00351 
00352         
00353         
00354         
00364          CalReductionRow* add(CalReductionRow* x) ;
00365 
00366 
00367 
00368         //
00369         // ====> Methods returning rows.
00370         //
00371                 
00377         vector<CalReductionRow *> get() ;
00378         
00379 
00380 
00381  
00382         
00392         CalReductionRow* getRowByKey(Tag calReductionId);
00393 
00394                 
00395 
00396 
00397 
00425         CalReductionRow* lookup(int numApplied, vector<string > appliedCalibrations, int numParam, vector<string > paramSet, int numInvalidConditions, vector<InvalidatingConditionMod::InvalidatingCondition > invalidConditions, ArrayTime timeReduced, string messages, string software, string softwareVersion); 
00426 
00427 
00428 private:
00429 
00438         CalReductionTable (ASDM & container);
00439 
00440         ASDM & container;
00441         
00442         bool archiveAsBin; // If true archive binary else archive XML
00443         bool fileAsBin ; // If true file binary else file XML   
00444         
00445         Entity entity;
00446         
00447 
00448         // A map for the autoincrementation algorithm
00449         map<string,int>  noAutoIncIds;
00450         void autoIncrement(string key, CalReductionRow* x);
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 
00484         CalReductionRow* checkAndAdd(CalReductionRow* x) ;
00485 
00486 
00487 
00488 // A data structure to store the pointers on the table's rows.
00489 
00490 // In all cases we maintain a private vector of CalReductionRow s.
00491    vector<CalReductionRow * > privateRows;
00492    
00493 
00494                         
00495         vector<CalReductionRow *> row;
00496 
00497         
00498         void error() ; //throw(ConversionException);
00499 
00500         
00507         void fromXML(string xmlDoc) ;
00508                 
00513         void setFromMIMEFile(const string& directory);
00514         void setFromXMLFile(const string& directory);
00515         
00523         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00524   
00525         
00532          void setFromMIME(const string & mimeMsg);
00533         
00537         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00538         
00548           void toFile(string directory);
00549           
00558          void setFromFile(const string& directory);     
00559  
00560 };
00561 
00562 } // End namespace asdm
00563 
00564 #endif /* CalReductionTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines