ObjectID.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 OBJECTID_H
00008 #define OBJECTID_H
00009 
00010 #include <cstdlib>
00011 #include <string>
00012 
00013 #include "DataMethod.hxx"
00014 #include "Options.h"
00015 #include "StringOps.h"
00016 //-----------------------------------------------------------------------------
00018 template<typename DataType>
00019 class ObjectID : public DataMethod<DataType>
00020 {
00021 public:
00023   ObjectID()
00024   {
00025     DataMethod<DataType>::methodName = "ObjectID";
00026     newobjidstr = options.getNewObjId();
00027     newobjid = (int64) atof(newobjidstr.c_str());
00028   }
00029 
00030   // explicit Destructor
00031   virtual ~ObjectID() { }
00032 
00034   void setSource(IntMap& tbls, IntMap& cols, StringMap units) { }
00035 
00037   void setTarget(IntMap& cols, StringMap units) { objIdColno = cols[0]; }
00038 
00040   void doit(TableData<DataType>& data, int row1, int row2)
00041   {
00042     for (int rowNo = row1; rowNo < row2; ++rowNo)
00043     {
00044       objid = newobjid - rowNo;
00045       data.assign(objIdColno, rowNo, (double)objid);
00046     }
00047 
00048     nextobjidstr = StringOps::NumToString((double)objid-1);
00049     optionsInitialiser.setOption(OptionNames::newobjid,nextobjidstr);
00050   }
00051 
00052   // No data from raw data included
00053   void doit2(TableData<DataType>& rawData, TableData<DataType>& data, int row1, int row2) { }
00054 
00055 private:
00056   int objIdColno;
00057   std::string newobjidstr, nextobjidstr;
00058   int64 newobjid, objid;
00059   Options options;
00060   OptionsFiller optionsInitialiser;
00061 };
00062 //-----------------------------------------------------------------------------
00063 #endif
00064 //-----------------------------------------------------------------------------
00065 // Change log:
00066 //
00067 // 21-Apr-2005, ETWS: Original version.
00068 // 29-Nov-2006, ETWS: Changed to negative object IDs for code parallelization 
00069 //  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