ProcessorTable.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 ProcessorTable.h
00032  */
00033  
00034 #ifndef ProcessorTable_CLASS
00035 #define ProcessorTable_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 "CProcessorType.h"
00059 using namespace ProcessorTypeMod;
00060         
00061 
00062         
00063 #include "CProcessorSubType.h"
00064 using namespace ProcessorSubTypeMod;
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::ProcessorTableIDL;
00082 #endif
00083 
00084 #include <Representable.h>
00085 
00086 namespace asdm {
00087 
00088 //class asdm::ASDM;
00089 //class asdm::ProcessorRow;
00090 
00091 class ASDM;
00092 class ProcessorRow;
00147 class ProcessorTable : public Representable {
00148         friend class ASDM;
00149 
00150 public:
00151 
00152 
00158         static vector<string> getKeyName();
00159 
00160 
00161         virtual ~ProcessorTable();
00162         
00168         ASDM &getContainer() const;
00169         
00175         unsigned int size() ;
00176         
00182         string getName() const;
00183         
00189          static const vector<string>& getAttributesNames();
00190 
00194         Entity getEntity() const;
00195 
00200         void setEntity(Entity e);
00201                 
00209         string toXML()  ;
00210 
00211 #ifndef WITHOUT_ACS
00212         // Conversion Methods
00218         ProcessorTableIDL *toIDL() ;
00219 #endif
00220 
00221 #ifndef WITHOUT_ACS
00222 
00228         void fromIDL(ProcessorTableIDL x) ;
00229 #endif
00230         
00231         //
00232         // ====> Row creation.
00233         //
00234         
00239         ProcessorRow *newRow();
00240         
00241         
00253         ProcessorRow *newRow(Tag modeId, ProcessorTypeMod::ProcessorType processorType, ProcessorSubTypeMod::ProcessorSubType processorSubType);
00254         
00255 
00256 
00269          ProcessorRow *newRow(ProcessorRow *row); 
00270 
00271         //
00272         // ====> Append a row to its table.
00273         //
00274 
00275         
00276         
00277         
00287          ProcessorRow* add(ProcessorRow* x) ;
00288 
00289 
00290 
00291         //
00292         // ====> Methods returning rows.
00293         //
00294                 
00300         vector<ProcessorRow *> get() ;
00301         
00302 
00303 
00304  
00305         
00315         ProcessorRow* getRowByKey(Tag processorId);
00316 
00317                 
00318 
00319 
00320 
00334         ProcessorRow* lookup(Tag modeId, ProcessorTypeMod::ProcessorType processorType, ProcessorSubTypeMod::ProcessorSubType processorSubType); 
00335 
00336 
00337 private:
00338 
00347         ProcessorTable (ASDM & container);
00348 
00349         ASDM & container;
00350         
00351         bool archiveAsBin; // If true archive binary else archive XML
00352         bool fileAsBin ; // If true file binary else file XML   
00353         
00354         Entity entity;
00355         
00356 
00357         // A map for the autoincrementation algorithm
00358         map<string,int>  noAutoIncIds;
00359         void autoIncrement(string key, ProcessorRow* x);
00360 
00361 
00365         static string tableName;
00366         
00370         static const vector<string> attributesNames;
00371         
00375         static vector<string> initAttributesNames();
00376 
00377 
00381         static vector<string> key;
00382 
00383 
00393         ProcessorRow* checkAndAdd(ProcessorRow* x) ;
00394 
00395 
00396 
00397 // A data structure to store the pointers on the table's rows.
00398 
00399 // In all cases we maintain a private vector of ProcessorRow s.
00400    vector<ProcessorRow * > privateRows;
00401    
00402 
00403                         
00404         vector<ProcessorRow *> row;
00405 
00406         
00407         void error() ; //throw(ConversionException);
00408 
00409         
00416         void fromXML(string xmlDoc) ;
00417                 
00422         void setFromMIMEFile(const string& directory);
00423         void setFromXMLFile(const string& directory);
00424         
00432         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00433   
00434         
00441          void setFromMIME(const string & mimeMsg);
00442         
00446         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00447         
00457           void toFile(string directory);
00458           
00467          void setFromFile(const string& directory);     
00468  
00469 };
00470 
00471 } // End namespace asdm
00472 
00473 #endif /* ProcessorTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines