Mantid
Loading...
Searching...
No Matches
Framework
PythonInterface
core
inc
MantidPythonInterface
core
Converters
MapToPyDictionary.h
Go to the documentation of this file.
1
// Mantid Repository : https://github.com/mantidproject/mantid
2
//
3
// Copyright © 2015 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
#pragma once
8
12
#include <boost/python/dict.hpp>
13
#include <boost/python/object.hpp>
14
#include <map>
15
16
namespace
Mantid
{
17
namespace
PythonInterface {
18
namespace
Converters
{
19
20
template
<
typename
KeyType,
typename
ValueType>
struct
MapToPyDictionary
{
21
22
public
:
23
using
MapType
= std::map<KeyType, ValueType>;
24
25
MapToPyDictionary
(
const
MapType
&map) :
m_map
(map) {}
27
boost::python::dict
operator()
() {
28
using namespace
boost::python
;
29
boost::python::dict dictionary;
30
for
(
const
auto
&pair : this->
m_map
) {
31
dictionary[object(pair.first)] = object(pair.second);
32
}
33
return
dictionary;
34
}
35
36
private
:
38
MapType
m_map
;
39
};
40
}
// namespace Converters
41
}
// namespace PythonInterface
42
}
// namespace Mantid
Mantid::PythonInterface::Converters
Definition
CArrayToNDArray.h:13
Mantid
Helper class which provides the Collimation Length for SANS instruments.
Definition
AbsorptionCorrection.h:18
boost::python
Definition
NDArray.h:50
Mantid::PythonInterface::Converters::MapToPyDictionary
Definition
MapToPyDictionary.h:20
Mantid::PythonInterface::Converters::MapToPyDictionary::MapToPyDictionary
MapToPyDictionary(const MapType &map)
Definition
MapToPyDictionary.h:25
Mantid::PythonInterface::Converters::MapToPyDictionary::operator()
boost::python::dict operator()()
Produces a python dictionary.
Definition
MapToPyDictionary.h:27
Mantid::PythonInterface::Converters::MapToPyDictionary::m_map
MapType m_map
Map.
Definition
MapToPyDictionary.h:38
Mantid::PythonInterface::Converters::MapToPyDictionary::MapType
std::map< KeyType, ValueType > MapType
Definition
MapToPyDictionary.h:23
Generated by
1.9.8