FlightGear next
FGPropertyValue.h
Go to the documentation of this file.
1/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2
3Header: FGPropertyValue.h
4Author: Jon Berndt
5Date started: December 10 2004
6
7 ------------- Copyright (C) 2001 Jon S. Berndt (jon@jsbsim.org) -------------
8 ------ Copyright (C) 2010 - 2011 Anders Gidenstam (anders(at)gidenstam.org) -
9
10 This program is free software; you can redistribute it and/or modify it under
11 the terms of the GNU Lesser General Public License as published by the Free
12 Software Foundation; either version 2 of the License, or (at your option) any
13 later version.
14
15 This program is distributed in the hope that it will be useful, but WITHOUT
16 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
18 details.
19
20 You should have received a copy of the GNU Lesser General Public License along
21 with this program; if not, write to the Free Software Foundation, Inc., 59
22 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
23
24 Further information about the GNU Lesser General Public License can also be
25 found on the world wide web at http://www.gnu.org.
26
27%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28SENTRY
29%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
30
31#ifndef FGPROPERTYVALUE_H
32#define FGPROPERTYVALUE_H
33
34/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35INCLUDES
36%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37
38#include "FGParameter.h"
40
41/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42FORWARD DECLARATIONS
43%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
44
45namespace JSBSim {
46
47/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48CLASS DOCUMENTATION
49%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50
54
55/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56DECLARATION: FGPropertyValue
57%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58
60{
61public:
62
63 explicit FGPropertyValue(FGPropertyNode* propNode)
64 : PropertyManager(nullptr), PropertyNode(propNode), Sign(1.0) {}
65 FGPropertyValue(const std::string& propName,
66 FGPropertyManager* propertyManager);
67
68 double GetValue(void) const override;
69 bool IsConstant(void) const override {
70 return PropertyNode && (!PropertyNode->isTied()
71 && !PropertyNode->getAttribute(SGPropertyNode::WRITE));
72 }
73 void SetNode(FGPropertyNode* node) {PropertyNode = node;}
74 void SetValue(double value);
75 bool IsLateBound(void) const { return PropertyNode == nullptr; }
76
77 std::string GetName(void) const override;
78 virtual std::string GetNameWithSign(void) const;
79 virtual std::string GetFullyQualifiedName(void) const;
80 virtual std::string GetPrintableName(void) const;
81
82protected:
83 FGPropertyNode* GetNode(void) const;
84
85private:
86 FGPropertyManager* PropertyManager; // Property root used to do late binding.
87 mutable FGPropertyNode_ptr PropertyNode;
88 std::string PropertyName;
89 double Sign;
90};
91
92typedef SGSharedPtr<FGPropertyValue> FGPropertyValue_ptr;
93
94} // namespace JSBSim
95
96#endif
Represents various types of parameters.
Definition FGParameter.h:59
Class wrapper for property handling.
virtual std::string GetFullyQualifiedName(void) const
bool IsLateBound(void) const
double GetValue(void) const override
virtual std::string GetPrintableName(void) const
std::string GetName(void) const override
virtual std::string GetNameWithSign(void) const
FGPropertyNode * GetNode(void) const
void SetValue(double value)
bool IsConstant(void) const override
void SetNode(FGPropertyNode *node)
FGPropertyValue(FGPropertyNode *propNode)
SGSharedPtr< FGPropertyValue > FGPropertyValue_ptr
SGSharedPtr< FGPropertyNode > FGPropertyNode_ptr