VersionNum.hxx

Go to the documentation of this file.
00001 
00002 
00003 
00004 //-----------------------------------------------------------------------------
00005 // CVS: $Revision: 4785 $, $Date: 2008-05-20 14:19:36 +0100 (Tue, 20 May 2008) $, $Author: RossCollins $
00006 //-----------------------------------------------------------------------------
00007 #ifndef VERSIONNUM_H
00008 #define VERSIONNUM_H
00009 
00010 #include <string>
00011 
00012 #include "Constants.h"
00013 #include "DataMethod.hxx"
00014 #include "FitsFile.h"
00015 #include "StringOps.h"
00016 //-----------------------------------------------------------------------------
00018 template<typename DataType>
00019 class VersionNum : public DataMethod<DataType>
00020 {
00021 public:
00023   VersionNum(const FitsFile& aFile)
00024   {
00025     DataMethod<DataType>::methodName = "VersionNum";
00026     try
00027     {
00028       std::string fileName = aFile.getFileName();
00029       std::string::size_type lastIdx = fileName.rfind('/');
00030       std::string::size_type firstIdx = fileName.rfind('v', lastIdx) + 1;
00031       mVersionNum = fileName.substr(firstIdx, lastIdx-firstIdx);
00032     } catch (const exception &e) {
00033       mVersionNum = StringOps::NumToString(DefaultValues::realdef);
00034     }
00035   }
00036 
00038   virtual ~VersionNum() { }
00039 
00041   void setSource(IntMap& tbls, IntMap& cols, StringMap units) { }
00042 
00044   void setTarget(IntMap& cols, StringMap units)
00045   {
00046     mColNo = cols[0];
00047   }
00048 
00050   void doit(TableData<DataType>& data, int row1, int row2)
00051   {
00052     for (int rowNo = row1; rowNo < row2; ++rowNo)
00053     {
00054       data.assign(mColNo, rowNo, mVersionNum);
00055     }
00056   }
00057 
00058   // No data from raw data included
00059   void doit2(TableData<DataType>& rawData, TableData<DataType>& data, int row1, int row2) { }
00060 
00061 private:
00062   int mColNo;
00063   std::string mVersionNum;
00064 };
00065 //-----------------------------------------------------------------------------
00066 #endif
00067 //-----------------------------------------------------------------------------
00068 // Change log:
00069 //
00070 // 13-Mar-2007,  RSC: Original version.
00071 //  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