Mantid
Loading...
Searching...
No Matches
Public Member Functions | List of all members
Mantid::PythonInterface::Registry::SequenceTypeHandler< ContainerType > Struct Template Reference

A specialisation of PropertyValueHander to handle coercing a Python value into a C++ sequence/array property. More...

#include <SequenceTypeHandler.h>

Inheritance diagram for Mantid::PythonInterface::Registry::SequenceTypeHandler< ContainerType >:
Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ContainerType > Mantid::PythonInterface::Registry::PropertyValueHandler

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
 Call to create a name property where the value is some container type. More...
 
void set (Kernel::IPropertyManager *alg, const std::string &name, const boost::python::object &value) const override
 Call to set a named property where the value is some container type. More...
 
- Public Member Functions inherited from Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ContainerType >
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...
 

Additional Inherited Members

- Public Types inherited from Mantid::PythonInterface::Registry::TypedPropertyValueHandler< ContainerType >
using HeldType = ContainerType
 Type required by TypeRegistry framework. More...
 

Detailed Description

template<typename ContainerType>
struct Mantid::PythonInterface::Registry::SequenceTypeHandler< ContainerType >

A specialisation of PropertyValueHander to handle coercing a Python value into a C++ sequence/array property.

The template type ContainerType should contain a type called value_type indicating the element type.

Definition at line 19 of file SequenceTypeHandler.h.

Member Function Documentation

◆ create()

template<typename ContainerType >
std::unique_ptr< Kernel::Property > Mantid::PythonInterface::Registry::SequenceTypeHandler< ContainerType >::create ( const std::string &  name,
const boost::python::object &  defaultValue,
const boost::python::object &  validator,
const unsigned int  direction 
) const
overridevirtual

Call to create a name property where the value is some container type.

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 ContainerType 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 81 of file SequenceTypeHandler.cpp.

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

◆ set()

template<typename ContainerType >
void Mantid::PythonInterface::Registry::SequenceTypeHandler< ContainerType >::set ( Kernel::IPropertyManager alg,
const std::string &  name,
const boost::python::object &  value 
) const
overridevirtual

Call to set a named property where the value is some container type.

Set function to handle Python -> C++ calls to a property manager 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 container values

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

Definition at line 46 of file SequenceTypeHandler.cpp.

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


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