Bayeux  3.4.1
Core Foundation library for SuperNEMO
i_data_sink.h
Go to the documentation of this file.
1 /* Author(s) : Xavier Garrido <garrido@lal.in2p3.fr>
3  * Creation date : 2011-08-05
4  * Last modified : 2013-02-15
5  *
6  * Copyright (C) 2011-2013 Xavier Garrido <garrido@lal.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  * Description:
24  *
25  * Abstract data sink reader class.
26  *
27  */
28 
29 #ifndef DPP_I_DATA_SINK_H
30 #define DPP_I_DATA_SINK_H 1
31 
32 // Standard library:
33 #include <ostream>
34 #include <string>
35 
36 // Third party:
37 // - Boost:
38 #include <boost/cstdint.hpp>
39 // - Bayeux/datatools:
40 #include <datatools/properties.h>
41 #include <datatools/things.h>
42 
43 // This project:
44 #include <dpp/dpp_config.h>
45 
46 namespace dpp {
47 
50  {
51  public:
52 
54  struct sink_record
55  {
56  static const int STATUS_CLOSED = 0;
57  static const int STATUS_OPENED = 1;
58  std::string label;
59  std::string effective_label;
60  int status;
61 
62  sink_record(const std::string & label_ = "");
63  void reset();
64  };
65 
68 
71 
72  void set_preserve_existing_sink(bool value_);
73 
74  bool is_preserve_existing_sink() const;
75 
76  virtual bool is_open() const;
77 
78  virtual bool is_sequential() const;
79 
80  virtual bool is_random() const;
81 
82  virtual void set(const std::string & sink_label_);
83 
84  virtual void open() = 0;
85 
86  virtual bool store_next_record(const datatools::things & event_record_) = 0;
87 
88  virtual bool can_store_meta_data() const = 0;
89 
90  virtual bool store_metadata(const datatools::properties & meta_data_) = 0;
91 
92  virtual void close() = 0;
93 
94  virtual void reset() = 0;
95 
97 
98  i_data_sink(const std::string & sink_label_,
100 
101  virtual ~i_data_sink();
102 
103  protected:
104 
106 
107  protected:
108 
112 
113  };
114 
115 } // end of namespace dpp
116 
117 #endif // DPP_I_DATA_SINK_H
118 
119 // Local Variables: --
120 // mode: c++ --
121 // c-file-style: "gnu" --
122 // tab-width: 2 --
123 // End: --
A generic serializable and noncopyable container for arbitrary serializable objects.
Definition: things.h:85
virtual bool can_store_meta_data() const =0
int status
Definition: i_data_sink.h:60
datatools::logger::priority _logging
The logging priority.
Definition: i_data_sink.h:109
virtual bool is_open() const
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
void set_logging_priority(datatools::logger::priority p_)
Set logging priority.
Top-level namespace of the Bayeux/dpp module library.
Definition: base_module.h:56
Internal class of the i_data_sink interface class.
Definition: i_data_sink.h:54
An error. An operation did not complete successfully, but the application as a whole is not affected.
Definition: logger.h:87
sink_record(const std::string &label_="")
std::string label
Definition: i_data_sink.h:58
virtual void close()=0
virtual void open()=0
void _set_defaults(datatools::logger::priority priority_)
datatools::logger::priority get_logging_priority() const
Returns logging priority.
virtual bool store_metadata(const datatools::properties &meta_data_)=0
static const int STATUS_CLOSED
Definition: i_data_sink.h:56
i_data_sink(datatools::logger::priority priority_=datatools::logger::PRIO_ERROR)
virtual bool is_sequential() const
static const int STATUS_OPENED
Definition: i_data_sink.h:57
std::string effective_label
Definition: i_data_sink.h:59
void set_preserve_existing_sink(bool value_)
virtual ~i_data_sink()
header file
Data sink/writer abstract interface.
Definition: i_data_sink.h:49
virtual void reset()=0
virtual bool is_random() const
bool is_preserve_existing_sink() const
sink_record _sink_record
Record dynamic informations about the data sink.
Definition: i_data_sink.h:111
virtual bool store_next_record(const datatools::things &event_record_)=0
virtual void set(const std::string &sink_label_)
bool _preserve_existing_sink
Preserve flag.
Definition: i_data_sink.h:110
A dictionary of arbitrary properties.
Definition: properties.h:125