GeoModel - GeoModelCore
GeoXF.h
1 /*
2  Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3 */
4 
5 //------------------------GeoTransformFunction--------------------------//
6 // //
7 // GeoTransformFunction, base class for function objects which //
8 // evaluate to a HepTransform. //
9 // //
10 //----------------------------------------------------------------------//
11 #ifndef GEOMODELKERNEL_GEOTRANSFORMFUNCTION_H
12 #define GEOMODELKERNEL_GEOTRANSFORMFUNCTION_H
13 #include "GeoGenericFunctions/AbsFunction.h"
14 #include "GeoGenericFunctions/Argument.h"
15 #include "GeoModelKernel/GeoDefinitions.h"
16 //-----------------------------------------------------------------------//
17 // Exact return type of arithmentic operations. To the user, the return //
18 // type is TRANsFUNCTION, or const GeoXF::Function &. //
19 //-----------------------------------------------------------------------//
20 
21 namespace GeoXF
22 {
23 
24  class Product;
25  class PreMult;
26  class PostMult;
27  class Pow;
28 
29 
30  class Function
31  {
32 
33  public:
34 
35  // Default Constructor
36  Function ();
37 
38  // Destructor
39  virtual ~ Function ();
40 
41  // Function value: N-dimensional functions must override these:
42  virtual unsigned int dimensionality () const; //returns 1;
43 
44  // Function value
45  virtual GeoTrf::Transform3D operator () (double argument) const = 0;
46  virtual GeoTrf::Transform3D operator () (const GeoGenfun::
47  Argument & argument) const =
48  0;
49 
50  // Every function must override this:
51  virtual Function *clone () const = 0;
52 
53  // Copy constructor
54  Function (const Function & right);
55 
56  private:
57 
58  // Assignment operator
59  const Function & operator = (const Function & right);
60 
61  };
62 
63 
64 
65 
66 
67 
68  class Pow:public Function
69  {
70 
71  public:
72 
73  Pow (const GeoTrf::Transform3D &, GeoGenfun::GENFUNCTION f);
74 
75  virtual ~ Pow ();
76 
77  virtual GeoTrf::Transform3D operator () (double argument) const;
78  virtual GeoTrf::Transform3D operator () (const GeoGenfun::
79  Argument & argument) const;
80 
81  // Every function must override this:
82  Pow *clone () const;
83 
84  // Copy constructor:
85  Pow (const Pow & right);
86 
87  // For persistency:
88  const GeoTrf::Transform3D & transform() const {
89  return m_xf;
90  }
91 
92  // For persistency:
93  const GeoGenfun::AbsFunction *function() const {
94  return m_function;
95  }
96 
97  private:
98 
99  // Assignment operator
100  const Pow & operator = (const Pow & right);
101 
102  const GeoTrf::Transform3D m_xf;
103  const GeoGenfun::AbsFunction * m_function;
104 
105  };
106 
107 
108 
109 
110 
111  Product operator * (const Function & op1, const Function & op2);
112  PreMult operator * (const GeoTrf::Transform3D & xf, const Function & op2);
113  PostMult operator * (const Function & op2, const GeoTrf::Transform3D & xf);
114 
115 
116  // Internally used class:: Product:
117 
118  class Product:public Function
119  {
120 
121  public:
122 
123 
124  Product (const Function * arg1, const Function * arg2);
125 
126  virtual ~ Product ();
127 
128  virtual unsigned int dimensionality () const;
129 
130  virtual GeoTrf::Transform3D operator () (double argument) const;
131  virtual GeoTrf::Transform3D operator () (const GeoGenfun::
132  Argument & argument) const;
133 
134  // Every function must override this:
135  virtual Product *clone () const;
136 
137  // Copy constructor:
138  Product (const Product & right);
139 
140  Product& operator= (const Product & right) = delete;
141 
142  const Function *arg1() const { return m_arg1;}
143  const Function *arg2() const { return m_arg2;}
144 
145  private:
146 
147  const Function *m_arg1;
148  const Function *m_arg2;
149 
150  };
151 
152  // Internally used class:: PreMult :
153 
154  class PreMult:public Function
155  {
156 
157  public:
158 
159 
160  PreMult (const GeoTrf::Transform3D & arg1, const Function * arg2);
161 
162  virtual ~ PreMult ();
163 
164  virtual unsigned int dimensionality () const;
165 
166  virtual GeoTrf::Transform3D operator () (double argument) const;
167  virtual GeoTrf::Transform3D operator () (const GeoGenfun::
168  Argument & argument) const;
169 
170  // Every function must override this:
171  virtual PreMult *clone () const;
172 
173  // Copy constructor:
174  PreMult (const PreMult & right);
175 
176  PreMult& operator= (const PreMult & right) = delete;
177 
178  const GeoTrf::Transform3D & arg1() const { return m_arg1;}
179  const Function *arg2() const { return m_arg2;}
180 
181 
182  private:
183 
184  const GeoTrf::Transform3D m_arg1;
185  const Function *m_arg2;
186 
187  };
188 
189  // Internally used class:: PostMult :
190 
191  class PostMult:public Function
192  {
193 
194  public:
195 
196 
197  PostMult (const Function * arg1, const GeoTrf::Transform3D & arg2);
198 
199  virtual ~ PostMult ();
200 
201  virtual unsigned int dimensionality () const;
202 
203  virtual GeoTrf::Transform3D operator () (double argument) const;
204  virtual GeoTrf::Transform3D operator () (const GeoGenfun::
205  Argument & argument) const;
206 
207  // Every function must override this:
208  virtual PostMult *clone () const;
209 
210  // Copy constructor:
211  PostMult (const PostMult & right);
212 
213  PostMult& operator= (const PostMult & right) = delete;
214 
215  const Function *arg1() const { return m_arg1;}
216  const GeoTrf::Transform3D & arg2() const { return m_arg2;}
217 
218 
219  private:
220 
221  const Function *m_arg1;
222  const GeoTrf::Transform3D m_arg2;
223 
224  };
225 
226  typedef const Function & TRANSFUNCTION;
227 
228 
229 
230 }
231 
232 #endif
Definition: GeoXF.h:21
Definition: Abs.h:15