Skip to content
Snippets Groups Projects
Commit ebd7c6b3 authored by Marcel Loose's avatar Marcel Loose :sunglasses:
Browse files

BugID: 753

Moved infiniteRecursionCheck() to BBSMultiStep class, because that's where it
acutally belongs; it doesn't make sense to do this check on a BBSSingleStep,
does it?
parent 99f0a02e
No related branches found
No related tags found
No related merge requests found
......@@ -52,6 +52,12 @@ namespace LOFAR
virtual void print(ostream& os) const;
private:
// Check to see if there's an infinite recursion present in the
// definition of a BBSMultiStep. This can happen when one of the steps
// (identified by the argument \a name) defining the BBSMultiStep refers
// directly or indirectly to that same BBSMultiStep.
void infiniteRecursionCheck(const string& name) const;
// Vector holding a sequence of BBSSteps.
vector<const BBSStep*> itsSteps;
};
......
......@@ -67,7 +67,10 @@ namespace LOFAR
virtual void print(ostream& os) const;
// Return the name of this step.
const string& name() const { return itsName; }
const string& getName() const { return itsName; }
// Return a pointer to the parent of this step.
const BBSStep* getParent() const { return itsParent; }
// Return the full name of this step. The full name consists of the name
// of this step, preceeded by that of its parent, etc., separated by
......@@ -93,12 +96,6 @@ namespace LOFAR
const ACC::APS::ParameterSet& parSet,
const BBSStep* parent);
// Check to see if there's an infinite recursion present in the
// definition of a BBSStep. This can happen when one of the steps
// (identified by the argument \a name) defining a BBSMultiStep refers
// directly or indirectly to that same BBSMultiStep.
void infiniteRecursionCheck(const string& name) const;
private:
// Override the default values, "inherited" from the parent step object,
// for those members that are specified in \a parSet.
......
......@@ -26,6 +26,7 @@
#include <APS/ParameterSet.h>
#include <Common/LofarLogger.h>
#include <BBSControl/StreamFormatting.h>
#include <BBSControl/Exceptions.h>
namespace LOFAR
{
......@@ -46,12 +47,6 @@ namespace LOFAR
// Create a new step for each name in \a steps.
for (uint i = 0; i < steps.size(); ++i) {
// Should add something like BBSStep::infiniteRecursionCheck(name),
// which checks, RECURSIVELY, if steps[i] may be used for the step to
// be created.
// ASSERTSTR(name != steps[i],
// "Infinite recursion detected in BBSStep definition! "
// "Please check your ParameterSet file");
infiniteRecursionCheck(steps[i]);
itsSteps.push_back(BBSStep::create(steps[i], parset, this));
}
......@@ -72,6 +67,7 @@ namespace LOFAR
void BBSMultiStep::print(ostream& os) const
{
LOG_TRACE_FLOW(AUTO_FUNCTION_NAME);
BBSStep::print(os);
Indent id;
for (uint i = 0; i < itsSteps.size(); ++i) {
......@@ -80,11 +76,18 @@ namespace LOFAR
}
// void BBSMultiStep::addStep(const BBSStep*& aStep)
// {
// itsSteps.push_back(aStep);
// }
void BBSMultiStep::infiniteRecursionCheck(const string& name) const
{
LOG_TRACE_FLOW(AUTO_FUNCTION_NAME);
if (name == getName()) {
THROW (BBSControlException,
"Infinite recursion detected in defintion of BBSStep \""
<< name << "\". Please check your ParameterSet file.");
}
const BBSMultiStep* parent;
if ((parent = dynamic_cast<const BBSMultiStep*>(getParent())) != 0)
parent->infiniteRecursionCheck(name);
}
} // namespace BBS
......
......@@ -130,17 +130,6 @@ namespace LOFAR
}
void BBSStep::infiniteRecursionCheck(const string& name) const
{
LOG_TRACE_FLOW(AUTO_FUNCTION_NAME);
if (name == itsName)
THROW (BBSControlException,
"Infinite recursion detected in defintion of BBSStep \""
<< name << "\". Please check your ParameterSet file.");
if (itsParent) itsParent->infiniteRecursionCheck(name);
}
//##-------- P r i v a t e m e t h o d s --------##//
void BBSStep::setParms(const ParameterSet& ps)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment