Mantid
Loading...
Searching...
No Matches
IObjComponent.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 <boost/python/class.hpp>
10#include <boost/python/register_ptr_to_python.hpp>
11
14using namespace boost::python;
15
17
18namespace {
26std::shared_ptr<Mantid::Geometry::IObject> getShape(const IObjComponent &self) {
27 if (PyErr_Warn(PyExc_DeprecationWarning,
28 "'IObjComponent.shape' is deprecated in Mantid 7.0, "
29 "use 'ComponentInfo.shape' instead. "
30 "For more information, see the instrument access layers concept page: "
31 "https://docs.mantidproject.org/nightly/concepts/InstrumentAccessLayers.html") < 0)
32 throw boost::python::error_already_set();
33 return std::const_pointer_cast<Mantid::Geometry::IObject>(self.shape());
34}
35} // namespace
36
38 register_ptr_to_python<std::shared_ptr<IObjComponent>>();
39
40 class_<IObjComponent, boost::python::bases<IComponent>, boost::noncopyable>("IObjComponent", no_init)
41 .def("shape", &getShape, arg("self"),
42 "Get the object that represents "
43 "the physical shape of this "
44 "component (deprecated, use ComponentInfo.shape)");
45}
#define GET_POINTER_SPECIALIZATION(TYPE)
Definition GetPointer.h:17
void export_IObjComponent()
base class for Geometric IComponent
Definition IComponent.h:53
Object Component class, this class brings together the physical attributes of the component to the po...
virtual const std::shared_ptr< const IObject > shape() const =0
Returns the shape of the Object.