Class podio::Writer
-
class Writer
Generic (type erased) writer class that can handle different I/O backends (almost) transparently.
Offers some more high level functionality compared to the lower level backend specific writers that this class wraps. In addition, it provides convenience methods to deal specifically with the “events” frame category.
Note
Since this simply wraps lower level writers, some of the limitations of the wrapped writers will still apply, e.g. if used for writing ROOT files frames of a given category will have to have the same contents.
Note
The recommended way to construct is to use the makeWriter() function since that handles the instantiation of the correct low level writers
Public Functions
-
template<typename T>
inline Writer(std::unique_ptr<T> writer) Create a Writer from a lower level writer.
- Template Parameters:
T – the type of the low level writer (will be deduced)
- Parameters:
writer – A low level writer that does the actual work
-
~Writer() = default
Destructor.
This also takes care of writing all the necessary metadata to read files back again.
-
inline void writeFrame(const podio::Frame &frame, const std::string &category)
Store the given frame with the given category.
This stores all available categories from the passed frame
- Parameters:
frame – The frame to write
category – The category name under which this frame should be stored
-
inline void writeFrame(const podio::Frame &frame, const std::string &category, const std::vector<std::string> &collections)
Store the given Frame with the given category.
This stores only the desired collections and not the complete frame.
- Parameters:
frame – The Frame to store
category – The category name under which this Frame should be stored
collections – The collection names that should be written
-
inline void writeEvent(const podio::Frame &frame)
Store the given frame under the “events” category.
This stores all available categories from the passed frame
- Parameters:
frame – The frame to write
-
inline void writeEvent(const podio::Frame &frame, const std::vector<std::string> &collections)
Store the given Frame under the “events” category.
This stores only the desired collections and not the complete frame.
- Parameters:
frame – The Frame to store
collections – The collection names that should be written
-
inline void finish()
Write the current file, including all the necessary metadata to read it again.
Note
The destructor will also call this, so letting a Writer go out of scope is also a viable way to write a readable file
-
template<typename T>