Skip to content

Commit

Permalink
List of allowed values generated automatically re #6635
Browse files Browse the repository at this point in the history
Signed-off-by: Karl Palmen <karl.palmen@stfc.ac.uk>
  • Loading branch information
KarlPalmen committed Mar 12, 2013
1 parent d8c38c9 commit 13d0641
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ class DLLExport MaskDetectorsIf: public API::Algorithm
private:
/// Sets documentation strings for this algorithm
virtual void initDocs();
/// Returns an allowed values statement to insert into decumentation
std::string allowedValuesStatement( std::vector<std::string> vals);
#ifndef HAS_UNORDERED_MAP_H
/// Typedef for detector to value map
typedef std::map<detid_t,bool> udet2valuem;
Expand Down
17 changes: 15 additions & 2 deletions Code/Mantid/Framework/Algorithms/src/MaskDetectorsIf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ void MaskDetectorsIf::init()
select_mode[0] = "SelectIf";
select_mode[1] = "DeselectIf";
declareProperty("Mode", "SelectIf", boost::make_shared<StringListValidator>(select_mode),
"Mode to select or deselect detectors based on comparison with values. Allowed Values: DeselectIf, SelectIf " );
"Mode to select or deselect detectors based on comparison with values. " + allowedValuesStatement(select_mode) );
std::vector<std::string> select_operator(6);
select_operator[0] = "Equal";
select_operator[1] = "NotEqual";
Expand All @@ -64,7 +64,7 @@ void MaskDetectorsIf::init()
select_operator[4] = "Less";
select_operator[5] = "LessEqual";
declareProperty("Operator", "Equal", boost::make_shared<StringListValidator>(select_operator),
"Unary operator to compare to given values. Allowed Values: Equal, Greater, GreaterEqual, Less, LessEqual, NotEqual" );
"Unary operator to compare to given values. " + allowedValuesStatement(select_operator) );
declareProperty("Value",0.0);
declareProperty(new API::FileProperty("InputCalFile","", API::FileProperty::Load, ".cal"),
"The name of the CalFile with grouping data. Allowed Values: *.cal ." );
Expand Down Expand Up @@ -205,5 +205,18 @@ void MaskDetectorsIf::createNewCalFile(const std::string& oldfile, const std::st
return;
}

std::string MaskDetectorsIf::allowedValuesStatement( std::vector<std::string> vals)
{
std::ostringstream statement;
statement << "Allowed Values: ";
for (size_t i=0;i<vals.size();++i)
{
statement << vals[i];
if( i < vals.size()) statement << ", ";
}
return statement.str();
}


} // namespace Algorithm
} // namespace Mantid

0 comments on commit 13d0641

Please sign in to comment.