Bayeux  3.4.1
Core Foundation library for SuperNEMO
chain_module.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  *
24  *
25  * Description:
26  *
27  * Chain processing module.
28  *
29  */
30 
31 #ifndef DPP_CHAIN_MODULE_H
32 #define DPP_CHAIN_MODULE_H 1
33 
34 // Standard library:
35 #include <string>
36 #include <list>
37 
38 // This project:
39 #include <dpp/base_module.h>
40 
41 namespace dpp {
42 
45  : public base_module
46  {
47  public:
48 
50  struct module_entry
51  {
52  std::string label;
54  };
55 
56  typedef std::list<module_entry> module_list_type;
57 
59  void add_module(const std::string & label_,
60  const module_handle_type & handle_module_);
61 
63  bool has_module(const std::string & label_) const;
64 
67 
69  virtual ~chain_module();
70 
72  virtual void initialize(const ::datatools::properties & /* config_ */,
73  datatools::service_manager & /* service_mgr_ */,
74  dpp::module_handle_dict_type & /* modules_map_ */);
75 
77  virtual void reset();
78 
80  virtual process_status process(::datatools::things & /* data_ */);
81 
83  virtual void tree_dump(std::ostream & out_ = std::clog,
84  const std::string & title_ = "",
85  const std::string & indent_ = "",
86  bool inherit_ = false) const;
87 
88  protected:
89 
91 
92  // Macro to automate the registration of the module :
94 
95  };
96 
97 } // end of namespace dpp
98 
99 #endif // DPP_CHAIN_MODULE_H
100 
101 // Local Variables: --
102 // mode: c++ --
103 // c-file-style: "gnu" --
104 // tab-width: 2 --
105 // End: --
A generic serializable and noncopyable container for arbitrary serializable objects.
Definition: things.h:85
chain_module(datatools::logger::priority=datatools::logger::PRIO_FATAL)
Constructor.
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
A fatal error. The application will most likely terminate. This is the highest priority.
Definition: logger.h:85
module_list_type _modules_
The list of data processing modules.
Definition: chain_module.h:90
process_status
Processing status flags used as the returned value of data processing methods through the pipeline.
Definition: base_module.h:65
std::string label
Label of the module.
Definition: chain_module.h:52
bool has_module(const std::string &label_) const
Check if a module with a given name exists.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
module_handle_type handle
Handle of the module.
Definition: chain_module.h:53
virtual void initialize(const ::datatools::properties &, datatools::service_manager &, dpp::module_handle_dict_type &)
Initialization.
void add_module(const std::string &label_, const module_handle_type &handle_module_)
Add a module in the processing chain.
virtual process_status process(::datatools::things &)
Data record processing.
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
virtual void reset()
Reset.
#define DPP_MODULE_REGISTRATION_INTERFACE(T)
Definition: base_module.h:231
virtual ~chain_module()
Destructor.
A data processing module to chain children data processing modules.
Definition: chain_module.h:44
Record for a module using a specific label.
Definition: chain_module.h:50
Service management class.
Definition: service_manager.h:57
std::list< module_entry > module_list_type
Definition: chain_module.h:56