DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
StreamFactory.hpp File Reference
#include <ers/Severity.hpp>
#include <ers/Context.hpp>
#include <ers/Issue.hpp>
#include <map>
Include dependency graph for StreamFactory.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

 ERS_DECLARE_ISSUE (ers, InvalidFormat, "Creator for the \""<< key<< "\" stream is not found",((std::string) key)) namespace ers
 

Function Documentation

◆ ERS_DECLARE_ISSUE()

ERS_DECLARE_ISSUE ( ers ,
InvalidFormat ,
"Creator for the \""<< key<< "\" stream is not found" ,
((std::string) key)  )

The StreamFactory class is responsible for creating a new instance of a known stream implementation. This class uses singleton pattern. Users should not use this class directly but use the ERS_REGISTER_OUTPUT_STREAM macro instead.

Author
Serguei Kolos Factory for ERS stream implementations.
See also
ers::StreamManager

<return the singleton

<register a stream creator

<register a stream creator

<create new stream

<create new stream

<create new stream

<collection of factories to build input streams

<collection of factories to build output streams

Definition at line 26 of file StreamFactory.hpp.

32{
33 class InputStream;
34 class OutputStream;
35 template <class > class SingletonCreator;
36
46 class StreamFactory
47 {
48 friend std::ostream & operator<<( std::ostream &, const ers::StreamFactory & );
49 template <class > friend class SingletonCreator;
50
51 typedef ers::InputStream * (*InputStreamCreator) ( const std::initializer_list<std::string> & params );
52 typedef ers::OutputStream * (*OutputStreamCreator)( const std::string & format );
53
54 public:
55
56 static StreamFactory & instance();
58 void register_in_stream( const std::string & name,
59 InputStreamCreator callback );
61 void register_out_stream( const std::string & name,
62 OutputStreamCreator callback );
64 InputStream * create_in_stream( const std::string & stream,
65 const std::string & filter ) const;
67 InputStream * create_in_stream( const std::string & stream,
68 const std::initializer_list<std::string> & params ) const;
70 OutputStream * create_out_stream( const std::string & format ) const;
72 private:
73 StreamFactory( )
74 { ; }
75
76 typedef std::map<std::string, InputStreamCreator> InFunctionMap;
77 typedef std::map<std::string, OutputStreamCreator> OutFunctionMap;
78
79 InFunctionMap m_in_factories;
80 OutFunctionMap m_out_factories;
81 };
82
83 std::ostream & operator<<( std::ostream &, const ers::StreamFactory & );
84}
std::ostream & operator<<(std::ostream &stream, const OksSystem::File &file)
Definition File.cpp:852
ERS Issue input stream interface.
ERS abstract output stream interface.