Bayeux  3.4.1
Core Foundation library for SuperNEMO
dump_module.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2011-06-19
4  * Last modified : 2015-05-13
5  *
6  * Copyright (C) 2011-2015 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  * A dump data processing module.
26  *
27  */
28 
29 #ifndef DPP_DUMP_MODULE_H
30 #define DPP_DUMP_MODULE_H 1
31 
32 // Third party:
33 // - Boost:
34 #include <boost/scoped_ptr.hpp>
35 
36 // This project:
37 #include <dpp/base_module.h>
38 
39 namespace dpp {
40 
43  : public base_module
44  {
45  public:
46 
48  {
54  };
55 
56  public:
57 
59  void set_title(const std::string & title_);
60 
62  void set_indent(const std::string & indent_);
63 
64  // Set the output:
65  void set_output(const std::string & output_,
66  const std::string & file_ = "");
67 
70 
72  virtual ~dump_module();
73 
75  virtual void initialize(const ::datatools::properties & /* config_ */,
76  datatools::service_manager & /* service_mgr_ */,
77  dpp::module_handle_dict_type & /* modules_map_ */);
78 
80  virtual void reset();
81 
83  virtual process_status process(::datatools::things & /* data_ */);
84 
86  virtual void tree_dump (std::ostream & out_ = std::clog,
87  const std::string & title_ = "",
88  const std::string & indent_ = "",
89  bool inherit_ = false) const;
90 
91  protected:
92 
94  void _set_defaults ();
95 
97  std::ostream & _grab_output ();
98 
99  private:
100 
101  std::string _indent_;
102  std::string _title_;
103  int _output_;
104  std::string _output_filename_;
105  boost::scoped_ptr<std::ofstream > _fout_;
106  std::ostream * _out_; //<! Output stream handle
107 
108  // Macro to automate the registration of the module :
110 
111  };
112 
113 } // end of namespace dpp
114 
115 #endif // DPP_DUMP_MODULE_H
116 
117 // Local Variables: --
118 // mode: c++ --
119 // c-file-style: "gnu" --
120 // tab-width: 2 --
121 // End: --
A generic serializable and noncopyable container for arbitrary serializable objects.
Definition: things.h:85
A data processing module to dump data records.
Definition: dump_module.h:42
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
virtual process_status process(::datatools::things &)
Data record processing.
Definition: dump_module.h:49
Top-level namespace of the Bayeux/dpp module library.
Definition: base_module.h:56
Definition: dump_module.h:53
A fatal error. The application will most likely terminate. This is the highest priority.
Definition: logger.h:85
virtual ~dump_module()
Destructor.
process_status
Processing status flags used as the returned value of data processing methods through the pipeline.
Definition: base_module.h:65
void set_title(const std::string &title_)
Set the title:
std::ostream & _grab_output()
Get a reference to the output stream.
void set_output(const std::string &output_, const std::string &file_="")
virtual void reset()
Reset.
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
Definition: dump_module.h:51
Definition: dump_module.h:52
#define DPP_MODULE_REGISTRATION_INTERFACE(T)
Definition: base_module.h:231
output_type
Definition: dump_module.h:47
dump_module(datatools::logger::priority=datatools::logger::PRIO_FATAL)
Constructor.
void set_indent(const std::string &indent_)
Set the indenting string:
void _set_defaults()
Set default values before explicit settings and initialization.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print :
Definition: dump_module.h:50
Service management class.
Definition: service_manager.h:57
virtual void initialize(const ::datatools::properties &, datatools::service_manager &, dpp::module_handle_dict_type &)
Initialization.