Bayeux  3.4.1
Core Foundation library for SuperNEMO
cut_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-03-22
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 cut factory/manager.
26  *
27  * History:
28  *
29  */
30 
31 #ifndef CUTS_CUT_TOOLS_H
32 #define CUTS_CUT_TOOLS_H 1
33 
34 // Standard library:
35 #include <iostream>
36 #include <string>
37 #include <map>
38 #include <exception>
39 
40 // Third party:
41 // - Boost:
42 #include <boost/scoped_ptr.hpp>
43 // - Bayeux/datatools:
44 #include <datatools/handle.h>
45 #include <datatools/i_tree_dump.h>
46 #include <datatools/properties.h>
47 #include <datatools/bit_mask.h>
48 
49 namespace datatools {
50  // Forward declarations:
51  class properties;
52  class service_manager;
53 }
54 
55 namespace cuts {
56 
62  };
63 
64  // Forward declarations:
65  class i_cut;
66  class cut_manager;
67 
70 
76  {
77  public:
78 
80  enum status_type {
84  };
85 
87  const datatools::properties & get_cut_config() const;
88 
91 
94 
96  const std::string & get_cut_name() const;
97 
99  void set_cut_name(const std::string &);
100 
102  const std::string & get_cut_id() const;
103 
105  void set_ptr(i_cut *);
106 
108  void set_cut_id(const std::string &);
109 
111  bool has_manager() const;
112 
114  void set_manager(cut_manager &);
115 
117  void set_blank();
118 
120  void set_created();
121 
123  void set_initialized();
124 
126  void set_uninitialized();
127 
129  bool is_created() const;
130 
132  bool is_initialized() const;
133 
135  cut_entry_type();
136 
138  bool has_cut() const;
139 
141  const i_cut & get_cut() const;
142 
144  i_cut & grab_cut();
145 
147  const cut_handle_type & get_cut_handle() const;
148 
151 
154 
156  virtual void tree_dump(std::ostream & out_ = std::clog,
157  const std::string & title_ = "",
158  const std::string & indent_ = "",
159  bool inherit_ = false) const;
160 
161  private:
162 
163  std::string _cut_name_;
164  std::string _cut_id_;
165  datatools::properties _cut_config_;
166  uint32_t _cut_status_;
167  cut_handle_type _cut_handle_;
168  cut_manager * _manager_;
169 
170  friend class cut_manager;
171 
172  };
173 
175  typedef std::map<std::string, cut_entry_type> cut_handle_dict_type;
176 
178  typedef std::vector<std::string> ordered_cut_list_type;
179 
180 } // end of cuts
181 
182 #endif // CUTS_CUT_TOOLS_H
183 
184 /*
185 ** Local Variables: --
186 ** mode: c++ --
187 ** c-file-style: "gnu" --
188 ** tab-width: 2 --
189 ** End: --
190 */
void set_cut_config(const datatools::properties &)
Set the cut configuration.
void set_manager(cut_manager &)
Set the cut manager address.
const datatools::properties & get_cut_config() const
Return non mutable cut configuration.
void set_ptr(i_cut *)
Set the address of the embedded.
status_type
Status of the cut entry.
Definition: cut_tools.h:80
bool has_cut() const
Check is the cut is referenced in the embedded handle.
const i_cut & get_cut() const
Return a non mutable reference to the cut.
cut_entry_type()
Constructor.
virtual void tree_dump(std::ostream &out_=std::clog, const std::string &title_="", const std::string &indent_="", bool inherit_=false) const
Smart print.
void set_initialized()
Set the 'initialization' flag.
Returned by the selection method when some criteria is passed.
Definition: cut_tools.h:61
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
The cut abstract base class (interface)
Definition: i_cut.h:62
static const uint32_t bit01
Definition: bit_mask.h:28
cut_handle_type & grab_cut_handle()
Return a mutable handle to the cut.
Returned by the selection method when applying some criteria makes no sense in the current context.
Definition: cut_tools.h:59
void set_created()
Set the 'creation' flag.
const std::string & get_cut_name() const
Return the cut name.
const std::string & get_cut_id() const
Return the cut class identifier.
Top-level namespace of the Bayeux/cuts module library.
Definition: accept_cut.h:21
cut_handle_type & grab_initialized_cut_handle()
Return a mutable handle to the initialized cut.
Definition: cut_tools.h:81
bool has_manager() const
Check the availability of a cut manager.
Returned by the selection method when some criteria is not passed.
Definition: cut_tools.h:60
Definition: cut_tools.h:83
void set_blank()
Set the blank flag.
The cut manager class.
Definition: cut_manager.h:59
datatools::handle< i_cut > cut_handle_type
Alias type for a cut handle.
Definition: cut_tools.h:66
const cut_handle_type & get_cut_handle() const
Return a non mutable handle to the cut.
void set_cut_name(const std::string &)
Set the cut name.
Definition: cut_tools.h:82
std::vector< std::string > ordered_cut_list_type
Alias type of an array of cut names.
Definition: cut_tools.h:178
Internal record that handles a dynamically allocated cut.
Definition: cut_tools.h:75
void set_cut_id(const std::string &)
Set the cut class identifier.
selection_result_type
Enumeration of cut selection return status.
Definition: cut_tools.h:58
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
bool is_initialized() const
Check the 'initialization' flag.
i_cut & grab_cut()
Return a mutable reference to the cut.
std::map< std::string, cut_entry_type > cut_handle_dict_type
Alias type of a dictionary of cut entry.
Definition: cut_tools.h:175
static const uint32_t bit00
Definition: bit_mask.h:27
void set_uninitialized()
Unset the 'initialization' flag.
bool is_created() const
Check the 'creation' flag.
datatools::properties & grab_cut_config()
Return mutable cut configuration.
A dictionary of arbitrary properties.
Definition: properties.h:125