FlightGear next
FGFunctionValue.h
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3 Header: FGFunctionValue.h
4 Author: Bertrand Coconnier
5 Date started: March 10 2018
6
7 --------- Copyright (C) 2018 B. Coconnier (bcoconni@users.sf.net) -----------
8
9 This program is free software; you can redistribute it and/or modify it under
10 the terms of the GNU Lesser General Public License as published by the Free
11 Software Foundation; either version 2 of the License, or (at your option) any
12 later version.
13
14 This program is distributed in the hope that it will be useful, but WITHOUT
15 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
16 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
17 details.
18
19 You should have received a copy of the GNU Lesser General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc., 59
21 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
23 Further information about the GNU Lesser General Public License can also be
24 found on the world wide web at http://www.gnu.org.
25
26 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
27 SENTRY
28 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
29
30#ifndef FGFUNCTIONVALUE_H
31#define FGFUNCTIONVALUE_H
32
33/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
34 INCLUDES
35 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
36
38
39/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
40 FORWARD DECLARATIONS
41 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
42
43namespace JSBSim {
44
45/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
46 CLASS DOCUMENTATION
47 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
48
52
53/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54 DECLARATION: FGFunctionValue
55 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
56
58{
59public:
60
62 :FGPropertyValue(propNode), function(f) {}
63 FGFunctionValue(std::string propName, FGPropertyManager* propertyManager,
65 :FGPropertyValue(propName, propertyManager), function(f) {}
66
67 double GetValue(void) const override { return function->GetValue(GetNode()); }
68
69 std::string GetName(void) const override {
70 return function->GetName() + "(" + FGPropertyValue::GetName() + ")";
71 }
72 std::string GetNameWithSign(void) const override {
73 return function->GetName() + "(" + FGPropertyValue::GetNameWithSign() + ")";
74 }
75 std::string GetPrintableName(void) const override {
76 return function->GetName() + "(" + FGPropertyValue::GetPrintableName() + ")";
77 }
78 std::string GetFullyQualifiedName(void) const override {
79 return function->GetName() + "(" + FGPropertyValue::GetFullyQualifiedName() + ")";
80 }
81
82private:
83 FGTemplateFunc_ptr function;
84};
85
86} // namespace JSBSim
87
88#endif
double GetValue(void) const override
FGFunctionValue(FGPropertyNode *propNode, FGTemplateFunc *f)
std::string GetFullyQualifiedName(void) const override
std::string GetName(void) const override
std::string GetPrintableName(void) const override
std::string GetNameWithSign(void) const override
FGFunctionValue(std::string propName, FGPropertyManager *propertyManager, FGTemplateFunc *f)
Class wrapper for property handling.
virtual std::string GetFullyQualifiedName(void) const
virtual std::string GetPrintableName(void) const
std::string GetName(void) const override
virtual std::string GetNameWithSign(void) const
FGPropertyNode * GetNode(void) const
FGPropertyValue(FGPropertyNode *propNode)
SGSharedPtr< FGTemplateFunc > FGTemplateFunc_ptr