ProgrammeID.hxx

Go to the documentation of this file.
00001 
00002 
00003 
00004 //-----------------------------------------------------------------------------
00005 // CVS: $Revision: 6421 $, $Date: 2009-11-27 10:57:35 +0000 (Fri, 27 Nov 2009) $, $Author: EckhardSutorius $
00006 //-----------------------------------------------------------------------------
00007 #ifndef PROGRAMMEID_H
00008 #define PROGRAMMEID_H
00009 
00010 #include <string>
00011 
00012 #include "DataMethod.hxx"
00013 #include "ProgrammeTable.h"
00014 //-----------------------------------------------------------------------------
00017 template<typename DataType>
00018 class ProgrammeID : public DataMethod<DataType>
00019 {
00020 public:
00022   ProgrammeID() { DataMethod<DataType>::methodName = "ProgrammeID"; }
00023 
00025   virtual ~ProgrammeID() { }
00026 
00028   void setSource(IntMap& tbls, IntMap& aCols, StringMap aUnits)
00029   {
00030     mProgNameColNum = aCols[0];
00031     if (mProgNameColNum < 0)
00032     {
00033       throw DataMethodException("ProgrammeID method. Couldn't source");
00034     }
00035   }
00036 
00038   void setTarget(IntMap&   aCols,
00039                  StringMap aUnits)
00040   {
00041     mProgIdColNum = aCols[0];
00042   }
00043 
00045   void doit(TableData<DataType>& aData, int aFirstRow, int aLastRow)
00046   {
00047     for (int rowNum = aFirstRow; rowNum < aLastRow; ++rowNum)
00048     {
00049       std::string progName;
00050       aData.value(mProgNameColNum, rowNum, progName);
00051       aData.assign(mProgIdColNum, rowNum, atoi(mProgTable.getProgrammeId(progName).c_str()));
00052     }
00053   }
00054 
00055   // No data from raw data included
00056   void doit2(TableData<DataType>& rawData, TableData<DataType>& data, int row1, int row2) { }
00057 
00058 private:
00060   int mProgNameColNum;
00062   int mProgIdColNum;
00064   ProgrammeTable mProgTable;
00065 };
00066 //-----------------------------------------------------------------------------
00067 #endif
00068 //-----------------------------------------------------------------------------
00069 // Change log:
00070 //
00071 // 27-May-2004,  IAB: Original version.
00072 // 11-Aug-2005,  RSC: Removed hard-coding of programme IDs in a namespace. Now
00073 //                    programme IDs are read in from the
00074 //                    wfcamsrc/programmes.csv file upon initiation of the
00075 //                    ProgrammeID data method.
00076 //  6-Sep-2005,  RSC: Extracted code that reads the "programmes.csv" file from
00077 //                    ProgrammeID.hxx and placed into separate ProgrammeTable
00078 //                    class
00079 //  7-Apr-2008, ETWS: Upgraded to use new detection table layout.
Generated on Mon Oct 4 10:38:34 2010 for WfcamSrc by  doxygen 1.6.3