FreqOffsetTable.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 FreqOffsetTable.h
00032  */
00033  
00034 #ifndef FreqOffsetTable_CLASS
00035 #define FreqOffsetTable_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 #include <Frequency.h>
00051 using  asdm::Frequency;
00052 
00053 #include <ArrayTimeInterval.h>
00054 using  asdm::ArrayTimeInterval;
00055 
00056 
00057 
00058 
00059         
00060 
00061         
00062 
00063 
00064 
00065 #include <ConversionException.h>
00066 #include <DuplicateKey.h>
00067 #include <UniquenessViolationException.h>
00068 #include <NoSuchRow.h>
00069 #include <DuplicateKey.h>
00070 using asdm::DuplicateKey;
00071 using asdm::ConversionException;
00072 using asdm::NoSuchRow;
00073 using asdm::DuplicateKey;
00074 
00075 #ifndef WITHOUT_ACS
00076 #include <asdmIDLC.h>
00077 using asdmIDL::FreqOffsetTableIDL;
00078 #endif
00079 
00080 #include <Representable.h>
00081 
00082 namespace asdm {
00083 
00084 //class asdm::ASDM;
00085 //class asdm::FreqOffsetRow;
00086 
00087 class ASDM;
00088 class FreqOffsetRow;
00156 class FreqOffsetTable : public Representable {
00157         friend class ASDM;
00158 
00159 public:
00160 
00161 
00167         static vector<string> getKeyName();
00168 
00169 
00170         virtual ~FreqOffsetTable();
00171         
00177         ASDM &getContainer() const;
00178         
00184         unsigned int size() ;
00185         
00191         string getName() const;
00192         
00198          static const vector<string>& getAttributesNames();
00199 
00203         Entity getEntity() const;
00204 
00209         void setEntity(Entity e);
00210                 
00218         string toXML()  ;
00219 
00220 #ifndef WITHOUT_ACS
00221         // Conversion Methods
00227         FreqOffsetTableIDL *toIDL() ;
00228 #endif
00229 
00230 #ifndef WITHOUT_ACS
00231 
00237         void fromIDL(FreqOffsetTableIDL x) ;
00238 #endif
00239         
00240         //
00241         // ====> Row creation.
00242         //
00243         
00248         FreqOffsetRow *newRow();
00249         
00250         
00266         FreqOffsetRow *newRow(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, Frequency offset);
00267         
00268 
00269 
00282          FreqOffsetRow *newRow(FreqOffsetRow *row); 
00283 
00284         //
00285         // ====> Append a row to its table.
00286         //
00287  
00288         
00305         FreqOffsetRow* add(FreqOffsetRow* x) ; 
00306 
00307  
00308 
00309 
00310 
00311         //
00312         // ====> Methods returning rows.
00313         //
00314                 
00320         vector<FreqOffsetRow *> get() ;
00321         
00322 
00330          vector <FreqOffsetRow*> *getByContext(Tag antennaId, Tag spectralWindowId, int feedId);
00331          
00332 
00333 
00334  
00335         
00351         FreqOffsetRow* getRowByKey(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId);
00352 
00353                 
00354 
00355 
00356 
00374         FreqOffsetRow* lookup(Tag antennaId, Tag spectralWindowId, ArrayTimeInterval timeInterval, int feedId, Frequency offset); 
00375 
00376 
00377 private:
00378 
00387         FreqOffsetTable (ASDM & container);
00388 
00389         ASDM & container;
00390         
00391         bool archiveAsBin; // If true archive binary else archive XML
00392         bool fileAsBin ; // If true file binary else file XML   
00393         
00394         Entity entity;
00395         
00396 
00397 
00401         static string tableName;
00402         
00406         static const vector<string> attributesNames;
00407         
00411         static vector<string> initAttributesNames();
00412 
00413 
00417         static vector<string> key;
00418 
00419 
00427         FreqOffsetRow* checkAndAdd(FreqOffsetRow* x) ;
00428 
00429 
00430         
00431         
00439          FreqOffsetRow * insertByStartTime(FreqOffsetRow* x, vector<FreqOffsetRow* >& row);
00440           
00441 
00442 
00443 // A data structure to store the pointers on the table's rows.
00444 
00445 // In all cases we maintain a private vector of FreqOffsetRow s.
00446    vector<FreqOffsetRow * > privateRows;
00447    
00448 
00449         
00450 
00451         
00452         
00453                 
00454                                 
00455         typedef vector <FreqOffsetRow* > TIME_ROWS;
00456         map<string, TIME_ROWS > context;
00457                 
00462          string Key(Tag antennaId, Tag spectralWindowId, int feedId) ;
00463                  
00464                 
00465         
00466         
00472         void getByKeyNoAutoIncNoTime(vector <FreqOffsetRow*>& vin, vector <FreqOffsetRow*>& vout,  Tag antennaId, Tag spectralWindowId, int feedId);
00473         
00474 
00475         
00476         void error() ; //throw(ConversionException);
00477 
00478         
00485         void fromXML(string xmlDoc) ;
00486                 
00491         void setFromMIMEFile(const string& directory);
00492         void setFromXMLFile(const string& directory);
00493         
00501         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00502   
00503         
00510          void setFromMIME(const string & mimeMsg);
00511         
00515         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00516         
00526           void toFile(string directory);
00527           
00536          void setFromFile(const string& directory);     
00537  
00538 };
00539 
00540 } // End namespace asdm
00541 
00542 #endif /* FreqOffsetTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines