DoneToBool.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007 #ifndef DONETOBOOL_HXX
00008 #define DONETOBOOL_HXX
00009
00010 #include "DataMethod.hxx"
00011
00012 #include <string>
00013
00014 #include "Constants.h"
00015
00017 template<typename DataType>
00018 class DoneToBool : public DataMethod<DataType>
00019 {
00020 public:
00022 DoneToBool() { DataMethod<DataType>::methodName = "DoneToBool"; }
00023
00025 virtual ~DoneToBool() { }
00026
00027
00029 void setSource(IntMap& tbls, IntMap& aColMap, StringMap aUnits)
00030 {
00031 mSourceCol = aColMap[0];
00032 if (mSourceCol < 0)
00033 {
00034 throw DataMethodException("DoneToBool method. Couldn't source");
00035 }
00036 }
00037
00039 void setTarget(IntMap& aColMap, StringMap aUnits)
00040 {
00041 mTargetCol = aColMap[0];
00042 }
00043
00046 void doit(TableData<DataType>& aData, int aFirstRow, int aLastRow)
00047 {
00048 for (int row = aFirstRow; row < aLastRow; ++row)
00049 {
00050 std::string keyStr;
00051 aData.value(mSourceCol, row, keyStr);
00052
00053
00054 if (keyStr.find("Done") != std::string::npos)
00055 {
00056 aData.assign(mTargetCol, row, BooleanTinyInt::Yes);
00057 }
00058 else
00059 {
00060 aData.assign(mTargetCol, row, BooleanTinyInt::No);
00061 }
00062 }
00063 }
00064
00065 void doit2(TableData<DataType>& rawData, TableData<DataType>& data, int row1, int row2) { }
00066
00067 private:
00068 int mSourceCol;
00069 int mTargetCol;
00070 };
00071
00072 #endif
00073
00074
00075
00076
00077