]> git.mxchange.org Git - flightgear.git/blob - src/FDM/JSBSim/math/FGFunction.h
3c4fddf73ac1ea5df084425f35dec0788b69dba1
[flightgear.git] / src / FDM / JSBSim / math / FGFunction.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGFunction.h
4 Author: Jon Berndt
5 Date started: August 25 2004
6
7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8 SENTRY
9 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
10
11 #ifndef FGFUNCTION_H
12 #define FGFUNCTION_H
13
14 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
15 INCLUDES
16 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
17
18 #include <vector>
19 #include <string>
20 #include "FGParameter.h"
21 #include <input_output/FGXMLElement.h>
22 #include <input_output/FGPropertyManager.h>
23
24 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
25 DEFINITIONS
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
27
28 #define ID_FUNCTION "$Id$"
29
30 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
31 FORWARD DECLARATIONS
32 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
33
34 namespace JSBSim {
35
36 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
37 CLASS DOCUMENTATION
38 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
39
40   /** Represents various types of parameters.
41       @author Jon Berndt
42   */
43
44 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
45 DECLARATION: FGFunction
46 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
47
48 class FGFunction : public FGParameter
49 {
50 public:
51
52   FGFunction(FGPropertyManager* propMan, Element* el, string prefix="");
53   ~FGFunction();
54
55   double GetValue(void) const;
56   string GetValueAsString(void) const;
57   string GetName(void) const {return Name;}
58   void cacheValue(bool);
59
60 private:
61   vector <FGParameter*> Parameters;
62   FGPropertyManager* const PropertyManager;
63   bool cached;
64   string Prefix;
65   double cachedValue;
66   enum functionType {eTopLevel=0, eProduct, eDifference, eSum, eQuotient, ePow,
67                      eAbs, eSin, eCos, eTan, eASin, eACos, eATan, eATan2} Type;
68   string Name;
69   void bind(void);
70   void Debug(int from);
71 };
72
73 } // namespace JSBSim
74
75 #endif