14#include <boost/python/register_ptr_to_python.hpp>
21 typename std::enable_if<std::is_base_of<API::Workspace, T>::value>::type>
38 if (
value == boost::python::object())
55 std::unique_ptr<Kernel::Property>
create(
const std::string &name,
const boost::python::object &defaultValue,
56 const boost::python::object &validator,
57 const unsigned int direction)
const override {
58 using boost::python::extract;
63 std::unique_ptr<Property> valueProp;
65 valueProp = std::make_unique<PropertyWithValue<PropertyValueType>>(name, valueInC, direction);
67 const IValidator *propValidator = extract<IValidator *>(validator);
69 std::make_unique<PropertyWithValue<PropertyValueType>>(name, valueInC, propValidator->
clone(), direction);
91 register_ptr_to_python<IType_sptr>();
92 register_ptr_to_python<IType_wptr>();
94 TypeRegistry::subscribe<TypedPropertyValueHandler<IType_sptr>>();
double value
The value of the point.
#define DLLExport
Definitions of the DLLImport compiler directives for MSVC.
Interface to PropertyManager.
IPropertyManager * setProperty(const std::string &name, const T &value)
Templated method to set the value of a PropertyWithValue.
IValidator is the basic interface for all validators for properties.
virtual IValidator_sptr clone() const =0
Make a copy of the present type of validator.
The concrete, templated class for properties.
Base class for properties.
bool isNone(PyObject *ptr)
This class provides a base-class objects that are able to take a python object and set it on an algor...
Encapsulates the registration required for an interface type T that sits on top of a Kernel::DataItem...
std::weak_ptr< IType > IType_wptr
RegisterWorkspacePtrToPython()
Constructor.
std::shared_ptr< IType > IType_sptr
std::shared_ptr< T > PropertyValueType
Convenience typedef.
T PointeeType
Convenience typedef.
std::unique_ptr< Kernel::Property > create(const std::string &name, const boost::python::object &defaultValue, const boost::python::object &validator, const unsigned int direction) const override
Create a PropertyWithValue from the given python object value.
std::shared_ptr< T > HeldType
Type required by TypeRegistry framework.
void set(Kernel::IPropertyManager *alg, const std::string &name, const boost::python::object &value) const override
Set function to handle Python -> C++ calls and get the correct type.
This class provides a templated class object that is able to take a python object and perform operati...