Bayeux  3.4.1
Core Foundation library for SuperNEMO
electromagnetic_field_manager.h
Go to the documentation of this file.
1 /* Author(s): Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date: 2012-04-24
4  * Last modified: 2013-06-19
5  *
6  * License:
7  *
8  * Description:
9  *
10  * Manager for a collection of electro-magnetic fields
11  *
12  * History:
13  *
14  */
15 
16 #ifndef EMFIELD_ELECTROMAGNETIC_FIELD_MANAGER_H
17 #define EMFIELD_ELECTROMAGNETIC_FIELD_MANAGER_H 1
18 
19 // Standard library:
20 #include <iostream>
21 #include <string>
22 
23 // Third party:
24 // - Boost:
25 #include <boost/cstdint.hpp>
26 #include <boost/scoped_ptr.hpp>
27 // - Bayeux/datatools:
28 #include <datatools/i_tree_dump.h>
30 #include <datatools/bit_mask.h>
31 
32 // This project:
34 
35 namespace datatools {
36  class service_manager;
37 }
38 
39 namespace geomtools {
40  class manager;
41 }
42 
44 namespace emfield {
45 
46  class geom_map;
47 
50  {
51 
52  public:
53 
55  enum init_flags {
58  };
59 
61  typedef base_electromagnetic_field::factory_register_type emfield_factory_type;
62 
65 
68 
70  bool is_initialized() const;
71 
73  void set_factory_preload(bool);
74 
76  void set_factory_verbose(bool);
77 
79  bool has_service_manager() const;
80 
83 
85  void reset_service_manager();
86 
88  bool has_geometry_manager() const;
89 
92 
95 
97  bool has_geom_map() const;
98 
100  electromagnetic_field_manager(uint32_t flags_ = 0);
101 
104 
106  void initialize(const datatools::properties & setup_);
107 
109  void reset();
110 
112  void load(const std::string & field_definitions_filename_);
113 
115  virtual void tree_dump(std::ostream & out_ = std::clog,
116  const std::string & title_ = "",
117  const std::string & indent_ = "",
118  bool inherit_ = false) const;
119 
122 
124  bool has_field(const std::string & field_name_) const;
125 
127  base_electromagnetic_field & grab_field(const std::string & field_name_);
128 
130  const base_electromagnetic_field & get_field(const std::string & field_name_) const;
131 
133  const geom_map & get_geom_map() const;
134 
135  protected:
136 
138  void _set_defaults();
139 
141  void _set_initialized(bool initialized_);
142 
143  private:
144 
146  void _construct_();
147 
149  void _construct_geomap_(const datatools::properties & setup_);
150 
151  private:
152 
153  // Management:
154  bool _initialized_;
155 
156  // Parameters:
157  datatools::logger::priority _logging_priority_;
158  bool _factory_verbose_;
159  bool _factory_preload_;
160  bool _build_geom_map_;
161  datatools::multi_properties _field_definitions_;
162 
163  // Working data:
164  boost::scoped_ptr<emfield_factory_type> _factory_register_;
165  datatools::service_manager * _service_manager_;
166  const geomtools::manager * _geom_manager_;
168  boost::scoped_ptr<geom_map> _geom_map_;
169 
170  };
171 
172 } // end of namespace emfield
173 
175 
176 #endif // EMFIELD_ELECTROMAGNETIC_FIELD_MANAGER_H 1
177 
178 // Local Variables: --
179 // mode: c++ --
180 // c-file-style: "gnu" --
181 // tab-width: 2 --
182 // End: --
bool has_field(const std::string &field_name_) const
CHeck if a field exists, given its name.
init_flags
Initialization flag.
Definition: electromagnetic_field_manager.h:55
electromagnetic_field_manager(uint32_t flags_=0)
Default constructor.
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
A container of mapped properties objects.
Definition: multi_properties.h:99
void _set_defaults()
Set default attributes' values.
An interface with utilities for printable objects.
Definition: i_tree_dump.h:36
static const uint32_t bit01
Definition: bit_mask.h:28
bool is_initialized() const
Check initialization status.
virtual ~electromagnetic_field_manager()
Destructor.
Definition: electromagnetic_field_manager.h:56
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_logging_priority(datatools::logger::priority priority_)
Set the logging priority.
bool has_service_manager() const
Check if a service manager is referenced.
base_electromagnetic_field & grab_field(const std::string &field_name_)
Return a mutable reference to an existing field.
std::map< std::string, handle_type > field_dict_type
Definition: base_electromagnetic_field.h:49
void reset()
Reset the manager.
void load(const std::string &field_definitions_filename_)
Load the definitions of some EM fields from a file, given its name.
const geom_map & get_geom_map() const
Return the dictionary of geometry/EM-field associations.
datatools::logger::priority get_logging_priority() const
Return the logging priority.
Abstract base class for all electromagnetic field.
Definition: base_electromagnetic_field.h:43
void set_geometry_manager(const geomtools::manager &)
Set the reference to a geometry manager.
const base_electromagnetic_field & get_field(const std::string &field_name_) const
Return a const reference to an existing field.
void set_service_manager(datatools::service_manager &)
Set the reference to a service manager.
void reset_service_manager()
Reset the reference to a service manager.
void set_factory_preload(bool)
Set the factory preload flag.
bool has_geom_map() const
Check if a geometry/EM-fields association map is defined.
const base_electromagnetic_field::field_dict_type & get_fields() const
Return the dictionary of created fields.
Electromagnetic field manager.
Definition: electromagnetic_field_manager.h:49
void set_factory_verbose(bool)
Set the factory verbose flag.
Top-level namespace of the Bayeux/emfield module library.
Definition: base_electromagnetic_field.h:40
void initialize(const datatools::properties &setup_)
Initialize the manager.
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
Geometry manager for virtual geometry modelling. Main geometry manager for the modelisation of variou...
Definition: manager.h:70
Mapping of electromagnetic fields with geometry volume.
Definition: geom_map.h:47
const geomtools::manager & get_geometry_manager() const
Return a const reference to a geometry manager.
static const uint32_t bit00
Definition: bit_mask.h:27
Macros to automatically generate some parts of the electromagnetic fields interface.
Definition: electromagnetic_field_manager.h:57
void _set_initialized(bool initialized_)
Set the initialization flag.
Service management class.
Definition: service_manager.h:57
bool has_geometry_manager() const
Check if a geometry manager is referenced.
Top-level namespace of the Bayeux/geomtools module library.
Definition: electromagnetic_field_manager.h:39
A dictionary of arbitrary properties.
Definition: properties.h:125
base_electromagnetic_field::factory_register_type emfield_factory_type
Type alias for the factory.
Definition: electromagnetic_field_manager.h:61