Bayeux  3.4.1
Core Foundation library for SuperNEMO
utils.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2010-11-01
4  * Last modified: 2013-04-22
5  *
6  * License: GPL3
7  *
8  * Description:
9  * Utilities for BRIO classes
10  *
11  */
12 
13 #ifndef BRIO_UTILS_H
14 #define BRIO_UTILS_H 1
15 
16 // Standard Library:
17 #include <string>
18 #include <vector>
19 #include <map>
20 
21 // Third Party:
22 // - Boost:
23 #include <boost/cstdint.hpp>
24 
25 // This Project:
27 
28 // Forward class declaration
29 class TTree;
30 
31 namespace brio {
33  struct store_info
34  {
35  public:
36 
37  struct constants {
38  static const std::string & brio_file_extension();
39  static const std::string & trio_file_extension();
40  static const std::string & default_file_extension();
41  static const std::string & default_store_title();
42  static const std::string & automatic_store_label();
43  static const std::string & postponed_dedicated_serial_tag_label();
44  static const std::string & no_dedicated_serial_tag_label();
45  static size_t default_store_buffer_size();
46  static size_t default_stream_buffer_size();
47  };
48 
49  enum mode_type {
50  MODE_READ = 0x0,
51  MODE_WRITE = 0x1,
54  MODE_BRIO = 0x0,
55  MODE_TRIO = 0x2,
57  };
58 
59  static const int SUCCESS = 0;
60  static const int ERROR = 1;
61 
62  store_info();
63 
64  virtual ~store_info();
65 
66  const std::string& get_label() const;
67  const std::string& get_serialization_tag() const;
69  bool has_entries() const;
70  static int guess_mode_from_filename (const std::string & filename_, int & mode_);
71 
72  public:
73 
74  // make all attributes public:
75  std::string label;
76  std::string serialization_tag;
77  size_t bufsize;
78  TTree* tree;
81  std::vector<char> buffer;
83  int64_t current_entry;
84 
85  };
86 
87  typedef std::map<std::string, store_info> store_info_dict_type;
88 
89 } // end of namespace brio
90 
91 #endif // BRIO_UTILS_H
92 
93 // Local Variables: --
94 // mode: c++ --
95 // c-file-style: "gnu" --
96 // tab-width: 2 --
97 // End: --
const std::string & get_serialization_tag() const
static const std::string & automatic_store_label()
std::vector< char > buffer
the input buffer (used only by the writer)
Definition: utils.h:81
static const int SUCCESS
Definition: utils.h:59
bool has_entries() const
A class that contains internal dynamic informations for a given store.
Definition: utils.h:33
static const std::string & default_store_title()
Definition: utils.h:51
TTree * tree
the embedded ROOT tree
Definition: utils.h:78
Definition: utils.h:56
static size_t default_store_buffer_size()
Definition: utils.h:54
int64_t current_entry
the current entry number in the store
Definition: utils.h:83
static const std::string & postponed_dedicated_serial_tag_label()
std::map< std::string, store_info > store_info_dict_type
Definition: utils.h:87
static const std::string & brio_file_extension()
std::string label
the label (name) of the store
Definition: utils.h:75
Definition: utils.h:52
int64_t number_of_entries
the number of entries in the store
Definition: utils.h:82
Definition: utils.h:50
Definition: utils.h:55
std::string serialization_tag
the serialization tag associated to the object stored in the store
Definition: utils.h:76
static size_t default_stream_buffer_size()
brio_record record
the current brio record to be (de)serialized
Definition: utils.h:79
Definition: utils.h:53
Definition: utils.h:37
static const std::string & trio_file_extension()
bool has_dedicated_serialization_tag() const
static const std::string & default_file_extension()
virtual ~store_info()
mode_type
Definition: utils.h:49
const std::string & get_label() const
brio_record * p_record
Definition: utils.h:80
static int guess_mode_from_filename(const std::string &filename_, int &mode_)
static const int ERROR
Definition: utils.h:60
static const std::string & no_dedicated_serial_tag_label()
Top-level namespace of the Bayeux/brio module library.
Definition: base_io.h:37
size_t bufsize
the size of the output buffer (used only by the writer)
Definition: utils.h:77
The internal ROOT I/O record class.
Definition: brio_record.h:43