Bayeux  3.4.1
Core Foundation library for SuperNEMO
simple_data_source.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 sequential data source reader.
27  *
28  */
29 
48 #ifndef DPP_SIMPLE_DATA_SOURCE_H
49 #define DPP_SIMPLE_DATA_SOURCE_H 1
50 
51 // Standard library:
52 #include <string>
53 
54 // Third party:
55 // - Bayeux/datatools:
56 #include <datatools/things.h>
57 
58 // This project:
59 #include <dpp/dpp_config.h>
60 #include <dpp/i_data_source.h>
61 
62 // forward declaration:
63 namespace datatools {
64  class data_reader;
65 }
66 
67 namespace dpp {
68 
71  : public i_data_source
72  {
73 
74  public:
75 
76  virtual void open();
77 
78  virtual bool has_next_record();
79 
80  virtual bool load_next_record(datatools::things & a_event_record_);
81 
82  virtual int64_t get_number_of_metadata() const;
83 
84  virtual bool load_metadata(datatools::properties & a_metadata_, int64_t a_entry_);
85 
86  virtual void close();
87 
88  virtual void reset();
89 
91 
92  simple_data_source(const std::string & a_source_label_,
94 
95  virtual ~simple_data_source();
96 
97  protected:
98 
99  virtual void _open_file_source();
100 
101  virtual void _close_file_source();
102 
103  virtual void _check_next_record();
104 
105  private:
106 
107  std::vector<datatools::properties> _metadata_col_;
108  datatools::data_reader * _boost_io_file_reader_;
109 
110  };
111 
112 } // end of namespace dpp
113 
114 #endif // DPP_SIMPLE_DATA_SOURCE_H
115 
116 // Local Variables: --
117 // mode: c++ --
118 // c-file-style: "gnu" --
119 // tab-width: 2 --
120 // 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
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
virtual bool load_next_record(datatools::things &a_event_record_)
simple_data_source(datatools::logger::priority a_priority_=datatools::logger::PRIO_NOTICE)
Top-level namespace of the Bayeux/dpp module library.
Definition: base_module.h:56
virtual void close()
virtual bool has_next_record()
A Boost/Serialization-based I/O data source/reader.
Definition: simple_data_source.h:70
virtual void _close_file_source()
virtual void reset()
virtual int64_t get_number_of_metadata() const
virtual void _check_next_record()
Data source/reader abstract interface.
Definition: i_data_source.h:50
virtual bool load_metadata(datatools::properties &a_metadata_, int64_t a_entry_)
header file
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
virtual void _open_file_source()
A generic data reader based on Boost/Serialization.
Definition: io_factory.h:523
A dictionary of arbitrary properties.
Definition: properties.h:125