1 #ifndef RDFAnalysis_OutputWriter_H 2 #define RDFAnalysis_OutputWriter_H 9 #include <TDirectory.h> 28 template <
typename Detail>
37 OutputWriter(
const std::shared_ptr<TDirectory>& directory);
45 const std::string& fileName,
46 bool overwrite =
false);
69 { m_writers.push_back(writer); }
72 template <
typename T> std::enable_if_t<std::is_base_of<INodeWriter<Detail>, T>{},
74 {
addWriter(std::make_shared<T>(std::move(writer) ) ); }
85 template <
template<
class>
class T,
typename... Args>
86 std::enable_if_t<std::is_base_of<INodeWriter<Detail>, T<Detail>>{},
void>
addWriter(
88 {
addWriter(std::make_shared<T<Detail>>(std::forward<Args>(args)...) ); }
91 std::vector<std::shared_ptr<INodeWriter<Detail>>>&
writers()
95 const std::vector<std::shared_ptr<INodeWriter<Detail>>>&
writers()
const 100 std::shared_ptr<TDirectory> m_directory;
103 std::vector<std::shared_ptr<INodeWriter<Detail>>> m_writers;
107 TDirectory* directory,
108 std::size_t depth = 0);
112 TDirectory* directory,
116 #include "RDFAnalysis/OutputWriter.icc" 117 #endif //> !RDFAnalysis_OutputWriter_H void addWriter(const std::shared_ptr< INodeWriter< Detail >> &writer)
Add a writer.
Definition: OutputWriter.h:68
Helper struct to define a region.
Definition: Scheduler.h:49
Abstract base class for node writers.
Base class for writing specific information from Nodes to file.
Definition: INodeWriter.h:28
Definition: CutflowDetail.h:11
Class to write out objects from an RDFAnalysis.
Definition: OutputWriter.h:29
Class to represent a single step in the analysis process.
Definition: Node.h:32
Job scheduler.
Definition: Scheduler.h:25
void write(Scheduler< Detail > &scheduler)
Write information from the regions defined by a scheduler.
Definition: OutputWriter.h:58
void write(Node< Detail > &node)
Write information from the given node and all downstream.
Definition: OutputWriter.h:52
std::map< std::string, Region > & regions()
Get the string->region mapping.
Definition: Scheduler.h:63
const std::vector< std::shared_ptr< INodeWriter< Detail > > > & writers() const
Get the writers.
Definition: OutputWriter.h:95
Detail detail_t
The node detail type we're templated on.
Definition: OutputWriter.h:32
std::enable_if_t< std::is_base_of< INodeWriter< Detail >, T >{}, void > addWriter(T &&writer)
Add a writer.
Definition: OutputWriter.h:73
std::enable_if_t< std::is_base_of< INodeWriter< Detail >, T< Detail > >{}, void > addWriter(Args &&...args)
Add a writer.
Definition: OutputWriter.h:86
OutputWriter(const std::shared_ptr< TDirectory > &directory)
Create the writer.
std::vector< std::shared_ptr< INodeWriter< Detail > > > & writers()
Get the writers.
Definition: OutputWriter.h:91