SwitchCycleTable.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 SwitchCycleTable.h
00032  */
00033  
00034 #ifndef SwitchCycleTable_CLASS
00035 #define SwitchCycleTable_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 <Angle.h>
00051 using  asdm::Angle;
00052 
00053 #include <Interval.h>
00054 using  asdm::Interval;
00055 
00056 #include <Tag.h>
00057 using  asdm::Tag;
00058 
00059 #include <Frequency.h>
00060 using  asdm::Frequency;
00061 
00062 
00063 
00064 
00065         
00066 
00067         
00068 
00069         
00070 
00071         
00072 
00073         
00074 
00075         
00076 
00077         
00078 #include "CDirectionReferenceCode.h"
00079 using namespace DirectionReferenceCodeMod;
00080         
00081 
00082         
00083 
00084 
00085 
00086 #include <ConversionException.h>
00087 #include <DuplicateKey.h>
00088 #include <UniquenessViolationException.h>
00089 #include <NoSuchRow.h>
00090 #include <DuplicateKey.h>
00091 using asdm::DuplicateKey;
00092 using asdm::ConversionException;
00093 using asdm::NoSuchRow;
00094 using asdm::DuplicateKey;
00095 
00096 #ifndef WITHOUT_ACS
00097 #include <asdmIDLC.h>
00098 using asdmIDL::SwitchCycleTableIDL;
00099 #endif
00100 
00101 #include <Representable.h>
00102 
00103 namespace asdm {
00104 
00105 //class asdm::ASDM;
00106 //class asdm::SwitchCycleRow;
00107 
00108 class ASDM;
00109 class SwitchCycleRow;
00195 class SwitchCycleTable : public Representable {
00196         friend class ASDM;
00197 
00198 public:
00199 
00200 
00206         static vector<string> getKeyName();
00207 
00208 
00209         virtual ~SwitchCycleTable();
00210         
00216         ASDM &getContainer() const;
00217         
00223         unsigned int size() ;
00224         
00230         string getName() const;
00231         
00237          static const vector<string>& getAttributesNames();
00238 
00242         Entity getEntity() const;
00243 
00248         void setEntity(Entity e);
00249                 
00257         string toXML()  ;
00258 
00259 #ifndef WITHOUT_ACS
00260         // Conversion Methods
00266         SwitchCycleTableIDL *toIDL() ;
00267 #endif
00268 
00269 #ifndef WITHOUT_ACS
00270 
00276         void fromIDL(SwitchCycleTableIDL x) ;
00277 #endif
00278         
00279         //
00280         // ====> Row creation.
00281         //
00282         
00287         SwitchCycleRow *newRow();
00288         
00289         
00305         SwitchCycleRow *newRow(int numStep, vector<float > weightArray, vector<vector<Angle > > dirOffsetArray, vector<Frequency > freqOffsetArray, vector<Interval > stepDurationArray);
00306         
00307 
00308 
00321          SwitchCycleRow *newRow(SwitchCycleRow *row); 
00322 
00323         //
00324         // ====> Append a row to its table.
00325         //
00326 
00327         
00328         
00329         
00339          SwitchCycleRow* add(SwitchCycleRow* x) ;
00340 
00341 
00342 
00343         //
00344         // ====> Methods returning rows.
00345         //
00346                 
00352         vector<SwitchCycleRow *> get() ;
00353         
00354 
00355 
00356  
00357         
00367         SwitchCycleRow* getRowByKey(Tag switchCycleId);
00368 
00369                 
00370 
00371 
00372 
00390         SwitchCycleRow* lookup(int numStep, vector<float > weightArray, vector<vector<Angle > > dirOffsetArray, vector<Frequency > freqOffsetArray, vector<Interval > stepDurationArray); 
00391 
00392 
00393 private:
00394 
00403         SwitchCycleTable (ASDM & container);
00404 
00405         ASDM & container;
00406         
00407         bool archiveAsBin; // If true archive binary else archive XML
00408         bool fileAsBin ; // If true file binary else file XML   
00409         
00410         Entity entity;
00411         
00412 
00413         // A map for the autoincrementation algorithm
00414         map<string,int>  noAutoIncIds;
00415         void autoIncrement(string key, SwitchCycleRow* x);
00416 
00417 
00421         static string tableName;
00422         
00426         static const vector<string> attributesNames;
00427         
00431         static vector<string> initAttributesNames();
00432 
00433 
00437         static vector<string> key;
00438 
00439 
00449         SwitchCycleRow* checkAndAdd(SwitchCycleRow* x) ;
00450 
00451 
00452 
00453 // A data structure to store the pointers on the table's rows.
00454 
00455 // In all cases we maintain a private vector of SwitchCycleRow s.
00456    vector<SwitchCycleRow * > privateRows;
00457    
00458 
00459                         
00460         vector<SwitchCycleRow *> row;
00461 
00462         
00463         void error() ; //throw(ConversionException);
00464 
00465         
00472         void fromXML(string xmlDoc) ;
00473                 
00478         void setFromMIMEFile(const string& directory);
00479         void setFromXMLFile(const string& directory);
00480         
00488         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00489   
00490         
00497          void setFromMIME(const string & mimeMsg);
00498         
00502         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00503         
00513           void toFile(string directory);
00514           
00523          void setFromFile(const string& directory);     
00524  
00525 };
00526 
00527 } // End namespace asdm
00528 
00529 #endif /* SwitchCycleTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines