CalDataTable.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 CalDataTable.h
00032  */
00033  
00034 #ifndef CalDataTable_CLASS
00035 #define CalDataTable_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 <EntityRef.h>
00054 using  asdm::EntityRef;
00055 
00056 
00057 
00058 
00059         
00060 
00061         
00062 
00063         
00064 
00065         
00066 
00067         
00068 #include "CCalDataOrigin.h"
00069 using namespace CalDataOriginMod;
00070         
00071 
00072         
00073 #include "CCalType.h"
00074 using namespace CalTypeMod;
00075         
00076 
00077         
00078 
00079         
00080 
00081         
00082 
00083         
00084 #include "CAssociatedCalNature.h"
00085 using namespace AssociatedCalNatureMod;
00086         
00087 
00088         
00089 
00090         
00091 
00092         
00093 
00094         
00095 #include "CScanIntent.h"
00096 using namespace ScanIntentMod;
00097         
00098 
00099 
00100 
00101 #include <ConversionException.h>
00102 #include <DuplicateKey.h>
00103 #include <UniquenessViolationException.h>
00104 #include <NoSuchRow.h>
00105 #include <DuplicateKey.h>
00106 using asdm::DuplicateKey;
00107 using asdm::ConversionException;
00108 using asdm::NoSuchRow;
00109 using asdm::DuplicateKey;
00110 
00111 #ifndef WITHOUT_ACS
00112 #include <asdmIDLC.h>
00113 using asdmIDL::CalDataTableIDL;
00114 #endif
00115 
00116 #include <Representable.h>
00117 
00118 namespace asdm {
00119 
00120 //class asdm::ASDM;
00121 //class asdm::CalDataRow;
00122 
00123 class ASDM;
00124 class CalDataRow;
00252 class CalDataTable : public Representable {
00253         friend class ASDM;
00254 
00255 public:
00256 
00257 
00263         static vector<string> getKeyName();
00264 
00265 
00266         virtual ~CalDataTable();
00267         
00273         ASDM &getContainer() const;
00274         
00280         unsigned int size() ;
00281         
00287         string getName() const;
00288         
00294          static const vector<string>& getAttributesNames();
00295 
00299         Entity getEntity() const;
00300 
00305         void setEntity(Entity e);
00306                 
00314         string toXML()  ;
00315 
00316 #ifndef WITHOUT_ACS
00317         // Conversion Methods
00323         CalDataTableIDL *toIDL() ;
00324 #endif
00325 
00326 #ifndef WITHOUT_ACS
00327 
00333         void fromIDL(CalDataTableIDL x) ;
00334 #endif
00335         
00336         //
00337         // ====> Row creation.
00338         //
00339         
00344         CalDataRow *newRow();
00345         
00346         
00366         CalDataRow *newRow(ArrayTime startTimeObserved, ArrayTime endTimeObserved, EntityRef execBlockUID, CalDataOriginMod::CalDataOrigin calDataType, CalTypeMod::CalType calType, int numScan, vector<int > scanSet);
00367         
00368 
00369 
00382          CalDataRow *newRow(CalDataRow *row); 
00383 
00384         //
00385         // ====> Append a row to its table.
00386         //
00387 
00388         
00389         
00390         
00400          CalDataRow* add(CalDataRow* x) ;
00401 
00402 
00403 
00404         //
00405         // ====> Methods returning rows.
00406         //
00407                 
00413         vector<CalDataRow *> get() ;
00414         
00415 
00416 
00417  
00418         
00428         CalDataRow* getRowByKey(Tag calDataId);
00429 
00430                 
00431 
00432 
00433 
00455         CalDataRow* lookup(ArrayTime startTimeObserved, ArrayTime endTimeObserved, EntityRef execBlockUID, CalDataOriginMod::CalDataOrigin calDataType, CalTypeMod::CalType calType, int numScan, vector<int > scanSet); 
00456 
00457 
00458 private:
00459 
00468         CalDataTable (ASDM & container);
00469 
00470         ASDM & container;
00471         
00472         bool archiveAsBin; // If true archive binary else archive XML
00473         bool fileAsBin ; // If true file binary else file XML   
00474         
00475         Entity entity;
00476         
00477 
00478         // A map for the autoincrementation algorithm
00479         map<string,int>  noAutoIncIds;
00480         void autoIncrement(string key, CalDataRow* x);
00481 
00482 
00486         static string tableName;
00487         
00491         static const vector<string> attributesNames;
00492         
00496         static vector<string> initAttributesNames();
00497 
00498 
00502         static vector<string> key;
00503 
00504 
00514         CalDataRow* checkAndAdd(CalDataRow* x) ;
00515 
00516 
00517 
00518 // A data structure to store the pointers on the table's rows.
00519 
00520 // In all cases we maintain a private vector of CalDataRow s.
00521    vector<CalDataRow * > privateRows;
00522    
00523 
00524                         
00525         vector<CalDataRow *> row;
00526 
00527         
00528         void error() ; //throw(ConversionException);
00529 
00530         
00537         void fromXML(string xmlDoc) ;
00538                 
00543         void setFromMIMEFile(const string& directory);
00544         void setFromXMLFile(const string& directory);
00545         
00553         string toMIME(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00554   
00555         
00562          void setFromMIME(const string & mimeMsg);
00563         
00567         string MIMEXMLPart(const asdm::ByteOrder* byteOrder=asdm::ByteOrder::Machine_Endianity);
00568         
00578           void toFile(string directory);
00579           
00588          void setFromFile(const string& directory);     
00589  
00590 };
00591 
00592 } // End namespace asdm
00593 
00594 #endif /* CalDataTable_CLASS */
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines