ATLAS Offline Software
Loading...
Searching...
No Matches
Utility.h
Go to the documentation of this file.
1// This file's extension implies that it's C, but it's really -*- C++ -*-.
2/*
3 Copyright (C) 2002-2026 CERN for the benefit of the ATLAS collaboration
4*/
11
12
13#ifndef ROOTUTILS_UTILITY_H
14#define ROOTUTILS_UTILITY_H
15
16
17#include "Python.h"
18#include "TPython.h"
19#include "TClass.h"
20
21
22#if defined(ATLAS_HAVE_CPYCPPYY)
23#include "CPyCppyy/PyException.h"
24namespace RootUtils {
25 using PyException = CPyCppyy::PyException;
26}
27#elif defined(ATLAS_HAVE_CPYRT)
28#include "cpyrt/PyException.h"
29namespace RootUtils {
30using PyException = cppjit::cpyrt::PyException;
31}
32#else
33#include <exception>
34namespace RootUtils {
35 struct PyException : public std::exception {
36 const char* what() const noexcept override { return "Python exception"; }
37 };
38}
39#endif // ATLAS_HAVE_CPYCPPYY
40
41
42namespace RootUtils {
43
44
45int GetBuffer( PyObject* pyobject, char tc, int size, void*& buf, Bool_t check = kTRUE );
46TClass* objectIsA (PyObject* obj);
47bool setOwnership (PyObject* obj, bool flag);
48
49
50}
51
52
53#endif // not ROOTUTILS_UTILITY_H
_object PyObject
static Double_t tc
size_t size() const
Number of registered mappings.
bool setOwnership(PyObject *obj, bool flag)
Definition Utility.cxx:141
int GetBuffer(PyObject *pyobject, char tc, int size, void *&buf, Bool_t check)
Definition Utility.cxx:26
TClass * objectIsA(PyObject *obj)
Definition Utility.cxx:103
const char * what() const noexcept override
Definition Utility.h:36