Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-12-14 10:31:18

0001 /// \file ROOT/RNTupleUtils.hxx
0002 /// \ingroup NTuple
0003 /// \author Jakob Blomer <jblomer@cern.ch>
0004 /// \date 2025-07-31
0005 
0006 /*************************************************************************
0007  * Copyright (C) 1995-2025, Rene Brun and Fons Rademakers.               *
0008  * All rights reserved.                                                  *
0009  *                                                                       *
0010  * For the licensing terms see $ROOTSYS/LICENSE.                         *
0011  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
0012  *************************************************************************/
0013 
0014 #ifndef ROOT_RNTupleUtils
0015 #define ROOT_RNTupleUtils
0016 
0017 #include <ROOT/RError.hxx>
0018 
0019 #include <cstddef>
0020 #include <memory>
0021 #include <string_view>
0022 
0023 namespace ROOT {
0024 
0025 class RLogChannel;
0026 
0027 namespace Internal {
0028 
0029 /// Log channel for RNTuple diagnostics.
0030 ROOT::RLogChannel &NTupleLog();
0031 
0032 template <typename T>
0033 auto MakeAliasedSharedPtr(T *rawPtr)
0034 {
0035    const static std::shared_ptr<T> fgRawPtrCtrlBlock;
0036    return std::shared_ptr<T>(fgRawPtrCtrlBlock, rawPtr);
0037 }
0038 
0039 /// Make an array of default-initialized elements. This is useful for buffers that do not need to be initialized.
0040 ///
0041 /// With C++20, this function can be replaced by std::make_unique_for_overwrite<T[]>.
0042 template <typename T>
0043 std::unique_ptr<T[]> MakeUninitArray(std::size_t size)
0044 {
0045    // DO NOT use std::make_unique<T[]>, the array elements are value-initialized!
0046    return std::unique_ptr<T[]>(new T[size]);
0047 }
0048 
0049 /// Check whether a given string is a valid name according to the RNTuple specification
0050 RResult<void> EnsureValidNameForRNTuple(std::string_view name, std::string_view where);
0051 
0052 } // namespace Internal
0053 } // namespace ROOT
0054 
0055 #endif