Mantid
Loading...
Searching...
No Matches
IMDHistoWorkspace.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 +
9#include "MantidAPI/Sample.h"
12#include "MantidKernel/System.h"
13
14#include <sstream>
15
16using namespace Mantid::Kernel;
17using namespace Mantid::API;
18
19namespace Mantid::API {
20
21//----------------------------------------------------------------------------------------------
22
23const std::string IMDHistoWorkspace::toString() const {
24 std::ostringstream os;
26
28
29 return os.str();
30}
31} // namespace Mantid::API
32
33namespace Mantid::Kernel {
36template <>
38IPropertyManager::getValue<Mantid::API::IMDHistoWorkspace_sptr>(const std::string &name) const {
39 auto *prop = dynamic_cast<PropertyWithValue<Mantid::API::IMDHistoWorkspace_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<IMDHistoWorkspace>.";
45 throw std::runtime_error(message);
46 }
47}
48
51template <>
53IPropertyManager::getValue<Mantid::API::IMDHistoWorkspace_const_sptr>(const std::string &name) const {
54 auto *prop = dynamic_cast<PropertyWithValue<Mantid::API::IMDHistoWorkspace_sptr> *>(getPointerToProperty(name));
55 if (prop) {
56 return prop->operator()();
57 } else {
58 std::string message =
59 "Attempt to assign property " + name + " to incorrect type. Expected const shared_ptr<IMDHistoWorkspace>.";
60 throw std::runtime_error(message);
61 }
62}
63
64} // namespace Mantid::Kernel
const std::string toString() const override
Serializes the object to a string.
const std::string toString() const override
Serializes the object to a string.
const std::string toString() const
Returns a string description of the object.
The concrete, templated class for properties.
std::shared_ptr< IMDHistoWorkspace > IMDHistoWorkspace_sptr
shared pointer to Mantid::API::IMDHistoWorkspace
std::shared_ptr< const IMDHistoWorkspace > IMDHistoWorkspace_const_sptr
shared pointer to Mantid::API::IMDHistoWorkspace (const version)