Mantid
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ValueType, Enable > Struct Template Reference

This class provides a templated class object that is able to take a python object and perform operations with a given C type. More...

#include <TypedPropertyValueHandler.h>

Inheritance diagram for Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ValueType, Enable >:
Mantid::PythonInterface::Registry::PropertyValueHandler

Public Types

using HeldType = ValueType
 Type required by TypeRegistry framework. More...
 

Public Member Functions

std::unique_ptr< Kernel::Propertycreate (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. More...
 
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. More...
 
- Public Member Functions inherited from Mantid::PythonInterface::Registry::PropertyValueHandler
virtual std::unique_ptr< Kernel::Propertycreate (const std::string &name, const boost::python::object &value, const boost::python::object &validator, const unsigned int direction) const =0
 Overload to create a Property type from the given value with no validation. More...
 
virtual void set (Kernel::IPropertyManager *alg, const std::string &name, const boost::python::object &value) const =0
 Overload to set the named property's value on the property manager. More...
 
virtual ~PropertyValueHandler ()=default
 Virtual Destructor. More...
 

Detailed Description

template<typename ValueType, typename Enable = void>
struct Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ValueType, Enable >

This class provides a templated class object that is able to take a python object and perform operations with a given C type.

Definition at line 29 of file TypedPropertyValueHandler.h.

Member Typedef Documentation

◆ HeldType

template<typename ValueType , typename Enable = void>
using Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ValueType, Enable >::HeldType = ValueType

Type required by TypeRegistry framework.

Definition at line 31 of file TypedPropertyValueHandler.h.

Member Function Documentation

◆ create()

template<typename ValueType , typename Enable = void>
std::unique_ptr< Kernel::Property > Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ValueType, Enable >::create ( const std::string &  name,
const boost::python::object &  defaultValue,
const boost::python::object &  validator,
const unsigned int  direction 
) const
inlineoverridevirtual

Create a PropertyWithValue from the given python object value.

Parameters
name:: The name of the property
defaultValue:: The defaultValue of the property. The object attempts to extract a value of type ValueType from the python object
validator:: A python object pointing to a validator instance, which can be None.
direction:: The direction of the property
Returns
A pointer to a newly constructed property instance

Implements Mantid::PythonInterface::Registry::PropertyValueHandler.

Definition at line 53 of file TypedPropertyValueHandler.h.

References Mantid::Kernel::IValidator::clone(), and Mantid::PythonInterface::isNone().

◆ set()

template<typename ValueType , typename Enable = void>
void Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ValueType, Enable >::set ( Kernel::IPropertyManager alg,
const std::string &  name,
const boost::python::object &  value 
) const
inlineoverridevirtual

Set function to handle Python -> C++ calls and get the correct type.

Parameters
alg:: A pointer to an IPropertyManager
name:: The name of the property
value:: A boost python object that stores the value

Implements Mantid::PythonInterface::Registry::PropertyValueHandler.

Definition at line 39 of file TypedPropertyValueHandler.h.

References Mantid::Kernel::IPropertyManager::setProperty(), and value.


The documentation for this struct was generated from the following file: