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(getParameterPath_Overload, InstrumentFileFinder::getParameterPath, 1, 2)
39GNU_DIAG_ON("conversion")
40GNU_DIAG_ON("unused-local-typedef")
41
43 register_ptr_to_python<std::shared_ptr<InstrumentFileFinder>>();
44
45 class_<InstrumentFileFinder>("InstrumentFileFinder", no_init)
46 // -
47 .def("getInstrumentFilename", &InstrumentFileFinder::getInstrumentFilename,
48 getInstrumentFilename_Overload("Returns IDF filename", (arg("instrument"), arg("date") = "")))
49 .staticmethod("getInstrumentFilename")
50 // -
51 .def("getParameterPath", &InstrumentFileFinder::getParameterPath,
52 getParameterPath_Overload("Returns the full path to the given instrument parameter file "
53 "for the named instrument if it exists in the instrument search "
54 "directories, or the optional user provided path.\n"
55
56 "instName: The name of the instrument to lookup the IPF "
57 "for\n"
58 "directoryHint: (Optional) Searches the user provided path "
59 "before any instrument dirs\n"
60 "returns: The full path as a string if found, else an "
61 "empty string",
62 (arg("instName"), arg("directoryHint") = "")))
63 .staticmethod("getParameterPath");
64}
#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 getInstrumentFilename(const std::string &instrumentName, const std::string &date="")
Get the IDF using the instrument name and date.