Logo ROOT  
Reference Guide
RBookedCustomColumns.hxx
Go to the documentation of this file.
1// Author: Enrico Guiraud, Danilo Piparo, Massimo Tumolo CERN 06/2018
2
3/*************************************************************************
4 * Copyright (C) 1995-2018, Rene Brun and Fons Rademakers. *
5 * All rights reserved. *
6 * *
7 * For the licensing terms see $ROOTSYS/LICENSE. *
8 * For the list of contributors see $ROOTSYS/README/CREDITS. *
9 *************************************************************************/
10
11#ifndef ROOT_RDFBOOKEDCUSTOMCOLUMNS
12#define ROOT_RDFBOOKEDCUSTOMCOLUMNS
13
14#include <memory>
15#include <map>
16#include <vector>
17#include <string>
18#include <algorithm>
19#include "TString.h"
20
21namespace ROOT {
22namespace Detail {
23namespace RDF {
24class RCustomColumnBase;
25}
26}
27
28namespace Internal {
29namespace RDF {
30
32
33/**
34 * \class ROOT::Internal::RDF::RBookedCustomColumns
35 * \ingroup dataframe
36 * \brief Encapsulates the columns defined by the user
37 */
38
40 using RCustomColumnBasePtrMap_t = std::map<std::string, std::shared_ptr<RDFDetail::RCustomColumnBase>>;
41 using ColumnNames_t = std::vector<std::string>;
42
43 // Since RBookedCustomColumns is meant to be an immutable, copy-on-write object, the actual values are set as const
44 using RCustomColumnBasePtrMapPtr_t = std::shared_ptr<const RCustomColumnBasePtrMap_t>;
45 using ColumnNamesPtr_t = std::shared_ptr<const ColumnNames_t>;
46
47private:
50
51public:
52 ////////////////////////////////////////////////////////////////////////////
53 /// \brief Copy-ctor for RBookedCustomColumns.
55
56 ////////////////////////////////////////////////////////////////////////////
57 /// \brief Move-ctor for RBookedCustomColumns.
59
60 ////////////////////////////////////////////////////////////////////////////
61 /// \brief Copy-assignment operator for RBookedCustomColumns.
63
64 ////////////////////////////////////////////////////////////////////////////
65 /// \brief Creates the object starting from the provided maps
67 : fCustomColumns(customColumns), fCustomColumnsNames(customColumnNames)
68 {
69 }
70
71 ////////////////////////////////////////////////////////////////////////////
72 /// \brief Creates a new wrapper with empty maps
74 : fCustomColumns(std::make_shared<RCustomColumnBasePtrMap_t>()),
75 fCustomColumnsNames(std::make_shared<ColumnNames_t>())
76 {
77 }
78
79 ////////////////////////////////////////////////////////////////////////////
80 /// \brief Returns the list of the names of the defined columns
82
83 ////////////////////////////////////////////////////////////////////////////
84 /// \brief Returns the list of the pointers to the defined columns
86
87 ////////////////////////////////////////////////////////////////////////////
88 /// \brief Check if the provided name is tracked in the names list
89 bool HasName(std::string_view name) const;
90
91 ////////////////////////////////////////////////////////////////////////////
92 /// \brief Internally it recreates the map with the new column, and swaps with the old one.
93 void AddColumn(const std::shared_ptr<RDFDetail::RCustomColumnBase> &column, std::string_view name);
94
95 ////////////////////////////////////////////////////////////////////////////
96 /// \brief Internally it recreates the map with the new column name, and swaps with the old one.
98};
99
100} // Namespace RDF
101} // Namespace Internal
102} // Namespace ROOT
103
104#endif
char name[80]
Definition: TGX11.cxx:109
Encapsulates the columns defined by the user.
RBookedCustomColumns & operator=(const RBookedCustomColumns &)=default
Copy-assignment operator for RBookedCustomColumns.
RBookedCustomColumns(RBookedCustomColumns &&)=default
Move-ctor for RBookedCustomColumns.
void AddColumn(const std::shared_ptr< RDFDetail::RCustomColumnBase > &column, std::string_view name)
Internally it recreates the map with the new column, and swaps with the old one.
std::shared_ptr< const ColumnNames_t > ColumnNamesPtr_t
RBookedCustomColumns(RCustomColumnBasePtrMapPtr_t customColumns, ColumnNamesPtr_t customColumnNames)
Creates the object starting from the provided maps.
ColumnNames_t GetNames() const
Returns the list of the names of the defined columns.
std::map< std::string, std::shared_ptr< RDFDetail::RCustomColumnBase > > RCustomColumnBasePtrMap_t
bool HasName(std::string_view name) const
Check if the provided name is tracked in the names list.
const RCustomColumnBasePtrMap_t & GetColumns() const
Returns the list of the pointers to the defined columns.
void AddName(std::string_view name)
Internally it recreates the map with the new column name, and swaps with the old one.
RBookedCustomColumns()
Creates a new wrapper with empty maps.
RBookedCustomColumns(const RBookedCustomColumns &)=default
Copy-ctor for RBookedCustomColumns.
std::shared_ptr< const RCustomColumnBasePtrMap_t > RCustomColumnBasePtrMapPtr_t
basic_string_view< char > string_view
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
Definition: StringConv.hxx:21