Mantid
Loading...
Searching...
No Matches
IPeaksWorkspace.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4// NScD Oak Ridge National Laboratory, European Spallation Source,
5// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6// SPDX - License - Identifier: GPL - 3.0 +
7//----------------------------------------------------------------------
8// Includes
9//----------------------------------------------------------------------
13
14namespace Mantid::API {
15
16using namespace Kernel;
17
18const std::string IPeaksWorkspace::toString() const {
19 std::ostringstream os;
21 if (m_convention == "Crystallography")
22 os << "Crystallography: kf-ki";
23 else
24 os << "Inelastic: ki-kf";
25 os << "\n";
26
27 return os.str();
28}
29
30} // namespace Mantid::API
31
33
34namespace Mantid::Kernel {
35
36template <>
38IPropertyManager::getValue<Mantid::API::IPeaksWorkspace_sptr>(const std::string &name) const {
39 auto *prop = dynamic_cast<PropertyWithValue<Mantid::API::IPeaksWorkspace_sptr> *>(getPointerToProperty(name));
40 if (prop) {
41 return *prop;
42 } else {
43 std::string message =
44 "Attempt to assign property " + name + " to incorrect type. Expected shared_ptr<PeaksWorkspace>.";
45 throw std::runtime_error(message);
46 }
47}
48
49template <>
51IPropertyManager::getValue<Mantid::API::IPeaksWorkspace_const_sptr>(const std::string &name) const {
52 auto *prop = dynamic_cast<PropertyWithValue<Mantid::API::IPeaksWorkspace_sptr> *>(getPointerToProperty(name));
53 if (prop) {
54 return prop->operator()();
55 } else {
56 std::string message =
57 "Attempt to assign property " + name + " to incorrect type. Expected const shared_ptr<PeaksWorkspace>.";
58 throw std::runtime_error(message);
59 }
60}
61
62} // namespace Mantid::Kernel
63
const std::string toString() const
Returns a string description of the object.
const std::string toString() const override
Serializes the object to a string.
const std::string toString() const override
Serializes the object to a string.
The concrete, templated class for properties.
std::shared_ptr< IPeaksWorkspace > IPeaksWorkspace_sptr
shared pointer to Mantid::API::IPeaksWorkspace
std::shared_ptr< const IPeaksWorkspace > IPeaksWorkspace_const_sptr
shared pointer to Mantid::API::IPeaksWorkspace (const version)