uproot-custom 2.3.1__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.gitignore +1 -1
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.pre-commit-config.yaml +1 -1
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/PKG-INFO +2 -2
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/README.md +1 -1
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/cpp/include/uproot-custom/uproot-custom.hh +41 -36
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/cpp/src/uproot-custom.cc +247 -247
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/example/override-streamer.md +11 -11
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/example/read-tobjarray.md +18 -18
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/index.md +1 -1
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/reference/reader-backends.md +1 -1
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/tutorial/customize-factory-reader/investigate-data.md +8 -8
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/tutorial/customize-factory-reader/pipeline.md +14 -14
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/tutorial/customize-factory-reader/port-to-cpp.md +37 -37
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/tutorial/customize-factory-reader/reader-and-factory.md +28 -28
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/tutorial/customize-factory-reader.md +1 -1
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/_version.py +3 -3
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/readers/python.py +206 -203
- uproot_custom-2.3.1/.github/workflows/auto-update.yml +0 -49
- uproot_custom-2.3.1/uv.lock +0 -3813
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.clang-format +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.github/release.yml +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.github/workflows/build-wheels.yml +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.github/workflows/deploy-docs.yml +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.github/workflows/python-publish.yml +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.github/workflows/semantic-pr-titles.yml +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.github/workflows/test-package.yml +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/.github/workflows/weekly-build.yml +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/LICENSE +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/cpp/CMakeLists.txt +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/cpp/share/cmake/uproot-customConfig.cmake +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/Doxyfile +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/conf.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/get-started.md +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/reference/api/.gitignore +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/reference/api/cpp-api.md +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/reference/api/cpp-module.md +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/reference/api/uproot-custom-ref.md +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/reference/api.md +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/reference/binary-format.md +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/reference/version-requirements.md +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/docs/tutorial/customize-factory-reader/project-setup.md +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/pyproject.toml +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/conftest.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_cstyle_array.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_pointers.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_primitive.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_root_objects.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_simple_obj.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_stl_array.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_stl_complicated.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_stl_map.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_stl_map_with_obj.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_stl_nested.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_stl_seq_with_obj.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_stl_sequence.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/data/test_stl_string.root +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/CMakeLists.txt +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/README.md +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/LinkDef.h +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TBasicTypes.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TCStyleArray.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TComplicatedSTL.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TNestedSTL.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TPointers.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TRootObjects.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TSTLArray.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TSTLMap.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TSTLMapWithObj.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TSTLSeqWithObj.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TSTLSequence.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TSTLString.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/include/TSimpleObject.hh +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/gen-test-data/src/main.cc +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/test_AsCustom.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/tests/test_readers.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/AsCustom.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/__init__.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/cpp.pyi +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/factories.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/readers/__init__.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/readers/_forth.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/readers/_numba.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/readers/cpp.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/share/cmake/__init__.py +0 -0
- {uproot_custom-2.3.1 → uproot_custom-2.4.0}/uproot_custom/utils.py +0 -0
|
@@ -98,7 +98,7 @@ ipython_config.py
|
|
|
98
98
|
# Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
|
|
99
99
|
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
|
100
100
|
# commonly ignored for libraries.
|
|
101
|
-
|
|
101
|
+
uv.lock
|
|
102
102
|
|
|
103
103
|
# poetry
|
|
104
104
|
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: uproot-custom
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: uproot extension for reading custom classes
|
|
5
5
|
Author-Email: Mingrun Li <mrli@ihep.ac.cn>
|
|
6
6
|
Classifier: Development Status :: 3 - Alpha
|
|
@@ -73,7 +73,7 @@ flowchart TD
|
|
|
73
73
|
raw_data --> build_ak
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
- `Reader` is a class that implements the logic to read data from binary
|
|
76
|
+
- `Reader` is a class that implements the logic to read data from binary streams. It can be written in **Python** (for development and debugging) or **C++** (for production performance).
|
|
77
77
|
- `Factory` is a Python class that creates, combines `Reader`s, and post-processes the data read by `Reader`s.
|
|
78
78
|
|
|
79
79
|
This mechanism is implemented as `AsCustom` interpretation. This makes uproot-custom well compatible with Uproot.
|
|
@@ -38,7 +38,7 @@ flowchart TD
|
|
|
38
38
|
raw_data --> build_ak
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
- `Reader` is a class that implements the logic to read data from binary
|
|
41
|
+
- `Reader` is a class that implements the logic to read data from binary streams. It can be written in **Python** (for development and debugging) or **C++** (for production performance).
|
|
42
42
|
- `Factory` is a Python class that creates, combines `Reader`s, and post-processes the data read by `Reader`s.
|
|
43
43
|
|
|
44
44
|
This mechanism is implemented as `AsCustom` interpretation. This makes uproot-custom well compatible with Uproot.
|
|
@@ -47,7 +47,7 @@ namespace uproot {
|
|
|
47
47
|
|
|
48
48
|
const uint16_t kStreamedMemberWise = 1 << 14; // streamed member-wise mask
|
|
49
49
|
|
|
50
|
-
class
|
|
50
|
+
class BinaryStream {
|
|
51
51
|
public:
|
|
52
52
|
enum EStatusBits {
|
|
53
53
|
kCanDelete = 1ULL << 0, ///< if object in a list can be deleted
|
|
@@ -75,11 +75,11 @@ namespace uproot {
|
|
|
75
75
|
using Reference = std::variant<RefCls, RefObj>;
|
|
76
76
|
|
|
77
77
|
/**
|
|
78
|
-
* @brief Construct a
|
|
78
|
+
* @brief Construct a BinaryStream from numpy arrays.
|
|
79
79
|
* @param data A numpy array of uint8_t containing the raw data.
|
|
80
80
|
* @param offsets A numpy array of uint32_t containing the offsets for each entry.
|
|
81
81
|
*/
|
|
82
|
-
|
|
82
|
+
BinaryStream( py::array_t<uint8_t> data, py::array_t<uint32_t> offsets,
|
|
83
83
|
uint32_t initial_cursor_position )
|
|
84
84
|
: m_data( static_cast<uint8_t*>( data.request().ptr ) )
|
|
85
85
|
, m_offsets( static_cast<uint32_t*>( offsets.request().ptr ) )
|
|
@@ -88,10 +88,10 @@ namespace uproot {
|
|
|
88
88
|
, m_cursor( static_cast<uint8_t*>( data.request().ptr ) ) {}
|
|
89
89
|
|
|
90
90
|
/**
|
|
91
|
-
* @brief Read a value of type T from the
|
|
91
|
+
* @brief Read a value of type T from the stream, handling endianness.
|
|
92
92
|
*
|
|
93
93
|
* @tparam T The type to read.
|
|
94
|
-
* @return The value read from the
|
|
94
|
+
* @return The value read from the stream.
|
|
95
95
|
*/
|
|
96
96
|
template <typename T>
|
|
97
97
|
const T read() {
|
|
@@ -136,14 +136,14 @@ namespace uproot {
|
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
/**
|
|
139
|
-
* @brief Read the fVersion field from the
|
|
139
|
+
* @brief Read the fVersion field from the stream
|
|
140
140
|
*
|
|
141
141
|
* @return The fVersion value
|
|
142
142
|
*/
|
|
143
143
|
const int16_t read_fVersion() { return read<int16_t>(); }
|
|
144
144
|
|
|
145
145
|
/**
|
|
146
|
-
* @brief Read the fNBytes field from the
|
|
146
|
+
* @brief Read the fNBytes field from the stream, checking the byte count mask.
|
|
147
147
|
*
|
|
148
148
|
* @return The fNBytes value without the mask.
|
|
149
149
|
* @exception std::runtime_error if the byte count mask is not set.
|
|
@@ -156,9 +156,9 @@ namespace uproot {
|
|
|
156
156
|
}
|
|
157
157
|
|
|
158
158
|
/**
|
|
159
|
-
* @brief Read a null-terminated (`\0`) string from the
|
|
159
|
+
* @brief Read a null-terminated (`\0`) string from the stream.
|
|
160
160
|
*
|
|
161
|
-
* @return The string read from the
|
|
161
|
+
* @return The string read from the stream.
|
|
162
162
|
*/
|
|
163
163
|
const std::string read_null_terminated_string() {
|
|
164
164
|
auto start = m_cursor;
|
|
@@ -168,7 +168,7 @@ namespace uproot {
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
/**
|
|
171
|
-
* @brief Read an object header from the
|
|
171
|
+
* @brief Read an object header from the stream. The object header has `fNBytes`,
|
|
172
172
|
* `fVersion`, `fTag`. If `fTag == kNewClassTag`, then a null-terminated class name
|
|
173
173
|
* follows.
|
|
174
174
|
*
|
|
@@ -183,11 +183,11 @@ namespace uproot {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
/**
|
|
186
|
-
* @brief Read a TString from the
|
|
186
|
+
* @brief Read a TString from the stream. A TString has `length` (uint8_t). If `length
|
|
187
187
|
* == 255`, then the `length` is a following uint32_t. Then following `length` bytes of
|
|
188
188
|
* string data.
|
|
189
189
|
*
|
|
190
|
-
* @return The TString data read from the
|
|
190
|
+
* @return The TString data read from the stream, as a std::string.
|
|
191
191
|
*/
|
|
192
192
|
const std::string read_TString() {
|
|
193
193
|
uint32_t length = read<uint8_t>();
|
|
@@ -198,7 +198,7 @@ namespace uproot {
|
|
|
198
198
|
}
|
|
199
199
|
|
|
200
200
|
/**
|
|
201
|
-
* @brief Skip `n` bytes in the
|
|
201
|
+
* @brief Skip `n` bytes in the stream.
|
|
202
202
|
*
|
|
203
203
|
* @param n Number of bytes to skip.
|
|
204
204
|
*/
|
|
@@ -216,7 +216,7 @@ namespace uproot {
|
|
|
216
216
|
void skip_fVersion() { skip( 2 ); }
|
|
217
217
|
|
|
218
218
|
/**
|
|
219
|
-
* @brief Skip a null-terminated (`\0`) string in the
|
|
219
|
+
* @brief Skip a null-terminated (`\0`) string in the stream.
|
|
220
220
|
*/
|
|
221
221
|
void skip_null_terminated_string() {
|
|
222
222
|
while ( *m_cursor != 0 ) { m_cursor++; }
|
|
@@ -224,7 +224,7 @@ namespace uproot {
|
|
|
224
224
|
}
|
|
225
225
|
|
|
226
226
|
/**
|
|
227
|
-
* @brief Skip an object header in the
|
|
227
|
+
* @brief Skip an object header in the stream. The object header has `fNBytes`,
|
|
228
228
|
* `fVersion`, `fTag`. If `fTag == kNewClassTag`, then a null-terminated class name
|
|
229
229
|
* follows.
|
|
230
230
|
*/
|
|
@@ -235,7 +235,7 @@ namespace uproot {
|
|
|
235
235
|
}
|
|
236
236
|
|
|
237
237
|
/**
|
|
238
|
-
* @brief Skip a TObject in the
|
|
238
|
+
* @brief Skip a TObject in the stream. A TObject has `fVersion` (2 bytes), `fUniqueID`
|
|
239
239
|
* (4 bytes), `fBits` (4 bytes). If `fBits & kIsReferenced`, then a `pidf` (2 bytes)
|
|
240
240
|
* follows.
|
|
241
241
|
*/
|
|
@@ -311,6 +311,11 @@ namespace uproot {
|
|
|
311
311
|
///< reading
|
|
312
312
|
};
|
|
313
313
|
|
|
314
|
+
// backward compatibility
|
|
315
|
+
using BinaryBuffer
|
|
316
|
+
[[deprecated( "BinaryBuffer is deprecated. Use BinaryStream instead." )]] =
|
|
317
|
+
BinaryStream;
|
|
318
|
+
|
|
314
319
|
/*
|
|
315
320
|
-----------------------------------------------------------------------------
|
|
316
321
|
-----------------------------------------------------------------------------
|
|
@@ -342,11 +347,11 @@ namespace uproot {
|
|
|
342
347
|
virtual const std::string name() const { return m_name; }
|
|
343
348
|
|
|
344
349
|
/**
|
|
345
|
-
* @brief Read an element from the
|
|
350
|
+
* @brief Read an element from the stream.
|
|
346
351
|
*
|
|
347
|
-
* @param
|
|
352
|
+
* @param stream The binary stream to read from.
|
|
348
353
|
*/
|
|
349
|
-
virtual void read(
|
|
354
|
+
virtual void read( BinaryStream& stream ) = 0;
|
|
350
355
|
|
|
351
356
|
/**
|
|
352
357
|
* @brief Get the data read by the reader. This should be called after the whole
|
|
@@ -357,53 +362,53 @@ namespace uproot {
|
|
|
357
362
|
virtual py::object data() const = 0;
|
|
358
363
|
|
|
359
364
|
/**
|
|
360
|
-
* @brief Read multiple elements from the
|
|
365
|
+
* @brief Read multiple elements from the stream in one go. Repeatedly calls @ref
|
|
361
366
|
* read() by default.
|
|
362
367
|
*
|
|
363
368
|
* @note When multiple elements are stored together, some classes may have "one common
|
|
364
369
|
* header + multiple data objects" format. This method can be overridden to handle such
|
|
365
370
|
* cases more efficiently.
|
|
366
371
|
*
|
|
367
|
-
* @param
|
|
372
|
+
* @param stream The binary stream to read from.
|
|
368
373
|
* @param count Number of elements to read.
|
|
369
374
|
* @return Number of elements read.
|
|
370
375
|
*/
|
|
371
|
-
virtual uint32_t read_many(
|
|
372
|
-
for ( int32_t i = 0; i < count; i++ ) { read(
|
|
376
|
+
virtual uint32_t read_many( BinaryStream& stream, const int64_t count ) {
|
|
377
|
+
for ( int32_t i = 0; i < count; i++ ) { read( stream ); }
|
|
373
378
|
return count;
|
|
374
379
|
}
|
|
375
380
|
|
|
376
381
|
/**
|
|
377
|
-
* @brief Read elements from the
|
|
382
|
+
* @brief Read elements from the stream until reaching the end position. Repeatedly
|
|
378
383
|
* calls @ref read() method by default.
|
|
379
384
|
*
|
|
380
385
|
* @note When multiple elements are stored together, some classes may have "one common
|
|
381
386
|
* header + multiple data objects" format. This method can be overridden to handle such
|
|
382
387
|
* cases more efficiently.
|
|
383
388
|
*
|
|
384
|
-
* @param
|
|
389
|
+
* @param stream The binary stream to read from.
|
|
385
390
|
* @param end_pos The end position pointer.
|
|
386
391
|
* @return Number of elements read.
|
|
387
392
|
*/
|
|
388
|
-
virtual uint32_t read_until(
|
|
393
|
+
virtual uint32_t read_until( BinaryStream& stream, const uint8_t* end_pos ) {
|
|
389
394
|
uint32_t cur_count = 0;
|
|
390
|
-
while (
|
|
395
|
+
while ( stream.get_cursor() < end_pos )
|
|
391
396
|
{
|
|
392
|
-
read(
|
|
397
|
+
read( stream );
|
|
393
398
|
cur_count++;
|
|
394
399
|
}
|
|
395
400
|
return cur_count;
|
|
396
401
|
}
|
|
397
402
|
|
|
398
403
|
/**
|
|
399
|
-
* @brief Read multiple elements from the
|
|
404
|
+
* @brief Read multiple elements from the stream in member-wise fashion. Readers
|
|
400
405
|
* that need to handle member-wise data reading must implement this method.
|
|
401
406
|
*
|
|
402
|
-
* @param
|
|
407
|
+
* @param stream The binary stream to read from.
|
|
403
408
|
* @param count Number of elements to read.
|
|
404
409
|
* @return Number of elements read.
|
|
405
410
|
*/
|
|
406
|
-
virtual uint32_t read_many_memberwise(
|
|
411
|
+
virtual uint32_t read_many_memberwise( BinaryStream& stream, const int64_t count ) {
|
|
407
412
|
throw std::runtime_error( name() + "::read_many_memberwise is not implemented." );
|
|
408
413
|
}
|
|
409
414
|
};
|
|
@@ -509,20 +514,20 @@ namespace uproot {
|
|
|
509
514
|
}
|
|
510
515
|
|
|
511
516
|
/**
|
|
512
|
-
* @brief Debug print function for
|
|
513
|
-
*
|
|
517
|
+
* @brief Debug print function for BinaryStream. Prints only when macro or environment
|
|
518
|
+
* variable with name `UPROOT_DEBUG` is defined. Call @ref BinaryStream::debug_print()
|
|
514
519
|
* internally.
|
|
515
520
|
*
|
|
516
|
-
* @param
|
|
521
|
+
* @param stream The BinaryStream to print.
|
|
517
522
|
* @param n Number of bytes to print.
|
|
518
523
|
*/
|
|
519
|
-
inline void debug_printf( uproot::
|
|
524
|
+
inline void debug_printf( uproot::BinaryStream& stream, const size_t n = 100 ) {
|
|
520
525
|
bool do_print = getenv( "UPROOT_DEBUG" );
|
|
521
526
|
#ifdef UPROOT_DEBUG
|
|
522
527
|
do_print = true;
|
|
523
528
|
#endif
|
|
524
529
|
if ( !do_print ) return;
|
|
525
|
-
|
|
530
|
+
stream.debug_print( n );
|
|
526
531
|
}
|
|
527
532
|
|
|
528
533
|
} // namespace uproot
|