Bayeux  3.4.1
Core Foundation library for SuperNEMO
electromagnetic_field_macros.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
2  * Creation date : 2012-04-24
3  * Last modified : 2013-02-24
4  *
5  * Copyright (C) 2012-2013 Francois Mauger <mauger@lpccaen.in2p3.fr>
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 3 of the License, or (at
10  * your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful, but
13  * WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  * General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program; if not, write to the Free Software
19  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
20  * Boston, MA 02110-1301, USA.
21  *
22  *
23  *
24  * Description:
25  *
26  * Macros to help build electromagnetic field classes.
27  *
28  * History:
29  *
30  */
31 
38 #ifndef EMFIELD_ELECTROMAGNETIC_FIELD_MACROS_H
39 #define EMFIELD_ELECTROMAGNETIC_FIELD_MACROS_H 1
40 
41 // Ourselves:
43 
44 /* #define EMFIELD_CLASS_DECLARE(T) \ */
45 /* class T : public ::emfield::base_electromagnetic_field \ */
46 
47 
48 /* #define EMFIELD_INITIALIZE_DECLARE() \ */
49 /* public: \ */
50 /* virtual void initialize (const ::datatools::properties &, \ */
51 /* ::datatools::service_manager &, \ */
52 /* ::emfield::base_electromagnetic_field::field_dict_type &); \ */
53 
54 
55 /* #define EMFIELD_INITIALIZE_IMPLEMENT_HEAD(T,CONF,SERVICE_MANAGER,DICT) \ */
56 /* void T::initialize (const ::datatools::properties & CONF, \ */
57 /* ::datatools::service_manager & SERVICE_MANAGER, \ */
58 /* ::emfield::base_electromagnetic_field::field_dict_type & DICT) \ */
59 
60 
61 /* #define EMFIELD_RESET_DECLARE() \ */
62 /* public: \ */
63 /* virtual void reset (); \ */
64 
65 
66 /* #define EMFIELD_RESET_IMPLEMENT_HEAD(T) \ */
67 /* void T::reset () \ */
68 
69 
70 /* #define EMFIELD_COMPUTE_EFIELD_DECLARE() \ */
71 /* public : \ */
72 /* virtual int compute_electric_field (const ::geomtools::vector_3d & position_, \ */
73 /* double time_, \ */
74 /* ::geomtools::vector_3d & electric_field_) const; \ */
75 
76 
77 /* #define EMFIELD_COMPUTE_BFIELD_DECLARE() \ */
78 /* public : \ */
79 /* virtual int compute_magnetic_field (const ::geomtools::vector_3d & position_, \ */
80 /* double time_, \ */
81 /* geomtools::vector_3d & magnetic_field_) const; \ */
82 
83 
84 /* #define EMFIELD_COMPUTE_EBFIELD_DECLARE() \ */
85 /* public : \ */
86 /* virtual int compute_electromagnetic_field (const ::geomtools::vector_3d & position_, \ */
87 /* double time_, \ */
88 /* ::geomtools::vector_3d & electric_field_, \ */
89 /* ::geomtools::vector_3d & magnetic_field_) const; \ */
90 
91 
92 /* #define EMFIELD_COMPUTE_EFIELD_IMPLEMENT_HEAD(T,Position,Time,EField) \ */
93 /* int T::compute_electric_field (const ::geomtools::vector_3d & Position, \ */
94 /* double Time, \ */
95 /* ::geomtools::vector_3d & EField) const \ */
96 
97 
98 /* #define EMFIELD_COMPUTE_BFIELD_IMPLEMENT_HEAD(T,Position,Time,BField) \ */
99 /* int T::compute_magnetic_field (const ::geomtools::vector_3d & Position, \ */
100 /* double Time, \ */
101 /* ::geomtools::vector_3d & BField) const \ */
102 
103 
104 /* #define EMFIELD_COMPUTE_EBFIELD_IMPLEMENT_HEAD(T,Position,Time,EField,BField) \ */
105 /* int T::compute_electromagnetic_field (const ::geomtools::vector_3d & Position, \ */
106 /* double Time, \ */
107 /* ::geomtools::vector_3d & EField, \ */
108 /* ::geomtools::vector_3d & BField) const \ */
109 
110 
111 /* #define EMFIELD_CONSTRUCTOR_DECLARE(T) \ */
112 /* public: \ */
113 /* T (uint32_t = 0); \ */
114 
115 
116 /* #define EMFIELD_CONSTRUCTOR_IMPLEMENT_HEAD(T,Flags) \ */
117 /* T::T (uint32_t Flags) \ */
118 /* : ::emfield::base_electromagnetic_field (Flags) \ */
119 
120 
121 /* #define EMFIELD_DESTRUCTOR_DECLARE(T) \ */
122 /* public: \ */
123 /* virtual ~T (); \ */
124 
125 
126 /* #define EMFIELD_DESTRUCTOR_IMPLEMENT_HEAD(T) \ */
127 /* T::~T () \ */
128 
129 
130 /* #define EMFIELD_DEFAULT_DESTRUCTOR_IMPLEMENT(T) \ */
131 /* EMFIELD_DESTRUCTOR_IMPLEMENT_HEAD (T) \ */
132 /* { \ */
133 /* if (is_initialized()) reset(); \ */
134 /* return; \ */
135 /* } \ */
136 
137 
138 /* /// Macro for the declaration of the minimal interface */
139 /* #define EMFIELD_INTERFACE() \ */
140 /* EMFIELD_INITIALIZE_DECLARE() \ */
141 /* EMFIELD_RESET_DECLARE() \ */
142 /* EMFIELD_COMPUTE_EFIELD_DECLARE() \ */
143 /* EMFIELD_COMPUTE_BFIELD_DECLARE() \ */
144 
145 
146 /* /// Macro for the declaration of the minimal interface */
147 /* #define EMFIELD_INTERFACE_CTOR_DTOR(EMFIELD_CLASS_NAME) \ */
148 /* EMFIELD_CONSTRUCTOR_DECLARE(EMFIELD_CLASS_NAME) \ */
149 /* EMFIELD_DESTRUCTOR_DECLARE(EMFIELD_CLASS_NAME) \ */
150 /* EMFIELD_INTERFACE () \ */
151 
152 
153 /* Macros for interface/implementation of static creator methods in EM field classes */
154 
155 /* Registration */
156 
157 #define EMFIELD_REGISTRATION_INTERFACE(EMFIELD_CLASS_NAME) \
158  private: \
159  DATATOOLS_FACTORY_SYSTEM_AUTO_REGISTRATION_INTERFACE(::emfield::base_electromagnetic_field,EMFIELD_CLASS_NAME) \
160  public: \
161  virtual std::string get_class_id() const; \
162 
163 
164 #define EMFIELD_REGISTRATION_IMPLEMENT(EMFIELD_CLASS_NAME,EMFIELD_ID) \
165  DATATOOLS_FACTORY_SYSTEM_AUTO_REGISTRATION_IMPLEMENTATION(::emfield::base_electromagnetic_field,EMFIELD_CLASS_NAME,EMFIELD_ID) \
166  std::string EMFIELD_CLASS_NAME::get_class_id() const { \
167  return std::string(EMFIELD_ID); \
168  } \
169 
170 
171 #endif // EMFIELD_ELECTROMAGNETIC_FIELD_MACROS_H
172 
173 // Local Variables: --
174 // mode: c++ --
175 // c-file-style: "gnu" --
176 // tab-width: 2 --
177 // End: --