Skip to content

Rewritten Clipboard & FileReader/Writer Modules

Simon Spannagel requested to merge clipboard into master

This MR includes a complete rewrite of the Clipboard and the FileReader and FileWriter modules.


The new clipboard storage does not store data types as strings, i.e. no string comparison is necessary and the requirement to the rather ugly reinterpret_cast calls has been removed. The new interface is templated and allows to simply put and retrieve data like

// Store pixel data on the clipboard:
auto pixels = std::make_shared<PixelVector>();
clipboard->put(pixels, detector->name());

// Retrieve cluster data from the clipboard:
auto clusters = clipboard->get<Cluster>(detector->name());

which greatly improves usability and also allows for later changes such as the removal of raw pointers as internal storage.

FileReader & FileWriter

The rewrite of the clipboard but also the evolving framework itself made it necessary to revamp the reader and writer modules. The current modules for example cannot interpret, read or write Event objects on the clipboard - which has been an integral part of the framework for a while now.

The new modules are much more flexible in terms of what data they can store/read and they do not require cumbersome factory functions but rather use a creator map and a SFINAE trick to create objects of the desired type and to put them onto the clipboard.

The functionality has been tested using the TextWriter module by reading in raw data using event loader modules, storing the result with the FileWriter and TextWriter, reading it back in with the FileReader and storing it again with the TextWriter. The two resulting text files are equivalent.

Currently the test reading a simulation fails because the underlying file format is that of the old FileReader module.


This MR breaks backwards compatibility with any files written using the old FileWriter module. They cannot be read back into the system and maintaining compatibility would be a major undertaking. I would vote for breaking compatibility here, especially since we are still before an "officially released" version 1.0.

This closes !125 (closed)

Merge request reports