Newer
Older
Gigg, Martyn Anthony
committed
//------------------------------------------------------------------------------
// Includes
//------------------------------------------------------------------------------
#include "MantidAPI/AlgorithmHasProperty.h"
#include "MantidAPI/IAlgorithm.h"
namespace Mantid {
namespace API {
AlgorithmHasProperty::AlgorithmHasProperty(const std::string &propName)
: m_propName(propName) {}
std::string AlgorithmHasProperty::checkValidity(
const boost::shared_ptr<IAlgorithm> &value) const {
std::string message("");
if (value->existsProperty(m_propName)) {
Kernel::Property *p = value->getProperty(m_propName);
if (!p->isValid().empty()) {
message = "Algorithm object contains the required property \"" +
m_propName + "\" but it has an invalid value: " + p->value();
Gigg, Martyn Anthony
committed
}
} else {
message = "Algorithm object does not have the required property \"" +
m_propName + "\"";
}
Gigg, Martyn Anthony
committed
Gigg, Martyn Anthony
committed
} // namespace Mantid
} // namespace API