JSBSim Flight Dynamics Model  1.1.11 (13 Feb 2022)
An Open Source Flight Dynamics and Control Software Library in C++
FGPropertyValue.h
1 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 
3 Header: FGPropertyValue.h
4 Author: Jon Berndt
5 Date 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
28 SENTRY
29 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
30 
31 #ifndef FGPROPERTYVALUE_H
32 #define FGPROPERTYVALUE_H
33 
34 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 INCLUDES
36 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
37 
38 #include "FGParameter.h"
39 #include "input_output/FGPropertyManager.h"
40 
41 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
42 FORWARD DECLARATIONS
43 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
44 
45 namespace JSBSim {
46 
47 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
48 CLASS DOCUMENTATION
49 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
50 
55 /*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
56 DECLARATION: FGPropertyValue
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
58 
60 {
61 public:
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 
82 protected:
83  FGPropertyNode* GetNode(void) const;
84 
85 private:
86  FGPropertyManager* PropertyManager; // Property root used to do late binding.
87  mutable FGPropertyNode_ptr PropertyNode;
88  std::string PropertyName;
89  double Sign;
90 };
91 
92 typedef SGSharedPtr<FGPropertyValue> FGPropertyValue_ptr;
93 
94 } // namespace JSBSim
95 
96 #endif
JSBSim::FGPropertyNode
Class wrapper for property handling.
Definition: FGPropertyManager.h:70
JSBSim::FGParameter
Represents various types of parameters.
Definition: FGParameter.h:58
JSBSim::FGPropertyValue
Represents a property value which can use late binding.
Definition: FGPropertyValue.h:59
JSBSim::FGPropertyManager
Definition: FGPropertyManager.h:373