Skip to content

Commit 2da497a

Browse files
committed
Replace using declarations for stable API
The only exceptions are alias declarations (to shorten type names) and structure/feature_flag/write.C, which uses the Internal API.
1 parent a113c63 commit 2da497a

89 files changed

Lines changed: 663 additions & 980 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

compression/algorithms/write_algorithm.hxx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,21 @@
33
#include <ROOT/RNTupleWriteOptions.hxx>
44
#include <ROOT/RNTupleWriter.hxx>
55

6-
using ROOT::ENTupleColumnType;
7-
using ROOT::RNTupleModel;
8-
using ROOT::RNTupleWriteOptions;
9-
using ROOT::RNTupleWriter;
10-
116
#include <cstdint>
127
#include <memory>
138
#include <string_view>
149

1510
void write_algorithm(std::string_view filename, std::uint32_t compression) {
16-
auto model = RNTupleModel::Create();
11+
auto model = ROOT::RNTupleModel::Create();
1712

1813
auto Int64 = model->MakeField<std::int64_t>("Int64");
1914
model->GetMutableField("Int64").SetColumnRepresentatives(
20-
{{ENTupleColumnType::kSplitInt64}});
15+
{{ROOT::ENTupleColumnType::kSplitInt64}});
2116

22-
RNTupleWriteOptions options;
17+
ROOT::RNTupleWriteOptions options;
2318
options.SetCompression(compression);
24-
auto writer =
25-
RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options);
19+
auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl",
20+
filename, options);
2621

2722
// Write 32 entries to make sure the compression block is not too small.
2823
for (int i = 0; i < 32; i++) {

compression/block/big/write.C

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,26 @@
33
#include <ROOT/RNTupleWriteOptions.hxx>
44
#include <ROOT/RNTupleWriter.hxx>
55

6-
using ROOT::ENTupleColumnType;
7-
using ROOT::RNTupleModel;
8-
using ROOT::RNTupleWriteOptions;
9-
using ROOT::RNTupleWriter;
10-
116
#include <cstdint>
127
#include <memory>
138
#include <string_view>
149

1510
void write(std::string_view filename = "compression.block.big.root") {
16-
auto model = RNTupleModel::Create();
11+
auto model = ROOT::RNTupleModel::Create();
1712

1813
auto Int64 = model->MakeField<std::int64_t>("Int64");
1914
model->GetMutableField("Int64").SetColumnRepresentatives(
20-
{{ENTupleColumnType::kSplitInt64}});
15+
{{ROOT::ENTupleColumnType::kSplitInt64}});
2116

22-
RNTupleWriteOptions options;
17+
ROOT::RNTupleWriteOptions options;
2318
// Crank up the zstd compression level to reduce the output file size by
2419
// approximately a factor 6 (from 76K with 505 to 12K).
2520
options.SetCompression(509);
2621
// Increase the maximum unzipped page size to make it bigger than the maximum
2722
// size of a compression block, which is 16 MiB.
2823
options.SetMaxUnzippedPageSize(128 * 1024 * 1024);
29-
auto writer =
30-
RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options);
24+
auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl",
25+
filename, options);
3126

3227
// Write 40 MiB of entries that will be split into three compression blocks.
3328
static constexpr int Entries = 40 * 1024 * 1024 / sizeof(std::int64_t);

compression/block/short/write.C

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,21 @@
33
#include <ROOT/RNTupleWriteOptions.hxx>
44
#include <ROOT/RNTupleWriter.hxx>
55

6-
using ROOT::ENTupleColumnType;
7-
using ROOT::RNTupleModel;
8-
using ROOT::RNTupleWriteOptions;
9-
using ROOT::RNTupleWriter;
10-
116
#include <cstdint>
127
#include <memory>
138
#include <string_view>
149

1510
void write(std::string_view filename = "compression.block.short.root") {
16-
auto model = RNTupleModel::Create();
11+
auto model = ROOT::RNTupleModel::Create();
1712

1813
auto Int64 = model->MakeField<std::int64_t>("Int64");
1914
model->GetMutableField("Int64").SetColumnRepresentatives(
20-
{{ENTupleColumnType::kSplitInt64}});
15+
{{ROOT::ENTupleColumnType::kSplitInt64}});
2116

22-
RNTupleWriteOptions options;
17+
ROOT::RNTupleWriteOptions options;
2318
options.SetCompression(505);
24-
auto writer =
25-
RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options);
19+
auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl",
20+
filename, options);
2621

