ATLAS Offline Software
PyROOTTFilePythonize.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-2020 CERN for the benefit of the ATLAS collaboration
4 */
15 #ifndef ROOTUTILS_PYROOTTFILEPYTHONIZE_H
16 #define ROOTUTILS_PYROOTTFILEPYTHONIZE_H 1
17 
18 // standard includes
19 #include <inttypes.h> //> for size_t
20 
21 // ROOT includes
22 #include "TFile.h"
23 
24 // forward declarations
25 
26 
27 namespace RootUtils {
28 
29 
30 class PyBytes
31 {
32 public:
37  PyBytes(size_t buf_sz=0);
38 
39  ~PyBytes();
40 
41  PyBytes(const PyBytes& rhs);
42 
43  PyBytes& operator=(const PyBytes& rhs);
44 
45  // data members
46 
49  size_t sz;
50 
53  std::vector<char> buf;
54 
59  void* buffer() const { return (void*)buf.data(); }
60 
61 };
62 
65 PyBytes _pythonize_read_root_file(TFile* f, Int_t len);
66 
69 Long64_t _pythonize_tell_root_file(TFile* f);
70 
71 } // namespace RootUtils
72 
73 
74 #endif // not ROOTUTILS_PYROOTTFILEPYTHONIZE_H
RootUtils
Definition: ILogger.h:20
python.CaloRecoConfig.f
f
Definition: CaloRecoConfig.py:127
RootUtils::PyBytes::PyBytes
PyBytes(size_t buf_sz=0)
wrapper around char* to explicitly mean bytes.
Definition: PyROOTTFilePythonize.cxx:22
RootUtils::PyBytes::buffer
void * buffer() const
After we drop py2, we can simplify the code in PyUtils.RootUtils.py by just returning a bytes object ...
Definition: PyROOTTFilePythonize.h:59
RootUtils::_pythonize_read_root_file
PyBytes _pythonize_read_root_file(TFile *f, Int_t len)
read len bytes from file f
Definition: PyROOTTFilePythonize.cxx:60
RootUtils::PyBytes::buf
std::vector< char > buf
the buffer of bytes
Definition: PyROOTTFilePythonize.h:53
RootUtils::PyBytes::~PyBytes
~PyBytes()
Definition: PyROOTTFilePythonize.cxx:28
RootUtils::PyBytes
Definition: PyROOTTFilePythonize.h:31
RootUtils::PyBytes::sz
size_t sz
the size of the buffer of bytes
Definition: PyROOTTFilePythonize.h:49
RootUtils::PyBytes::operator=
PyBytes & operator=(const PyBytes &rhs)
Definition: PyROOTTFilePythonize.cxx:39
RootUtils::_pythonize_tell_root_file
Long64_t _pythonize_tell_root_file(TFile *f)
tell the current position in file f
Definition: PyROOTTFilePythonize.cxx:49