Mantid
Loading...
Searching...
No Matches
ProductFunction.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 "MantidAPI/ProductFunction.h"
8#include <boost/python/class.hpp>
9#include <boost/python/overloads.hpp>
10
12using Mantid::API::ProductFunction;
13using namespace boost::python;
14
15namespace {
16
17using getParameterType1 = double (ProductFunction::*)(size_t) const;
18using getParameterType2 = double (ProductFunction::*)(const std::string &) const;
19
20using setParameterType2 = void (ProductFunction::*)(const std::string &, const double &, bool);
21
22BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(setParameterType2_Overloads, setParameter, 2, 3)
23} // namespace
24
26
27 class_<ProductFunction, bases<IFunction>, boost::noncopyable>("ProductFunction", "Composite Fit functions")
28 .def("nFunctions", &ProductFunction::nFunctions, arg("self"), "Get the number of member functions.")
29 .def("__len__", &ProductFunction::nFunctions, arg("self"), "Get the number of member functions.")
30 .def("getFunction", &ProductFunction::getFunction, (arg("self"), arg("i")), "Get the i-th function.")
31 .def("__getitem__", &ProductFunction::getFunction, (arg("self"), arg("i")), "Get the i-th function.")
32 .def("add", &ProductFunction::addFunction, (arg("self"), arg("function")), "Add a member function.")
33 .def("getParameterValue", (getParameterType1)&ProductFunction::getParameter, (arg("self"), arg("i")),
34 "Get value of parameter of given index.")
35 .def("getParameterValue", (getParameterType2)&ProductFunction::getParameter, (arg("self"), arg("name")),
36 "Get value of parameter of given name.")
37 .def("__getitem__", (getParameterType2)&ProductFunction::getParameter, (arg("self"), arg("name")),
38 "Get value of parameter of given name.")
39 .def("__setitem__", (setParameterType2)&ProductFunction::setParameter,
40 setParameterType2_Overloads((arg("self"), arg("name"), arg("value"), arg("explicitlySet")),
41 "Get value of parameter of given name."))
42 .def("__delitem__", &ProductFunction::removeFunction, (arg("self"), arg("index")));
43}
void export_ProductFunction()
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(valueAsPrettyStrOverloader, valueAsPrettyStr, 0, 2) void export_Property()
Definition: Property.cpp:102
This is an interface to a fitting function - a semi-abstarct class.
Definition: IFunction.h:163