Mantid
Loading...
Searching...
No Matches
Static Public Member Functions | Static Private Member Functions | List of all members
Mantid::PythonInterface::Registry::PropertyWithValueFactory Class Reference

Defines a static factory class that creates PropertyWithValue instances from python objects. More...

#include <PropertyWithValueFactory.h>

Static Public Member Functions

static std::unique_ptr< Kernel::Propertycreate (const std::string &name, const boost::python::object &defaultValue, const boost::python::object &validator, const unsigned int direction)
 Creates a PropertyWithValue<Type> instance from the given information. More...
 
static std::unique_ptr< Kernel::Propertycreate (const std::string &name, const boost::python::object &defaultValue, const unsigned int direction)
 Creates a PropertyWithValue<Type> instance from the given information. More...
 
static std::unique_ptr< Kernel::PropertycreateTimeSeries (const std::string &name, const boost::python::list &defaultValue)
 Creates a TimeSeriesProperty<Type> instance from the given information. More...
 

Static Private Member Functions

static const std::string isArray (PyObject *const object)
 Return a string based on the python array type. More...
 
static const PropertyValueHandlerlookup (PyObject *const object)
 Return a handler that maps the python type to a C++ type. More...
 

Detailed Description

Defines a static factory class that creates PropertyWithValue instances from python objects.

Definition at line 30 of file PropertyWithValueFactory.h.

Member Function Documentation

◆ create() [1/2]

std::unique_ptr< Kernel::Property > Mantid::PythonInterface::Registry::PropertyWithValueFactory::create ( const std::string &  name,
const boost::python::object &  defaultValue,
const boost::python::object &  validator,
const unsigned int  direction 
)
static

Creates a PropertyWithValue<Type> instance from the given information.

The python type is mapped to a C type using the mapping defined by initPythonTypeMap()

Parameters
name:: The name of the property
defaultValue:: A default value for this property.
validator:: A validator object
direction:: Specifies whether the property is Input, InOut or Output
Returns
A pointer to a new Property object

Definition at line 117 of file PropertyWithValueFactory.cpp.

References lookup().

Referenced by create(), Mantid::PythonInterface::Registry::createPropertyManager(), and Mantid::PythonInterface::AlgorithmAdapter< BaseAlgorithm >::declarePyAlgProperty().

◆ create() [2/2]

std::unique_ptr< Kernel::Property > Mantid::PythonInterface::Registry::PropertyWithValueFactory::create ( const std::string &  name,
const boost::python::object &  defaultValue,
const unsigned int  direction 
)
static

Creates a PropertyWithValue<Type> instance from the given information.

The python type is mapped to a C type using the mapping defined by initPythonTypeMap()

Parameters
name:: The name of the property
defaultValue:: A default value for this property.
direction:: Specifies whether the property is Input, InOut or Output
Returns
A pointer to a new Property object

Definition at line 134 of file PropertyWithValueFactory.cpp.

References create().

◆ createTimeSeries()

std::unique_ptr< Mantid::Kernel::Property > Mantid::PythonInterface::Registry::PropertyWithValueFactory::createTimeSeries ( const std::string &  name,
const boost::python::list &  defaultValue 
)
static

Creates a TimeSeriesProperty<Type> instance from the given information.

The python type is mapped to a C type

Parameters
name:: The name of the property
defaultValue:: A default value for this property.
Returns
A pointer to a new Property object

Decide which kind of TimeSeriesProperty to return Need to use a different method to check for boolean values since extract<> seems to get confused sometimes.

Definition at line 148 of file PropertyWithValueFactory.cpp.

References obj.

◆ isArray()

const std::string Mantid::PythonInterface::Registry::PropertyWithValueFactory::isArray ( PyObject *const  object)
staticprivate

Return a string based on the python array type.

Return a string for the array type to check the map for.

Parameters
object:: Python object to check if it's an array
Returns
:: A string as the array type.

Definition at line 210 of file PropertyWithValueFactory.cpp.

References GNU_DIAG_OFF, and GNU_DIAG_ON.

Referenced by lookup().

◆ lookup()

const PropertyValueHandler & Mantid::PythonInterface::Registry::PropertyWithValueFactory::lookup ( PyObject *const  object)
staticprivate

Return a handler that maps the python type to a C++ type.

Parameters
object:: A pointer to a PyObject that represents the type
Returns
A pointer to handler that can be used to instantiate a property

Definition at line 183 of file PropertyWithValueFactory.cpp.

References isArray().

Referenced by create().


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