Mantid
Loading...
Searching...
No Matches
Framework
PythonInterface
mantid
kernel
src
Exports
PropertyFactory.cpp
Go to the documentation of this file.
1
// Mantid Repository : https://github.com/mantidproject/mantid
2
//
3
// Copyright © 2018 ISIS Rutherford Appleton Laboratory UKRI,
4
// NScD Oak Ridge National Laboratory, European Spallation Source,
5
// Institut Laue - Langevin & CSNS, Institute of High Energy Physics, CAS
6
// SPDX - License - Identifier: GPL - 3.0 +
7
#include "
MantidPythonInterface/kernel/Registry/PropertyWithValueFactory.h
"
8
#include "
MantidPythonInterface/kernel/Registry/SequenceTypeHandler.h
"
9
#include "
MantidPythonInterface/kernel/Registry/TypedPropertyValueHandler.h
"
10
11
#include <boost/python/class.hpp>
12
#include <boost/python/manage_new_object.hpp>
13
#include <boost/python/register_ptr_to_python.hpp>
14
#include <boost/python/return_value_policy.hpp>
15
16
using
Mantid::Kernel::Property
;
17
using
Mantid::PythonInterface::Registry::PropertyWithValueFactory
;
18
using namespace
boost::python
;
19
20
// Empty class definition
21
class
PropertyFactory
{};
22
23
// Helper namespace
24
namespace
propertyFactoryHelper
{
25
26
// Helper function to remove unique pointer and return a raw pointer
27
Property
*
removeUniquePointer
(
const
std::string &
name
,
const
boost::python::list &defaultValue) {
28
29
// Get the unique pointer from the factory and convert it into a raw pointer
30
auto
ptr = PropertyWithValueFactory::createTimeSeries(
name
, defaultValue);
31
32
return
ptr.release();
33
}
34
}
// namespace propertyFactoryHelper
35
36
// Export the PropertyFactory
37
void
export_PropertyFactory
() {
38
class_<PropertyFactory, boost::noncopyable>(
"PropertyFactory"
, no_init)
39
.def(
"createTimeSeries"
, &
propertyFactoryHelper::removeUniquePointer
, arg(
"log_name"
), arg(
"log_values"
),
40
return_value_policy<manage_new_object>())
41
.staticmethod(
"createTimeSeries"
);
42
}
name
std::string name
Definition
Run.cpp:60
export_PropertyFactory
void export_PropertyFactory()
Definition
PropertyFactory.cpp:37
PropertyWithValueFactory.h
SequenceTypeHandler.h
TypedPropertyValueHandler.h
Mantid::Kernel::Property
Base class for properties.
Definition
Property.h:94
Mantid::PythonInterface::Registry::PropertyWithValueFactory
Defines a static factory class that creates PropertyWithValue instances from python objects.
Definition
PropertyWithValueFactory.h:30
PropertyFactory
Definition
PropertyFactory.cpp:21
boost::python
Definition
NDArray.h:50
propertyFactoryHelper
Definition
PropertyFactory.cpp:24
propertyFactoryHelper::removeUniquePointer
Property * removeUniquePointer(const std::string &name, const boost::python::list &defaultValue)
Definition
PropertyFactory.cpp:27
Generated by
1.9.8