2722
// Write only 2 entries to make sure the compression block is small and
2823
// actually stored uncompressed.

compression/read_compression.hxx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,14 @@
11
#include <ROOT/REntry.hxx>
22
#include <ROOT/RNTupleReader.hxx>
33

4-
using ROOT::REntry;
5-
using ROOT::RNTupleReader;
6-
74
#include <cstdint>
85
#include <fstream>
96
#include <ostream>
107
#include <string>
118
#include <string_view>
129

1310
void read_compression(std::string_view input, std::string_view output) {
14-
auto reader = RNTupleReader::Open("ntpl", input);
11+
auto reader = ROOT::RNTupleReader::Open("ntpl", input);
1512
auto Int64 =
1613
reader->GetModel().GetDefaultEntry().GetPtr<std::int64_t>("Int64");
1714
std::int64_t sum = 0;

projections/cardinality/read.C

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#include <ROOT/RNTupleReader.hxx>
33
#include <ROOT/RNTupleUtil.hxx>
44

5-
using ROOT::REntry;
6-
using ROOT::RNTupleReader;
7-
85
#include <cstdint>
96
#include <fstream>
107
#include <ostream>
@@ -14,7 +11,7 @@ using ROOT::RNTupleReader;
1411

1512
using Vector = std::vector<std::int32_t>;
1613

17-
static void PrintVectorValue(const REntry &entry, std::string_view name,
14+
static void PrintVectorValue(const ROOT::REntry &entry, std::string_view name,
1815
std::ostream &os, bool last = false) {
1916
Vector &value = *entry.GetPtr<Vector>(name);
2017
os << " \"" << name << "\": [";
@@ -38,7 +35,7 @@ static void PrintVectorValue(const REntry &entry, std::string_view name,
3835
}
3936

4037
template <typename T>
41-
static void PrintCardinality(const REntry &entry, std::string_view name,
38+
static void PrintCardinality(const ROOT::REntry &entry, std::string_view name,
4239
std::ostream &os, bool last = false) {
4340
T value = *entry.GetPtr<ROOT::RNTupleCardinality<T>>(name);
4441
os << " \"" << name << "\": " << value;
@@ -53,7 +50,7 @@ void read(std::string_view input = "projections.cardinality.root",
5350
std::ofstream os(std::string{output});
5451
os << "[\n";
5552

56-
auto reader = RNTupleReader::Open("ntpl", input);
53+
auto reader = ROOT::RNTupleReader::Open("ntpl", input);
5754
auto &entry = reader->GetModel().GetDefaultEntry();
5855
bool first = true;
5956
for (auto index : *reader) {

projections/cardinality/write.C

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,6 @@
44
#include <ROOT/RNTupleWriteOptions.hxx>
55
#include <ROOT/RNTupleWriter.hxx>
66

7-
using ROOT::ENTupleColumnType;
8-
using ROOT::RField;
9-
using ROOT::RNTupleModel;
10-
using ROOT::RNTupleWriteOptions;
11-
using ROOT::RNTupleWriter;
12-
137
#include <cstdint>
148
#include <memory>
159
#include <string>
@@ -18,37 +12,40 @@ using ROOT::RNTupleWriter;
1812

1913
using Vector = std::vector<std::int32_t>;
2014

21-
static std::shared_ptr<Vector> MakeVectorField(RNTupleModel &model,
22-
std::string_view name,
23-
ENTupleColumnType indexType) {
24-
auto field = std::make_unique<RField<Vector>>(name);
15+
static std::shared_ptr<Vector>
16+
MakeVectorField(ROOT::RNTupleModel &model, std::string_view name,
17+
ROOT::ENTupleColumnType indexType) {
18+
auto field = std::make_unique<ROOT::RField<Vector>>(name);
2519
field->SetColumnRepresentatives({{indexType}});
2620
model.AddField(std::move(field));
2721
return model.GetDefaultEntry().GetPtr<Vector>(name);
2822
}
2923

3024
template <typename T>
31-
static void AddProjectedCardinalityField(RNTupleModel &model,
25+
static void AddProjectedCardinalityField(ROOT::RNTupleModel &model,
3226
std::string_view name,
3327
std::string_view source) {
34-
auto field = std::make_unique<RField<ROOT::RNTupleCardinality<T>>>(name);
28+
auto field =
29+
std::make_unique<ROOT::RField<ROOT::RNTupleCardinality<T>>>(name);
3530
model.AddProjectedField(std::move(field), [&source](const std::string &) {
3631
return std::string{source};
3732
});
3833
}
3934

4035
void write(std::string_view filename = "projections.cardinality.root") {
41-
auto model = RNTupleModel::Create();
36+
auto model = ROOT::RNTupleModel::Create();
4237

4338
// Non-split index encoding
44-
auto Index32 = MakeVectorField(*model, "Index32", ENTupleColumnType::kIndex32);
45-
auto Index64 = MakeVectorField(*model, "Index64", ENTupleColumnType::kIndex64);
39+
auto Index32 =
40+
MakeVectorField(*model, "Index32", ROOT::ENTupleColumnType::kIndex32);
41+
auto Index64 =
42+
MakeVectorField(*model, "Index64", ROOT::ENTupleColumnType::kIndex64);
4643

4744
// Split index encoding
48-
auto SplitIndex32 =
49-
MakeVectorField(*model, "SplitIndex32", ENTupleColumnType::kSplitIndex32);
50-
auto SplitIndex64 =
51-
MakeVectorField(*model, "SplitIndex64", ENTupleColumnType::kSplitIndex64);
45+
auto SplitIndex32 = MakeVectorField(*model, "SplitIndex32",
46+
ROOT::ENTupleColumnType::kSplitIndex32);
47+
auto SplitIndex64 = MakeVectorField(*model, "SplitIndex64",
48+
ROOT::ENTupleColumnType::kSplitIndex64);
5249

5350
// Create RNTupleCardinality projections
5451
AddProjectedCardinalityField<std::uint32_t>(*model, "Index32Cardinality",
@@ -60,10 +57,10 @@ void write(std::string_view filename = "projections.cardinality.root") {
6057
AddProjectedCardinalityField<std::uint64_t>(*model, "SplitIndex64Cardinality",
6158
"SplitIndex64");
6259

63-
RNTupleWriteOptions options;
60+
ROOT::RNTupleWriteOptions options;
6461
options.SetCompression(0);
65-
auto writer =
66-
RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options);
62+
auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl",
63+
filename, options);
6764

6865
// First entry: single-element vectors, with ascending values
6966
*Index32 = {1};

projections/collection/read.C

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#include <ROOT/RNTupleReader.hxx>
33
#include <ROOT/RVec.hxx>
44

5-
using ROOT::REntry;
6-
using ROOT::RNTupleReader;
7-
85
#include <cstdint>
96
#include <fstream>
107
#include <ostream>
@@ -13,8 +10,9 @@ using ROOT::RNTupleReader;
1310
#include <vector>
1411

1512
template <typename C>
16-
static void PrintCollectionValue(const REntry &entry, std::string_view name,
17-
std::ostream &os, bool last = false) {
13+
static void PrintCollectionValue(const ROOT::REntry &entry,
14+
std::string_view name, std::ostream &os,
15+
bool last = false) {
1816
C &value = *entry.GetPtr<C>(name);
1917
os << " \"" << name << "\": [";
2018
bool first = true;
@@ -41,7 +39,7 @@ void read(std::string_view input = "projections.collection.root",
4139
std::ofstream os(std::string{output});
4240
os << "[\n";
4341

44-
auto reader = RNTupleReader::Open("ntpl", input);
42+
auto reader = ROOT::RNTupleReader::Open("ntpl", input);
4543
auto &entry = reader->GetModel().GetDefaultEntry();
4644
bool first = true;
4745
for (auto index : *reader) {

projections/collection/write.C

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,18 @@
44
#include <ROOT/RNTupleWriter.hxx>
55
#include <ROOT/RVec.hxx>
66

7-
using ROOT::RField;
8-
using ROOT::RNTupleModel;
9-
using ROOT::RNTupleWriteOptions;
10-
using ROOT::RNTupleWriter;
11-
127
#include <cstdint>
138
#include <memory>
149
#include <string>
1510
#include <string_view>
1611
#include <vector>
1712

1813
void write(std::string_view filename = "projections.collection.root") {
19-
auto model = RNTupleModel::Create();
14+
auto model = ROOT::RNTupleModel::Create();
2015

2116
auto Vector = model->MakeField<std::vector<std::int32_t>>("Vector");
2217
auto Projected =
23-
std::make_unique<RField<ROOT::RVec<std::int32_t>>>("Projected");
18+
std::make_unique<ROOT::RField<ROOT::RVec<std::int32_t>>>("Projected");
2419
model->AddProjectedField(std::move(Projected),
2520
[](const std::string &fieldName) {
2621
if (fieldName == "Projected") {
@@ -30,10 +25,10 @@ void write(std::string_view filename = "projections.collection.root") {
3025
}
3126
});
3227

33-
RNTupleWriteOptions options;
28+
ROOT::RNTupleWriteOptions options;
3429
options.SetCompression(0);
35-
auto writer =
36-
RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options);
30+
auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl",
31+
filename, options);
3732

3833
// First entry: ascending values
3934
*Vector = {1, 2};

projections/leaf/read.C

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
#include <ROOT/RNTupleReader.hxx>
33
#include <ROOT/RNTupleUtil.hxx>
44

5-
using ROOT::REntry;
6-
using ROOT::RNTupleReader;
7-
85
#include <cstdint>
96
#include <fstream>
107
#include <ostream>
@@ -23,7 +20,7 @@ template <> void PrintValue(const float &value, std::ostream &os) {
2320
}
2421

2522
template <typename T, typename U>
26-
static void PrintPairValue(const REntry &entry, std::string_view name,
23+
static void PrintPairValue(const ROOT::REntry &entry, std::string_view name,
2724
std::ostream &os, bool last = false) {
2825
auto &value = *entry.GetPtr<std::pair<T, U>>(name);
2926
os << " \"" << name << "\": [\n";
@@ -41,7 +38,7 @@ static void PrintPairValue(const REntry &entry, std::string_view name,
4138
}
4239

4340
template <typename T>
44-
static void PrintValue(const REntry &entry, std::string_view name,
41+
static void PrintValue(const ROOT::REntry &entry, std::string_view name,
4542
std::ostream &os, bool last = false) {
4643
T value = *entry.GetPtr<T>(name);
4744
os << " \"" << name << "\": ";
@@ -59,7 +56,7 @@ void read(std::string_view input = "projections.leaf.root",
5956
os << std::hexfloat;
6057
os << "[\n";
6158

62-
auto reader = RNTupleReader::Open("ntpl", input);
59+
auto reader = ROOT::RNTupleReader::Open("ntpl", input);
6360
auto &entry = reader->GetModel().GetDefaultEntry();
6461
bool first = true;
6562
for (auto index : *reader) {

projections/leaf/write.C

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,37 +3,32 @@
33
#include <ROOT/RNTupleWriteOptions.hxx>
44
#include <ROOT/RNTupleWriter.hxx>
55

6-
using ROOT::RField;
7-
using ROOT::RNTupleModel;
8-
using ROOT::RNTupleWriteOptions;
9-
using ROOT::RNTupleWriter;
10-
116
#include <cstdint>
127
#include <memory>
138
#include <string>
149
#include <string_view>
1510
#include <utility>
1611

1712
template <typename T>
18-
static void AddProjectedField(RNTupleModel &model, std::string_view name,
13+
static void AddProjectedField(ROOT::RNTupleModel &model, std::string_view name,
1914
std::string_view source) {
20-
auto field = std::make_unique<RField<T>>(name);
15+
auto field = std::make_unique<ROOT::RField<T>>(name);
2116
model.AddProjectedField(std::move(field), [&source](const std::string &) {
2217
return std::string{source};
2318
});
2419
}
2520

2621
void write(std::string_view filename = "projections.leaf.root") {
27-
auto model = RNTupleModel::Create();
22+
auto model = ROOT::RNTupleModel::Create();
2823

2924
auto Pair = model->MakeField<std::pair<std::int32_t, float>>("Pair");
3025
AddProjectedField<std::int32_t>(*model, "Int32", "Pair._0");
3126
AddProjectedField<float>(*model, "Float", "Pair._1");
3227

33-
RNTupleWriteOptions options;
28+
ROOT::RNTupleWriteOptions options;
3429
options.SetCompression(0);
35-
auto writer =
36-
RNTupleWriter::Recreate(std::move(model), "ntpl", filename, options);
30+
auto writer = ROOT::RNTupleWriter::Recreate(std::move(model), "ntpl",
31+
filename, options);
3732

3833
// First entry: ascending values
3934
*Pair = {1, 2.0};

0 commit comments

Comments
 (0)