Mantid
Loading...
Searching...
No Matches
Framework
PythonInterface
core
src
WrapperHelpers.cpp
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
//-----------------------------------------------------------------------------
8
// Includes
9
//-----------------------------------------------------------------------------
10
#include "
MantidPythonInterface/core/WrapperHelpers.h
"
11
12
using namespace
boost::python
;
13
14
namespace
Mantid::PythonInterface
{
15
32
bool
typeHasAttribute
(PyObject *
obj
,
const
char
*attr) {
33
PyObject *cls_dict =
obj
->ob_type->tp_dict;
34
object
key(handle<>(to_python_value<char const *&>()(attr)));
35
return
PyDict_Contains(cls_dict, key.ptr()) > 0;
36
}
37
43
bool
typeHasAttribute
(
const
boost::python::detail::wrapper_base &wrapper,
const
char
*attr) {
44
using namespace
boost::python::detail;
45
return
typeHasAttribute
(wrapper_base_::get_owner(wrapper), attr);
46
}
47
48
}
// namespace Mantid::PythonInterface
obj
double obj
the value of the quadratic function
Definition
TrustRegionMinimizer.cpp:495
WrapperHelpers.h
Mantid::PythonInterface
Definition
CallMethod.h:17
Mantid::PythonInterface::typeHasAttribute
bool MANTID_PYTHONINTERFACE_CORE_DLL typeHasAttribute(PyObject *obj, const char *attr)
This namespace contains helper functions for classes that are overridden in Python.
Definition
WrapperHelpers.cpp:32
boost::python
Definition
NDArray.h:50
Generated by
1.9.8