-
if ((*pmapVarNameAndValues)["type"] == "stddeviation")
-
{
-
shared_ptr<BP<StdDeviations> > pBP(new BP<StdDeviations>());
-
SHlpr::ConfigureStdDeviationsFromVariables(boost::dynamic_pointer_cast<StdDeviations>(pBP), *pmapVarNameAndValues);
-
pBP->m_itStartTime = iStartTimeOffset;
-
for(int i = 0; i < iRows - 1; i++)
-
{
-
for(int j = 0; j < 6; j++) dpocv[j] = npyary[i][j];
-
pBP->OnUpdate(dpocv);
-
}
-
pBP->m_bEnabled = false;
-
for(int j = 0; j < 6; j++) dpocv[j] = npyary[iRows - 1][j];
-
pBP->OnUpdate(dpocv);
-
pBP->Log(vctLog);
-
-
}
-
else if ((*pmapVarNameAndValues)["type"] == "stddeviationrev")
-
{
-
shared_ptr<BP<StdDeviationsRev> > pBP(new BP<StdDeviationsRev>());
-
SHlpr::ConfigureStdDeviationsFromVariables(boost::dynamic_pointer_cast<StdDeviations>(pBP), *pmapVarNameAndValues);
-
pBP->m_itStartTime = iStartTimeOffset;
-
for(int i = 0; i < iRows - 1; i++)
-
{
-
for(int j = 0; j < 6; j++) dpocv[j] = npyary[i][j];
-
pBP->OnUpdate(dpocv);
-
}
-
pBP->m_bEnabled = false;
-
for(int j = 0; j < 6; j++) dpocv[j] = npyary[iRows - 1][j];
-
pBP->OnUpdate(dpocv);
-
pBP->Log(vctLog);
-
-
}
-
else if ((*pmapVarNameAndValues)["type"] == "smoregression")
-
{
-
shared_ptr<BP<SmoRegression> > pBP(new BP<SmoRegression>());
-
SHlpr::ConfigureSmoRegressionFromVariables(boost::dynamic_pointer_cast<SmoRegression>(pBP), *pmapVarNameAndValues);
-
pBP->m_itStartTime = iStartTimeOffset;
-
for(int i = 0; i < iRows - 1; i++)
-
{
-
for(int j = 0; j < 6; j++) dpocv[j] = npyary[i][j];
-
pBP->OnUpdate(dpocv);
-
}
-
pBP->m_bEnabled = false;
-
for(int j = 0; j < 6; j++) dpocv[j] = npyary[iRows - 1][j];
-
pBP->OnUpdate(dpocv);
-
pBP->Log(vctLog);
-
-
}
-
else if ((*pmapVarNameAndValues)["type"] == "detrendeddev")
-
{
-
shared_ptr<BP<DetrendedDev> > pBP(new BP<DetrendedDev>());
-
SHlpr::ConfigureDetrendedDevFromVariables(boost::dynamic_pointer_cast<DetrendedDev>(pBP), *pmapVarNameAndValues);
-
pBP->m_itStartTime = iStartTimeOffset;
-
for(int i = 0; i < iRows - 1; i++)
-
{
-
for(int j = 0; j < 6; j++) dpocv[j] = npyary[i][j];
-
pBP->OnUpdate(dpocv);
-
}
-
pBP->m_bEnabled = false;
-
for(int j = 0; j < 6; j++) dpocv[j] = npyary[iRows - 1][j];
-
pBP->OnUpdate(dpocv);
-
pBP->Log(vctLog);
-
-
}
-
I just want to generalize code below instead of calling it in every else if. All the template argument class to BP are derived from ST. OnUpdate is a vistual method. m_bEnabled is a memeber of ST. So this should work just need to figure out the way to cast BP<DerivedClass> to BP<ST>
for(int i = 0; i < iRows - 1; i++)
99 {
100 for(int j = 0; j < 6; j++) dpocv[j] = npyary[i][j];
101 pBP->OnUpdate(dpocv);
102 }
103 pBP->m_bEnabled = false;
105 for(int j = 0; j < 6; j++) dpocv[j] = npyary[iRows - 1][j];
106 pBP->OnUpdate(dpocv);
107 pBP->Log(vctLog);