Mantid
Loading...
Searching...
No Matches
InstrumentFileFinder.cpp
Go to the documentation of this file.
1// Mantid Repository : https://github.com/mantidproject/mantid
2//
3// Copyright © 2020 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
9
11
16
17#include <boost/python/class.hpp>
18#include <boost/python/copy_const_reference.hpp>
19#include <boost/python/list.hpp>
20#include <boost/python/overloads.hpp>
21#include <boost/python/register_ptr_to_python.hpp>
22
23#include <string>
24
26using namespace Mantid::PythonInterface;
27using namespace boost::python;
28
30
31GNU_DIAG_OFF("unused-local-typedef")
32// Ignore -Wconversion warnings coming from boost::python
33// Seen with GCC 7.1.1 and Boost 1.63.0
34GNU_DIAG_OFF("conversion")
36// cppcheck-suppress unknownMacro
37BOOST_PYTHON_FUNCTION_OVERLOADS(getInstrumentFilename_Overload, InstrumentFileFinder::getInstrumentFilename, 1, 2)
38BOOST_PYTHON_FUNCTION_OVERLOADS(getParameterFilename_Overload, InstrumentFileFinder::getParameterFilename, 1, 3)
39BOOST_PYTHON_FUNCTION_OVERLOADS(getParameterPath_Overload, InstrumentFileFinder::getParameterPath, 1, 2)
40GNU_DIAG_ON("conversion")
41GNU_DIAG_ON("unused-local-typedef")
42
44 register_ptr_to_python<std::shared_ptr<InstrumentFileFinder>>();
45
46 class_<InstrumentFileFinder>("InstrumentFileFinder", no_init)
47 // -
48 .def("getInstrumentFilename", &InstrumentFileFinder::getInstrumentFilename,
49 getInstrumentFilename_Overload("Returns IDF filename", (arg("instrument"), arg("date") = "")))
50 .staticmethod("getInstrumentFilename")
51 //
52 .def("getParameterFilename", &InstrumentFileFinder::getParameterFilename,
53 getParameterFilename_Overload("Returns Instrument Parameter filename",
54 (arg("instrument"), arg("date") = "", arg("dirHint") = "")))
55 .staticmethod("getParameterFilename")
56 // -
57 .def("getParameterPath", &InstrumentFileFinder::getParameterPath,
58 getParameterPath_Overload("Returns the full path to the given instrument parameter file "
59 "for the named instrument if it exists in the instrument search "
60 "directories, or the optional user provided path.\n"
61
62 "instName: The name of the instrument to lookup the IPF "
63 "for\n"
64 "directoryHint: (Optional) Searches the user provided path "
65 "before any instrument dirs\n"
66 "returns: The full path as a string if found, else an "
67 "empty string",
68 (arg("instName"), arg("directoryHint") = "")))
69 .staticmethod("getParameterPath");
70}
#define GET_POINTER_SPECIALIZATION(TYPE)
Definition GetPointer.h:17
void exportInstrumentFileFinder()
Overload generator for getInstrumentFilename.
#define GNU_DIAG_ON(x)
#define GNU_DIAG_OFF(x)
This is a collection of macros for turning compiler warnings off in a controlled manner.
static std::string getParameterPath(const std::string &instName, const std::string &dirHint="")
Search instrument directories for Parameter file, return full path name if found, else "".
static std::string getParameterFilename(const std::string &instrumentName, const std::string &date="", const std::string &dirHint="")
Get the Parameter file using the instrument name and date, optionally searching dirHint first before ...
static std::string getInstrumentFilename(const std::string &instrumentName, const std::string &date="")
Get the IDF using the instrument name and date.