Bayeux  3.4.1
Core Foundation library for SuperNEMO
simple_data_sink.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2011-06-07
4  * Last modified : 2013-02-16
5  *
6  * Copyright (C) 2011-2013 Francois Mauger <mauger@lpccaen.in2p3.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or (at
11  * your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  *
24  * Description:
25  *
26  * Generic data sink
27  *
28  */
29 
30 #ifndef DPP_SIMPLE_DATA_SINK_H
31 #define DPP_SIMPLE_DATA_SINK_H 1
32 
33 // Standard library:
34 #include <string>
35 
36 // Third party:
37 // - Bayeux/datatools:
38 #include <datatools/things.h>
39 
40 // This project:
41 #include <dpp/dpp_config.h>
42 #include <dpp/i_data_sink.h>
43 
44 // forward declaration:
45 namespace datatools {
46  class data_writer;
47 }
48 
49 namespace dpp {
50 
53  : public i_data_sink
54  {
55 
56  public:
57 
58  virtual void open();
59 
60  virtual bool store_next_record(const datatools::things & event_record_);
61 
62  virtual bool can_store_meta_data() const;
63 
64  virtual bool store_metadata(const datatools::properties & meta_data_);
65 
66  virtual void close();
67 
68  virtual void reset();
69 
72 
73 
75  simple_data_sink(const std::string & sink_label_ = "",
77 
79  virtual ~simple_data_sink();
80 
81  protected:
82 
83  void _open_file_sink();
84 
85  void _close_file_sink();
86 
87  private:
88 
89  unsigned int _record_counter_;
90  unsigned int _metadata_counter_;
91  datatools::data_writer * _boost_io_file_writer_ = nullptr;
92 
93  };
94 
95 } // end of namespace snemo
96 
97 #endif // DPP_SIMPLE_SIMPLE_DATA_SINK_H
98 
99 // Local Variables: --
100 // mode: c++ --
101 // c-file-style: "gnu" --
102 // tab-width: 2 --
103 // End: --
A notice, which is an information with just a higher priority.
Definition: logger.h:89
A generic serializable and noncopyable container for arbitrary serializable objects.
Definition: things.h:85
simple_data_sink(datatools::logger::priority priority_=datatools::logger::PRIO_NOTICE)
Constructor.
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
virtual ~simple_data_sink()
Destructor.
virtual bool store_next_record(const datatools::things &event_record_)
Top-level namespace of the Bayeux/dpp module library.
Definition: base_module.h:56
A Boost/Serialization-based I/O data sink/writer.
Definition: simple_data_sink.h:52
A generic data writer based on Boost/Serialization.
Definition: io_factory.h:740
header file
virtual void close()
Data sink/writer abstract interface.
Definition: i_data_sink.h:49
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
virtual void reset()
virtual bool can_store_meta_data() const
virtual bool store_metadata(const datatools::properties &meta_data_)
virtual void open()
A dictionary of arbitrary properties.
Definition: properties.h:125