All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FragmentDumper.h
Go to the documentation of this file.
1 /**
2  * @file icaruscode/Decode/DecoderTools/Dumpers/FragmentDumper.h
3  * @brief Utility to dump a artDAQ fragment on screen.
4  * @date April 5, 2021
5  * @author Gianluca Petrillo (petrillo@slac.stanford.edu)
6  * @see icaruscode/Decode/DecoderTools/Dumpers/FragmentDumper.cxx
7  *
8  */
9 
10 #ifndef ICARUSCODE_DECODE_DECODERTOOLS_DUMPERS_FRAGMENTDUMPER_H
11 #define ICARUSCODE_DECODE_DECODERTOOLS_DUMPERS_FRAGMENTDUMPER_H
12 
13 
14 // framework libraries
15 #include "artdaq-core/Data/Fragment.hh"
16 
17 // C/C++ standard libraries
18 #include <iosfwd>
19 
20 
21 // -----------------------------------------------------------------------------
22 namespace sbndaq::details {
23 
24  struct DumpFragWrap { artdaq::Fragment const& frag; };
25 
26  std::ostream& operator<< (std::ostream& out, DumpFragWrap const& wrap);
27 
28 } // namespace sbndaq::details
29 // -----------------------------------------------------------------------------
30 
31 
32 namespace sbndaq {
33 
34  // ---------------------------------------------------------------------------
35  /**
36  * @brief Dump a artDAQ fragment into an output stream.
37  * @param frag fragment to be dumped
38  * @return an object that can be inserted in an output stream
39  *
40  * This function allows to dump a artDAQ fragment.
41  * The actual dump is performed by
42  * `sbndaq::details::dumpFragment(details::DumpFragWrap)`.
43  *
44  * Example of usage:
45  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~{.cpp}
46  * artdaq::Fragment const frag;
47  * // ... initialized somehow ...
48  * mf::LogTrace("DecoderTool") << sbndaq::dumpFragment(frag);
49  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50  *
51  * This is actually a helper function that just passes the task.
52  */
53  details::DumpFragWrap dumpFragment(artdaq::Fragment const& frag);
54 
55 
56  // ---------------------------------------------------------------------------
57 
58 } // namespace sbndaq
59 
60 
61 #endif // ICARUSCODE_DECODE_DECODERTOOLS_DUMPERS_FRAGMENTDUMPER_H
std::ostream & operator<<(std::ostream &out, DumpFragWrap const &wrap)
artdaq::Fragment const & frag
details::DumpFragWrap dumpFragment(artdaq::Fragment const &frag)
Dump a artDAQ fragment into an output stream.