SBSummaryTable.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 SBSummaryTable.h
00032  */
00033  
00034 #ifndef SBSummaryTable_CLASS
00035 #define SBSummaryTable_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 <EntityRef.h>
00060 using  asdm::EntityRef;
00061 
00062 
00063 
00064 
00065         
00066 
00067         
00068 
00069         
00070 
00071         
00072 
00073         
00074 
00075         
00076 #include "CReceiverBand.h"
00077 using namespace ReceiverBandMod;
00078         
00079 
00080         
00081 #include "CSBType.h"
00082 using namespace SBTypeMod;
00083         
00084 
00085         
00086 
00087         
00088 
00089         
00090 
00091         
00092 
00093         
00094 
00095         
00096 
00097         
00098 
00099         
00100 
00101         
00102 
00103         
00104 #include "CDirectionReferenceCode.h"
00105 using namespace DirectionReferenceCodeMod;
00106         
00107 
00108         
00109 
00110 
00111 
00112 #include <ConversionException.h>
00113 #include <DuplicateKey.h>
00114 #include <UniquenessViolationException.h>
00115 #include <NoSuchRow.h>
00116 #include <DuplicateKey.h>
00117 using asdm::DuplicateKey;
00118 using asdm::ConversionException;
00119 using asdm::NoSuchRow;
00120 using asdm::DuplicateKey;
00121 
00122 #ifndef WITHOUT_ACS
00123 #include <asdmIDLC.h>
00124 using asdmIDL::SBSummaryTableIDL;
00125 #endif
00126 
00127 #include <Representable.h>
00128 
00129 namespace asdm {
00130 
00131 //class asdm::ASDM;
00132 //class asdm::SBSummaryRow;
00133 
00134 class ASDM;
00135 class SBSummaryRow;
00291 class SBSummaryTable : public Representable {
00292         friend class ASDM;
00293 
00294 public:
00295 
00296 
00302         static vector<string> getKeyName();
00303 
00304 
00305         virtual ~SBSummaryTable();
00306         
00312         ASDM &getContainer() const;
00313         
00319         unsigned int size() ;
00320         
00326         string getName() const;
00327         
00333          static const vector<string>& getAttributesNames();
00334 
00338         Entity getEntity() const;
00339 
00344         void setEntity(Entity e);
00345                 
00353         string toXML()  ;
00354 
00355 #ifndef WITHOUT_ACS
00356         // Conversion Methods
00362         SBSummaryTableIDL *toIDL() ;
00363 #endif
00364 
00365 #ifndef WITHOUT_ACS
00366 
00372         void fromIDL(SBSummaryTableIDL x) ;
00373 #endif
00374         
00375         //
00376         // ====> Row creation.
00377         //
00378         
00383         SBSummaryRow *newRow();
00384         
00385         
00421         SBSummaryRow *newRow(EntityRef sbSummaryUID, EntityRef projectUID, EntityRef obsUnitSetId, double frequency, ReceiverBandMod::ReceiverBand frequencyBand, SBTypeMod::SBType sbType, Interval sbDuration, vector<Angle > centerDirection, int numObservingMode, vector<string > observingMode, int numberRepeats, int numScienceGoal, vector<string > scienceGoal, int numWeatherConstraint, vector<string > weatherConstraint);
00422         
00423 
00424 
00437          SBSummaryRow *newRow(SBSummaryRow *row); 
00438 
00439         //
00440         // ====> Append a row to its table.
00441         //
00442 
00443         
00444         
00445         
00455          SBSummaryRow* add(SBSummaryRow* x) ;
00456 
00457 
00458 
00459         //
00460         // ====> Methods returning rows.
00461         //
00462                 
00468         vector<SBSummaryRow *> get() ;
00469         
00470 
00471 
00472  
00473         
00483         SBSummaryRow* getRowByKey(Tag sBSummaryId);
00484 
00485                 
00486 
00487 
00488 
00526         SBSummaryRow* lookup(EntityRef sbSummaryUID, EntityRef projectUID, EntityRef obsUnitSetId, double frequency, ReceiverBandMod::ReceiverBand frequencyBand, SBTypeMod::SBType sbType, Interval sbDuration, vector<Angle > centerDirection, int numObservingMode, vector<string > observingMode, int numberRepeats, int numScienceGoal, vector<string > scienceGoal, int numWeatherConstraint, vector<string > weatherConstraint); 
00527 
00528 
00529 private:
00530 
00539         SBSummaryTable (ASDM & container);
00540 
00541         ASDM & container;
00542         
00543         bool archiveAsBin; // If true archive binary else archive XML
00544         bool fileAsBin ; // If true file binary else file XML   
00545         
00546         Entity entity;
00547         
00548 
00549         // A map for the autoincrementation algorithm
00550         map<string,int>  noAutoIncIds;
00551         void autoIncrement(string key, SBSummaryRow* x);
00552 
00553 
00557         static string tableName;
00558         
00562         static const vector<string> attributesNames;
00563         
00567         static vector<string> initAttributesNames();
00568 
00569 
00573         static vector<string> key;
00574 
00575 
00585         SBSummaryRow* checkAndAdd(SBSummaryRow* x) ;
00586 
00587 
00588 
00589 // A data structure to store the pointers on the table's rows.
00590 
00591 // In all cases we maintain a private vector of SBSummaryRow s.
00592    vector<SBSummaryRow * > privateRows;
00593    
00594 
00595                         
00596         vector<SBSummaryRow *> row;
00597 
00598         
00599         void error() ; //throw(ConversionException);
00600 
00601         
00608         void fromXML(string xmlDoc) ;
00609                 
00614         void setFromMIMEFile(const string& directory);
00615         void setFromXMLFile(const string& directory);
00616         
00624         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00625   
00626         
00633          void setFromMIME(const string & mimeMsg);
00634         
00638         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00639         
00649           void toFile(string directory);
00650           
00659          void setFromFile(const string& directory);     
00660  
00661 };
00662 
00663 } // End namespace asdm
00664 
00665 #endif /* SBSummaryTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines