Logo ROOT  
Reference Guide
Loading...
Searching...
No Matches
RNTupleUtils.hxx
Go to the documentation of this file.
1/// \file ROOT/RNTupleUtils.hxx
2/// \author Jakob Blomer <jblomer@cern.ch>
3/// \date 2025-07-31
4
5/*************************************************************************
6 * Copyright (C) 1995-2025, Rene Brun and Fons Rademakers. *
7 * All rights reserved. *
8 * *
9 * For the licensing terms see $ROOTSYS/LICENSE. *
10 * For the list of contributors see $ROOTSYS/README/CREDITS. *
11 *************************************************************************/
12
13#ifndef ROOT_RNTupleUtils
14#define ROOT_RNTupleUtils
15
16#include <ROOT/RError.hxx>
17
18#include <cstddef>
19#include <memory>
20#include <string_view>
21
22namespace ROOT {
23
24class RLogChannel;
25
26namespace Internal {
27
28/// Log channel for RNTuple diagnostics.
29ROOT::RLogChannel &NTupleLog();
30
31template <typename T>
32auto MakeAliasedSharedPtr(T *rawPtr)
33{
34 const static std::shared_ptr<T> fgRawPtrCtrlBlock;
35 return std::shared_ptr<T>(fgRawPtrCtrlBlock, rawPtr);
36}
37
38/// Make an array of default-initialized elements. This is useful for buffers that do not need to be initialized.
39///
40/// With C++20, this function can be replaced by std::make_unique_for_overwrite<T[]>.
41template <typename T>
42std::unique_ptr<T[]> MakeUninitArray(std::size_t size)
43{
44 // DO NOT use std::make_unique<T[]>, the array elements are value-initialized!
45 return std::unique_ptr<T[]>(new T[size]);
46}
47
48/// Check whether a given string is a valid name according to the RNTuple specification
49RResult<void> EnsureValidNameForRNTuple(std::string_view name, std::string_view where);
50
51} // namespace Internal
52} // namespace ROOT
53
54#endif
size_t size(const MatrixT &matrix)
retrieve the size of a square matrix
char name[80]
Definition TGX11.cxx:148
A log configuration for a channel, e.g.
Definition RLogger.hxx:97
The class is used as a return type for operations that can fail; wraps a value of type T or an RError...
Definition RError.hxx:197
RResult< void > EnsureValidNameForRNTuple(std::string_view name, std::string_view where)
Check whether a given string is a valid name according to the RNTuple specification.
ROOT::RLogChannel & NTupleLog()
Log channel for RNTuple diagnostics.
std::unique_ptr< T[]> MakeUninitArray(std::size_t size)
Make an array of default-initialized elements.
auto MakeAliasedSharedPtr(T *rawPtr)