Mantid
Loading...
Searching...
No Matches
Framework
PythonInterface
mantid
kernel
src
Exports
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 +
7
#include "
MantidKernel/UnitFactory.h
"
8
#include "
MantidKernel/Unit.h
"
9
#include "
MantidPythonInterface/core/GetPointer.h
"
10
#include "
MantidPythonInterface/core/Policies/VectorToNumpy.h
"
11
12
#include <boost/python/class.hpp>
13
#include <boost/python/return_value_policy.hpp>
14
15
using
Mantid::Kernel::UnitFactory
;
16
using
Mantid::Kernel::UnitFactoryImpl
;
17
namespace
Policies
=
Mantid::PythonInterface::Policies
;
18
namespace
Converters
=
Mantid::PythonInterface::Converters
;
19
using namespace
boost::python
;
20
21
GET_POINTER_SPECIALIZATION
(
UnitFactoryImpl
)
22
23
void
export_UnitFactory
() {
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
}
GetPointer.h
GET_POINTER_SPECIALIZATION
#define GET_POINTER_SPECIALIZATION(TYPE)
Definition
GetPointer.h:17
export_UnitFactory
void export_UnitFactory()
Definition
UnitFactory.cpp:23
UnitFactory.h
Unit.h
VectorToNumpy.h
Mantid::Kernel::DynamicFactory< Unit >::create
virtual std::shared_ptr< Unit > create(const std::string &className) const
Creates a new instance of the class with the given name.
Definition
DynamicFactory.h:89
Mantid::Kernel::DynamicFactory< Unit >::getKeys
virtual const std::vector< std::string > getKeys() const
Returns the keys in the map.
Definition
DynamicFactory.h:171
Mantid::Kernel::UnitFactoryImpl
Creates instances of concrete units.
Definition
UnitFactory.h:47
Mantid::Kernel::UnitFactory
SingletonHolder< UnitFactoryImpl > UnitFactory
Definition
UnitFactory.h:79
Mantid::PythonInterface::Converters
Definition
CArrayToNDArray.h:13
Mantid::PythonInterface::Policies
Definition
AsType.h:20
boost::python
Definition
NDArray.h:50
Generated by
1.9.8