SquareLawDetectorTable.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 SquareLawDetectorTable.h
00032  */
00033  
00034 #ifndef SquareLawDetectorTable_CLASS
00035 #define SquareLawDetectorTable_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 
00051 
00052 
00053         
00054 
00055         
00056 
00057         
00058 #include "CDetectorBandType.h"
00059 using namespace DetectorBandTypeMod;
00060         
00061 
00062 
00063 
00064 #include <ConversionException.h>
00065 #include <DuplicateKey.h>
00066 #include <UniquenessViolationException.h>
00067 #include <NoSuchRow.h>
00068 #include <DuplicateKey.h>
00069 using asdm::DuplicateKey;
00070 using asdm::ConversionException;
00071 using asdm::NoSuchRow;
00072 using asdm::DuplicateKey;
00073 
00074 #ifndef WITHOUT_ACS
00075 #include <asdmIDLC.h>
00076 using asdmIDL::SquareLawDetectorTableIDL;
00077 #endif
00078 
00079 #include <Representable.h>
00080 
00081 namespace asdm {
00082 
00083 //class asdm::ASDM;
00084 //class asdm::SquareLawDetectorRow;
00085 
00086 class ASDM;
00087 class SquareLawDetectorRow;
00135 class SquareLawDetectorTable : public Representable {
00136         friend class ASDM;
00137 
00138 public:
00139 
00140 
00146         static vector<string> getKeyName();
00147 
00148 
00149         virtual ~SquareLawDetectorTable();
00150         
00156         ASDM &getContainer() const;
00157         
00163         unsigned int size() ;
00164         
00170         string getName() const;
00171         
00177          static const vector<string>& getAttributesNames();
00178 
00182         Entity getEntity() const;
00183 
00188         void setEntity(Entity e);
00189                 
00197         string toXML()  ;
00198 
00199 #ifndef WITHOUT_ACS
00200         // Conversion Methods
00206         SquareLawDetectorTableIDL *toIDL() ;
00207 #endif
00208 
00209 #ifndef WITHOUT_ACS
00210 
00216         void fromIDL(SquareLawDetectorTableIDL x) ;
00217 #endif
00218         
00219         //
00220         // ====> Row creation.
00221         //
00222         
00227         SquareLawDetectorRow *newRow();
00228         
00229         
00239         SquareLawDetectorRow *newRow(int numBand, DetectorBandTypeMod::DetectorBandType bandType);
00240         
00241 
00242 
00255          SquareLawDetectorRow *newRow(SquareLawDetectorRow *row); 
00256 
00257         //
00258         // ====> Append a row to its table.
00259         //
00260 
00261         
00262         
00263         
00273          SquareLawDetectorRow* add(SquareLawDetectorRow* x) ;
00274 
00275 
00276 
00277         //
00278         // ====> Methods returning rows.
00279         //
00280                 
00286         vector<SquareLawDetectorRow *> get() ;
00287         
00288 
00289 
00290  
00291         
00301         SquareLawDetectorRow* getRowByKey(Tag squareLawDetectorId);
00302 
00303                 
00304 
00305 
00306 
00318         SquareLawDetectorRow* lookup(int numBand, DetectorBandTypeMod::DetectorBandType bandType); 
00319 
00320 
00321 private:
00322 
00331         SquareLawDetectorTable (ASDM & container);
00332 
00333         ASDM & container;
00334         
00335         bool archiveAsBin; // If true archive binary else archive XML
00336         bool fileAsBin ; // If true file binary else file XML   
00337         
00338         Entity entity;
00339         
00340 
00341         // A map for the autoincrementation algorithm
00342         map<string,int>  noAutoIncIds;
00343         void autoIncrement(string key, SquareLawDetectorRow* x);
00344 
00345 
00349         static string tableName;
00350         
00354         static const vector<string> attributesNames;
00355         
00359         static vector<string> initAttributesNames();
00360 
00361 
00365         static vector<string> key;
00366 
00367 
00377         SquareLawDetectorRow* checkAndAdd(SquareLawDetectorRow* x) ;
00378 
00379 
00380 
00381 // A data structure to store the pointers on the table's rows.
00382 
00383 // In all cases we maintain a private vector of SquareLawDetectorRow s.
00384    vector<SquareLawDetectorRow * > privateRows;
00385    
00386 
00387                         
00388         vector<SquareLawDetectorRow *> row;
00389 
00390         
00391         void error() ; //throw(ConversionException);
00392 
00393         
00400         void fromXML(string xmlDoc) ;
00401                 
00406         void setFromMIMEFile(const string& directory);
00407         void setFromXMLFile(const string& directory);
00408         
00416         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00417   
00418         
00425          void setFromMIME(const string & mimeMsg);
00426         
00430         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00431         
00441           void toFile(string directory);
00442           
00451          void setFromFile(const string& directory);     
00452  
00453 };
00454 
00455 } // End namespace asdm
00456 
00457 #endif /* SquareLawDetectorTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines