AntennaTable.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 AntennaTable.h
00032  */
00033  
00034 #ifndef AntennaTable_CLASS
00035 #define AntennaTable_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 #include <Length.h>
00054 using  asdm::Length;
00055 
00056 
00057 
00058 
00059         
00060 
00061         
00062 
00063         
00064 #include "CAntennaMake.h"
00065 using namespace AntennaMakeMod;
00066         
00067 
00068         
00069 #include "CAntennaType.h"
00070 using namespace AntennaTypeMod;
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::AntennaTableIDL;
00096 #endif
00097 
00098 #include <Representable.h>
00099 
00100 namespace asdm {
00101 
00102 //class asdm::ASDM;
00103 //class asdm::AntennaRow;
00104 
00105 class ASDM;
00106 class AntennaRow;
00206 class AntennaTable : public Representable {
00207         friend class ASDM;
00208 
00209 public:
00210 
00211 
00217         static vector<string> getKeyName();
00218 
00219 
00220         virtual ~AntennaTable();
00221         
00227         ASDM &getContainer() const;
00228         
00234         unsigned int size() ;
00235         
00241         string getName() const;
00242         
00248          static const vector<string>& getAttributesNames();
00249 
00253         Entity getEntity() const;
00254 
00259         void setEntity(Entity e);
00260                 
00268         string toXML()  ;
00269 
00270 #ifndef WITHOUT_ACS
00271         // Conversion Methods
00277         AntennaTableIDL *toIDL() ;
00278 #endif
00279 
00280 #ifndef WITHOUT_ACS
00281 
00287         void fromIDL(AntennaTableIDL x) ;
00288 #endif
00289         
00290         //
00291         // ====> Row creation.
00292         //
00293         
00298         AntennaRow *newRow();
00299         
00300         
00322         AntennaRow *newRow(string name, AntennaMakeMod::AntennaMake antennaMake, AntennaTypeMod::AntennaType antennaType, Length dishDiameter, vector<Length > position, vector<Length > offset, ArrayTime time, Tag stationId);
00323         
00324 
00325 
00338          AntennaRow *newRow(AntennaRow *row); 
00339 
00340         //
00341         // ====> Append a row to its table.
00342         //
00343 
00344         
00345         
00346         
00356          AntennaRow* add(AntennaRow* x) ;
00357 
00358 
00359 
00360         //
00361         // ====> Methods returning rows.
00362         //
00363                 
00369         vector<AntennaRow *> get() ;
00370         
00371 
00372 
00373  
00374         
00384         AntennaRow* getRowByKey(Tag antennaId);
00385 
00386                 
00387 
00388 
00389 
00413         AntennaRow* lookup(string name, AntennaMakeMod::AntennaMake antennaMake, AntennaTypeMod::AntennaType antennaType, Length dishDiameter, vector<Length > position, vector<Length > offset, ArrayTime time, Tag stationId); 
00414 
00415 
00416 private:
00417 
00426         AntennaTable (ASDM & container);
00427 
00428         ASDM & container;
00429         
00430         bool archiveAsBin; // If true archive binary else archive XML
00431         bool fileAsBin ; // If true file binary else file XML   
00432         
00433         Entity entity;
00434         
00435 
00436         // A map for the autoincrementation algorithm
00437         map<string,int>  noAutoIncIds;
00438         void autoIncrement(string key, AntennaRow* x);
00439 
00440 
00444         static string tableName;
00445         
00449         static const vector<string> attributesNames;
00450         
00454         static vector<string> initAttributesNames();
00455 
00456 
00460         static vector<string> key;
00461 
00462 
00472         AntennaRow* checkAndAdd(AntennaRow* x) ;
00473 
00474 
00475 
00476 // A data structure to store the pointers on the table's rows.
00477 
00478 // In all cases we maintain a private vector of AntennaRow s.
00479    vector<AntennaRow * > privateRows;
00480    
00481 
00482                         
00483         vector<AntennaRow *> row;
00484 
00485         
00486         void error() ; //throw(ConversionException);
00487 
00488         
00495         void fromXML(string xmlDoc) ;
00496                 
00501         void setFromMIMEFile(const string& directory);
00502         void setFromXMLFile(const string& directory);
00503         
00511         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00512   
00513         
00520          void setFromMIME(const string & mimeMsg);
00521         
00525         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00526         
00536           void toFile(string directory);
00537           
00546          void setFromFile(const string& directory);     
00547  
00548 };
00549 
00550 } // End namespace asdm
00551 
00552 #endif /* AntennaTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines