Mantid
Loading...
Searching...
No Matches
ContainerDtype.h
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#pragma once
8
9#include <string>
10#include <type_traits>
11
22namespace Mantid {
23namespace PythonInterface {
24namespace Converters {
25
26// Free function to determine data type being stored in container
27template <template <class> class Container, typename HeldType> std::string dtype(const Container<HeldType> &) {
28 if (std::is_same<HeldType, bool>::value) {
29 return "b";
30 } else if (std::is_integral<HeldType>::value) {
31 return "i";
32 } else if (std::is_floating_point<HeldType>::value) {
33 return "f";
34 } else {
35 return "O";
36 }
37}
38
39} // namespace Converters
40} // namespace PythonInterface
41} // namespace Mantid
Models a Container is used to hold a sample in the beam.
Definition: Container.h:24
std::string dtype(const Container< HeldType > &)
Helper class which provides the Collimation Length for SANS instruments.