ObjectID.hxx
Go to the documentation of this file.00001
00002
00003
00004
00005
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
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
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
00066
00067
00068
00069