Mantid
Loading...
Searching...
No Matches
UnitFactory.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 +
8#include "MantidKernel/Unit.h"
11
12#include <boost/python/class.hpp>
13#include <boost/python/return_value_policy.hpp>
14
19using namespace boost::python;
20
22
24 class_<UnitFactoryImpl, boost::noncopyable>("UnitFactoryImpl", no_init)
25 .def("create", &UnitFactoryImpl::create, (arg("self"), arg("className")),
26 "Creates a named unit if it exists in the factory")
27
28 .def("getKeys", &UnitFactoryImpl::getKeys, arg("self"), return_value_policy<Policies::VectorToNumpy>(),
29 "Returns a list of units available from the factory")
30
31 .def("Instance", &UnitFactory::Instance, return_value_policy<reference_existing_object>(),
32 "Returns a reference to the UnitFactory singleton")
33 .staticmethod("Instance");
34}
#define GET_POINTER_SPECIALIZATION(TYPE)
Definition: GetPointer.h:17
void export_UnitFactory()
Definition: UnitFactory.cpp:23
virtual std::shared_ptr< Unit > create(const std::string &className) const
Creates a new instance of the class with the given name.
virtual const std::vector< std::string > getKeys() const
Returns the keys in the map.
Manage the lifetime of a class intended to be a singleton.
Creates instances of concrete units.
Definition: UnitFactory.h:47