Bayeux  3.4.1
Core Foundation library for SuperNEMO
simple_brio_data_source.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-16
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  *
24  * Description:
25  *
26  * Generic sequential data source reader for BRIO input file.
27  *
28  * A special mode is available in order to read the output
29  * from the sng4_production program which does not use
30  * the 'things' (snemo::core::model::event_record) as
31  * the basis of the data model.
32  *
33  */
34 
35 #ifndef DPP_SIMPLE_BRIO_DATA_SOURCE_H
36 #define DPP_SIMPLE_BRIO_DATA_SOURCE_H 1
37 
38 // Standard library:
39 #include <string>
40 
41 // Third party:
42 // - Bayeux/datatools:
43 #include <datatools/things.h>
44 
45 // This project:
46 #include <dpp/i_data_source.h>
47 
48 // forward declaration:
50 namespace brio {
51  class reader;
52 }
53 
54 namespace dpp {
55 
58  : public i_data_source
59  {
60  public:
61 
62  virtual bool is_random() const;
63 
64  virtual void open();
65 
66  virtual bool has_next_record();
67 
68  virtual bool load_next_record(datatools::things & event_record_);
69 
70  virtual int64_t get_number_of_metadata() const;
71 
72  virtual bool load_metadata(datatools::properties & metadata_, int64_t entry_);
73 
74  virtual void close();
75 
76  virtual void reset();
77 
79 
80  simple_brio_data_source(const std::string & source_label_,
82 
83  virtual ~simple_brio_data_source();
84 
85  protected:
86 
87  virtual void _open_file_source();
88 
89  virtual void _close_file_source();
90 
91  virtual void _check_next_record();
92 
93  virtual int64_t _get_number_of_entries() const;
94 
95  virtual bool _load_record(datatools::things & event_record_, int64_t entry_);
96 
97  private:
98 
99  brio::reader * _brio_file_reader_ = nullptr;
100 
101  };
102 
103 } // end of namespace dpp
104 
105 #endif // DPP_SIMPLE_BRIO_DATA_SOURCE_H
106 
107 // Local Variables: --
108 // mode: c++ --
109 // c-file-style: "gnu" --
110 // tab-width: 2 --
111 // End: --
The brio generic reader class.
Definition: reader.h:49
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
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
Top-level namespace of the Bayeux/dpp module library.
Definition: base_module.h:56
virtual bool has_next_record()
virtual int64_t _get_number_of_entries() const
simple_brio_data_source(datatools::logger::priority priority=datatools::logger::PRIO_NOTICE)
virtual bool is_random() const
virtual bool load_metadata(datatools::properties &metadata_, int64_t entry_)
virtual void _open_file_source()
Data source/reader abstract interface.
Definition: i_data_source.h:50
virtual bool load_next_record(datatools::things &event_record_)
A brio-based I/O data source/reader.
Definition: simple_brio_data_source.h:57
virtual bool _load_record(datatools::things &event_record_, int64_t entry_)
virtual void _check_next_record()
virtual void _close_file_source()
Top-level namespace of the Bayeux/brio module library.
Definition: base_io.h:37
virtual int64_t get_number_of_metadata() const
A dictionary of arbitrary properties.
Definition: properties.h:125