DataBuilderFactory.hxx

Go to the documentation of this file.
00001 
00002 
00003 
00004 //-----------------------------------------------------------------------------
00005 // SVN: $Id: DataBuilderFactory.hxx 6286 2009-11-06 09:47:45Z EckhardSutorius $
00006 //-----------------------------------------------------------------------------
00007 #ifndef DBFACTORY_H
00008 #define DBFACTORY_H
00009 
00010 #include <string>
00011 
00012 #include "Catalog.hxx"
00013 #include "DataBuilder.hxx"
00014 #include "Extension.hxx"
00015 #include "MyException.h"
00016 #include "Primary.hxx"
00017 #include "Provenance.hxx"
00018 #include "TableInfo.h"
00019 //-----------------------------------------------------------------------------
00021 class DataBuilderFactoryException : public MyException
00022 {
00023 public:
00024   DataBuilderFactoryException(const string& aMsg)
00025     : MyException("DataBuilderFactoryException: ", aMsg) { }
00026 };
00027 //-----------------------------------------------------------------------------
00029 template<typename DataType>
00030 DataBuilder<DataType>* select(const TableInfo& info)
00031 {
00032   std::string tableName = info.getTableName();
00033 
00034   if (tableName == "Multiframe")
00035   {
00036     return new Primary<DataType>(info);
00037   }
00038   else if (tableName == "ProgrammeFrame")
00039   {
00040     return new Primary<DataType>(info);
00041   }
00042   else if (tableName == "MultiframeDetector")
00043   {
00044     return new Extension<DataType>(info);
00045   }
00046   else if (tableName == "CurrentAstrometry")
00047   {
00048     return new Extension<DataType>(info);
00049   }
00050   else if (tableName == "Provenance")
00051   {
00052     return new Provenance<DataType>(info);
00053   }
00054   else if (tableName.find("Detection") != std::string::npos)
00055   {
00056     return new Catalog<DataType>(info);
00057   }
00058   else if (tableName.find("ListRemeasurement") != std::string::npos)
00059   {
00060     return new Catalog<DataType>(info);
00061   }
00062   else if (tableName == "MultiframeEsoKeys")
00063   {
00064     return new Primary<DataType>(info);
00065   }
00066   else if (tableName == "MultiframeDetectorEsoKeys")
00067   {
00068     return new Extension<DataType>(info);
00069   }
00070   else
00071   {
00072     throw DataBuilderFactoryException("Unrecognised table: " + tableName);
00073   }
00074 } // select
00075 //-----------------------------------------------------------------------------
00076 #endif
00077 //-----------------------------------------------------------------------------
00078 // Change log:
00079 //
00080 // 31-Jan-2005,  NCH: Added factory functions for all curated programmes
00081 //                    detection tables, including list-driven remeasurements,
00082 //                    using Catalog source table builder class; deprecated
00083 //                    combiframe entries; added these header lines.
00084 // 10-Mar-2005, ETWS: Added commDetection table
00085 // 14-Jul-2005, ETWS: Added u05a18Detection table
00086 // 16-Aug-2005, ETWS: Made Detection and ListRemeasurement builder more
00087 //                    flexible
00088 // 16-Nov-2005,  RSC: Redesigned MyException, tidied up std namespace
Generated on Mon Oct 4 10:38:34 2010 for WfcamSrc by  doxygen 1.6.3