Newer
Older
Gigg, Martyn Anthony
committed
//------------------------------------------------------
// Includes
//------------------------------------------------------
#include "MantidAPI/IEventWorkspace.h"
/**
*/
const std::string IEventWorkspace::toString() const {
std::ostringstream os;
os << MatrixWorkspace::toString() << "\n";
os << "Events: " + boost::lexical_cast<std::string>(getNumberEvents());
case WEIGHTED:
os << " (weighted)\n";
break;
case WEIGHTED_NOTIME:
os << " (weighted, no times)\n";
break;
case TOF:
os << "\n";
break;
}
return os.str();
}
}
Gigg, Martyn Anthony
committed
/*
* In order to be able to cast PropertyWithValue classes correctly a definition
*for the PropertyWithValue<IEventWorkspace> is required
Gigg, Martyn Anthony
committed
*
*/
Gigg, Martyn Anthony
committed
template <>
MANTID_API_DLL Mantid::API::IEventWorkspace_sptr
IPropertyManager::getValue<Mantid::API::IEventWorkspace_sptr>(
const std::string &name) const {
PropertyWithValue<Mantid::API::IEventWorkspace_sptr> *prop =
dynamic_cast<PropertyWithValue<Mantid::API::IEventWorkspace_sptr> *>(
getPointerToProperty(name));
if (prop) {
Gigg, Martyn Anthony
committed
return *prop;
} else {
std::string message = "Attempt to assign property " + name +
" to incorrect type. Expected IEventWorkspace.";
Gigg, Martyn Anthony
committed
throw std::runtime_error(message);
}
}
template <>
MANTID_API_DLL Mantid::API::IEventWorkspace_const_sptr
IPropertyManager::getValue<Mantid::API::IEventWorkspace_const_sptr>(
const std::string &name) const {
PropertyWithValue<Mantid::API::IEventWorkspace_sptr> *prop =
dynamic_cast<PropertyWithValue<Mantid::API::IEventWorkspace_sptr> *>(
getPointerToProperty(name));
if (prop) {
Gigg, Martyn Anthony
committed
return prop->operator()();
} else {
std::string message = "Attempt to assign property " + name +
" to incorrect type. Expected const IEventWorkspace.";
Gigg, Martyn Anthony
committed
throw std::runtime_error(message);
}
}
}
// namespace Kernel
Gigg, Martyn Anthony
committed
} // namespace Mantid
///\endcond TEMPLATE