Mantid
Loading...
Searching...
No Matches
ToPyList.h
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2012 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
9#include <boost/python/list.hpp>
10#include <vector>
11
12namespace Mantid {
13namespace PythonInterface {
14namespace Converters {
15//-----------------------------------------------------------------------
16// Converter implementation
17//-----------------------------------------------------------------------
22template <typename ElementType> struct ToPyList {
28 inline boost::python::list operator()(const std::vector<ElementType> &cdata) const {
29 boost::python::list result;
30 for (const auto &item : cdata) {
31 result.append(item);
32 }
33 return result;
34 }
35};
36} // namespace Converters
37} // namespace PythonInterface
38} // namespace Mantid
Helper class which provides the Collimation Length for SANS instruments.
Converter that takes a std::vector and converts it into a python list.
Definition: ToPyList.h:22
boost::python::list operator()(const std::vector< ElementType > &cdata) const
Converts a cvector to a numpy array.
Definition: ToPyList.h:28