DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
StreamFactory.hpp
Go to the documentation of this file.
1/*
2 * StreamFactory.h
3 * ers
4 *
5 * Created by Matthias Wiesmann on 21.01.05.
6 * Modified by Serguei Kolos on 21.11.05.
7 * Copyright 2005 CERN. All rights reserved.
8 *
9 */
10
11#ifndef ERS_STREAM_FACTORY_H
12#define ERS_STREAM_FACTORY_H
13
14#include <ers/Severity.hpp>
15#include <ers/Context.hpp>
16#include <ers/Issue.hpp>
17
18#include <map>
19
27 InvalidFormat,
28 "Creator for the \"" << key << "\" stream is not found",
29 ((std::string)key ) )
30
31namespace ers
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}
85
86#endif
87
std::ostream & operator<<(std::ostream &stream, const OksSystem::File &file)
Definition File.cpp:852
#define ERS_DECLARE_ISSUE(namespace_name, class_name, message, attributes)
ERS Issue input stream interface.
ERS abstract output stream interface.
std::ostream & operator<<(std::ostream &, const ers::Configuration &)