Bayeux  3.4.1
Core Foundation library for SuperNEMO
module_tools.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-15
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  * Description:
24  *
25  * Typedefs for the event record processing module factory.
26  *
27  */
28 
29 #ifndef DPP_MODULE_TOOLS_H
30 #define DPP_MODULE_TOOLS_H 1
31 
32 // Standard library:
33 #include <iostream>
34 #include <string>
35 #include <map>
36 #include <exception>
37 
38 // Third party:
39 // - Boost:
40 #include <boost/scoped_ptr.hpp>
41 // - Bayeux/datatools:
42 #include <datatools/handle.h>
43 #include <datatools/bit_mask.h>
44 #include <datatools/properties.h>
45 
46 // This project:
47 #include <dpp/dpp_config.h>
48 
49 namespace dpp {
50 
51  class base_module;
52 
53  typedef std::map<std::string, base_module *> module_dict_type;
54 
56 
57  class module_manager;
58 
61  {
62  public:
63 
65  {
69  };
70 
71  public:
72 
74 
76 
78 
79  const std::string & get_module_name() const;
80 
81  void set_module_name(const std::string &);
82 
83  const std::string & get_module_id() const;
84 
85  void set_ptr(base_module *);
86 
87  void set_module_id(const std::string &);
88 
89  bool has_manager() const;
90 
92 
93  void set_blank();
94 
95  void set_created();
96 
97  void set_initialized();
98 
99  void set_uninitialized();
100 
101  bool is_created() const;
102 
103  bool is_initialized() const;
104 
107 
109  virtual ~module_entry_type();
110 
112  bool has_module() const;
113 
114  const base_module & get_module() const;
115 
117 
118  const module_handle_type & get_module_handle() const;
119 
121 
123 
124  virtual void tree_dump(std::ostream & out_ = std::clog,
125  const std::string & title_ = "",
126  const std::string & indent_ = "",
127  bool inherit_ = false) const;
128 
129  private:
130 
131  std::string _module_name_;
132  std::string _module_id_;
133  datatools::properties _module_config_;
134  uint32_t _module_status_;
135  module_handle_type _module_handle_;
136  module_manager * _manager_;
137 
138  friend class module_manager;
139  };
140 
141  typedef std::map<std::string, module_entry_type> module_handle_dict_type;
142 
143 } // end of namespace dpp
144 
145 #endif // DPP_MODULE_TOOLS_H
146 
147 // Local Variables: --
148 // mode: c++ --
149 // c-file-style: "gnu" --
150 // tab-width: 2 --
151 // End: --
virtual ~module_entry_type()
Destructor.
Definition: module_tools.h:67
void set_module_id(const std::string &)
Top-level namespace of the Bayeux/dpp module library.
Definition: base_module.h:56
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
static const uint32_t bit01
Definition: bit_mask.h:28
module_handle_type & grab_module_handle()
const module_handle_type & get_module_handle() const
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Main old interface method for printing.
Module record entry class.
Definition: module_tools.h:60
void set_manager(module_manager &)
module_entry_type()
Constructor.
void set_created()
datatools::handle< base_module > module_handle_type
Definition: module_tools.h:55
const base_module & get_module() const
const std::string & get_module_id() const
bool has_manager() const
const datatools::properties & get_module_config() const
Definition: module_tools.h:66
std::map< std::string, module_entry_type > module_handle_dict_type
Definition: module_tools.h:141
Base processing module (abstract interface)
Definition: base_module.h:59
std::map< std::string, base_module * > module_dict_type
Definition: module_tools.h:51
void set_uninitialized()
bool has_module() const
Check is the module is referenced in the embedded handle.
void set_initialized()
Definition: module_tools.h:68
void set_ptr(base_module *)
base_module & grab_module()
header file
bool is_initialized() const
datatools::properties & grab_module_config()
const std::string & get_module_name() const
static const uint32_t bit00
Definition: bit_mask.h:27
module_handle_type & grab_initialized_module_handle()
void set_blank()
A manager for data processing modules.
Definition: module_manager.h:49
void set_module_name(const std::string &)
status_type
Definition: module_tools.h:64
bool is_created() const
A dictionary of arbitrary properties.
Definition: properties.h:125
void set_module_config(const datatools::properties &)