Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
RNTupleWriteOptions.cxx
Go to the documentation of this file.
1/// \file RNTupleWriteOptions.cxx
2/// \ingroup NTuple ROOT7
3/// \author Jakob Blomer <jblomer@cern.ch>
4/// \date 2024-02-22
5/// \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback
6/// is welcome!
7
8/*************************************************************************
9 * Copyright (C) 1995-2024, Rene Brun and Fons Rademakers. *
10 * All rights reserved. *
11 * *
12 * For the licensing terms see $ROOTSYS/LICENSE. *
13 * For the list of contributors see $ROOTSYS/README/CREDITS. *
14 *************************************************************************/
15
16#include <ROOT/RError.hxx>
18
19#include <utility>
20
21namespace {
22
23void EnsureValidTunables(std::size_t zippedClusterSize, std::size_t unzippedClusterSize,
24 std::size_t initialUnzippedPageSize, std::size_t maxUnzippedPageSize)
25{
26 using RException = ROOT::Experimental::RException;
27 if (zippedClusterSize == 0) {
28 throw RException(R__FAIL("invalid target cluster size: 0"));
29 }
30 if (initialUnzippedPageSize == 0) {
31 throw RException(R__FAIL("invalid initial page size: 0"));
32 }
33 if (maxUnzippedPageSize == 0) {
34 throw RException(R__FAIL("invalid maximum page size: 0"));
35 }
36 if (zippedClusterSize > unzippedClusterSize) {
37 throw RException(R__FAIL("compressed target cluster size must not be larger than "
38 "maximum uncompressed cluster size"));
39 }
40 if (initialUnzippedPageSize > maxUnzippedPageSize) {
41 throw RException(R__FAIL("initial page size must not be larger than maximum page size"));
42 }
43 if (maxUnzippedPageSize > unzippedClusterSize) {
44 throw RException(R__FAIL("maximum page size must not be larger than "
45 "maximum uncompressed cluster size"));
46 }
47}
48
49} // anonymous namespace
50
51std::unique_ptr<ROOT::Experimental::RNTupleWriteOptions> ROOT::Experimental::RNTupleWriteOptions::Clone() const
52{
53 return std::make_unique<RNTupleWriteOptions>(*this);
54}
55
57{
58 EnsureValidTunables(val, fMaxUnzippedClusterSize, fInitialUnzippedPageSize, fMaxUnzippedPageSize);
59 fApproxZippedClusterSize = val;
60}
61
63{
64 EnsureValidTunables(fApproxZippedClusterSize, val, fInitialUnzippedPageSize, fMaxUnzippedPageSize);
65 fMaxUnzippedClusterSize = val;
66}
67
69{
70 EnsureValidTunables(fApproxZippedClusterSize, fMaxUnzippedClusterSize, val, fMaxUnzippedPageSize);
71 fInitialUnzippedPageSize = val;
72}
73
75{
76 EnsureValidTunables(fApproxZippedClusterSize, fMaxUnzippedClusterSize, fInitialUnzippedPageSize, val);
77 fMaxUnzippedPageSize = val;
78}
79
81{
82 if (fPageBufferBudget != 0)
83 return fPageBufferBudget;
84
85 return GetApproxZippedClusterSize() + (GetCompression() != 0) * GetApproxZippedClusterSize();
86}
#define R__FAIL(msg)
Short-hand to return an RResult<T> in an error state; the RError is implicitly converted into RResult...
Definition RError.hxx:290
Base class for all ROOT issued exceptions.
Definition RError.hxx:78
virtual std::unique_ptr< RNTupleWriteOptions > Clone() const