Mantid
Loading...
Searching...
No Matches
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 +
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
18using namespace boost::python;
19
20// Empty class definition
22
23// Helper namespace
25
26// Helper function to remove unique pointer and return a raw pointer
27Property *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
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}
void export_PropertyFactory()
Base class for properties.
Definition: Property.h:94
Defines a static factory class that creates PropertyWithValue instances from python objects.
Property * removeUniquePointer(const std::string &name, const boost::python::list &defaultValue)