13#include <boost/python/bases.hpp>
14#include <boost/python/class.hpp>
15#include <boost/python/return_by_value.hpp>
16#include <boost/python/return_value_policy.hpp>
24 if constexpr (std::is_same<HeldType, std::string>::value) {
26 std::string val = self.
value();
27 ss <<
"S" << val.size();
28 std::string ret_val = ss.str();
47namespace PythonInterface {
52template <
typename HeldType,
typename ValueReturnPolicy = boost::python::return_by_value>
54 static void define(
const char *pythonClassName) {
58 class_<PropertyWithValue<HeldType>, bases<Property>, boost::noncopyable>(
59 pythonClassName, init<std::string, HeldType, unsigned int>(
60 (arg(
"self"), arg(
"name"), arg(
"value"), arg(
"direction") =
Direction::Input)))
61 .add_property(
"value", make_function(&get_value<HeldType>, return_value_policy<ValueReturnPolicy>()),
63 .def(
"dtype", &dtype<HeldType>, arg(
"self"));
The concrete, templated class for properties.
std::string value() const override
Get the value of the property as a string.
std::string dtype(const Container< HeldType > &)
Helper class which provides the Collimation Length for SANS instruments.
@ Input
An input workspace.
A helper struct to export PropertyWithValue<> types to Python.
static void define(const char *pythonClassName)