JSBSim Flight Dynamics Model 1.3.0 (09 Apr 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
FGPropertyValue Class Reference

Detailed Description

Represents a property value which can use late binding.

Author
Jon Berndt, Anders Gidenstam

Definition at line 62 of file FGPropertyValue.h.

#include <FGPropertyValue.h>

+ Inheritance diagram for FGPropertyValue:
+ Collaboration diagram for FGPropertyValue:

Public Member Functions

 FGPropertyValue (const std::string &propName, std::shared_ptr< FGPropertyManager > propertyManager, Element *el)
 
 FGPropertyValue (SGPropertyNode *propNode)
 
virtual std::string GetFullyQualifiedName (void) const
 
std::string GetName (void) const override
 
virtual std::string GetNameWithSign (void) const
 
virtual std::string GetPrintableName (void) const
 
double GetValue (void) const override
 
bool IsConstant (void) const override
 
bool IsLateBound (void) const
 
void SetNode (SGPropertyNode *node)
 
void SetValue (double value)
 
- Public Member Functions inherited from FGParameter
double getDoubleValue (void) const
 

Protected Member Functions

SGPropertyNodeGetNode (void) const
 

Constructor & Destructor Documentation

◆ FGPropertyValue() [1/2]

FGPropertyValue ( SGPropertyNode propNode)
inlineexplicit

Definition at line 66 of file FGPropertyValue.h.

67 : PropertyManager(nullptr), PropertyNode(propNode), Sign(1.0) {}

◆ FGPropertyValue() [2/2]

FGPropertyValue ( const std::string &  propName,
std::shared_ptr< FGPropertyManager >  propertyManager,
Element el 
)

Definition at line 44 of file FGPropertyValue.cpp.

46 : PropertyManager(propertyManager), PropertyNode(nullptr), XML_def(el),
47 PropertyName(propName), Sign(1.0)
48{
49 if (PropertyName[0] == '-') {
50 PropertyName.erase(0,1);
51 Sign = -1.0;
52 }
53
54 if (PropertyManager->HasNode(PropertyName)) {
55 PropertyNode = PropertyManager->GetNode(PropertyName);
56
57 assert(PropertyNode);
58 XML_def = nullptr; // Now that the property is bound, we no longer need that.
59 }
60}

Member Function Documentation

◆ GetFullyQualifiedName()

std::string GetFullyQualifiedName ( void  ) const
virtual

Definition at line 129 of file FGPropertyValue.cpp.

130{
131 if (PropertyNode)
132 return JSBSim::GetFullyQualifiedName(PropertyNode);
133 else
134 return PropertyName;
135}

◆ GetName()

std::string GetName ( void  ) const
overridevirtual

Implements FGParameter.

Definition at line 106 of file FGPropertyValue.cpp.

107{
108 if (PropertyNode)
109 return PropertyNode->getNameString();
110 else
111 return PropertyName;
112}

◆ GetNameWithSign()

std::string GetNameWithSign ( void  ) const
virtual

Definition at line 116 of file FGPropertyValue.cpp.

117{
118 string name;
119
120 if (Sign < 0.0) name ="-";
121
122 name += GetName();
123
124 return name;
125}

◆ GetNode()

SGPropertyNode * GetNode ( void  ) const
protected

Definition at line 64 of file FGPropertyValue.cpp.

65{
66 if (PropertyNode) return PropertyNode;
67
68 // Manage late binding.
69 PropertyNode = PropertyManager->GetNode(PropertyName);
70 if (!PropertyNode) {
71 unique_ptr<LogException> err;
72 if (XML_def)
73 err.reset(new XMLLogException(XML_def));
74 else
75 err.reset(new LogException);
76
77 *err << "FGPropertyValue::GetValue() The property " << PropertyName
78 << " does not exist\n";
79 throw *err;
80 }
81
82 XML_def = nullptr; // Now that the property is bound, we no longer need that.
83
84 return PropertyNode;
85}

◆ GetPrintableName()

std::string GetPrintableName ( void  ) const
virtual

Definition at line 139 of file FGPropertyValue.cpp.

140{
141 if (PropertyNode)
142 return JSBSim::GetPrintableName(PropertyNode);
143 else
144 return PropertyName;
145}

◆ GetValue()

double GetValue ( void  ) const
overridevirtual

Implements FGParameter.

Definition at line 89 of file FGPropertyValue.cpp.

90{
91 return GetNode()->getDoubleValue()*Sign;
92}
double getDoubleValue() const
Get a double value for this node.

◆ IsConstant()

bool IsConstant ( void  ) const
inlineoverridevirtual

Reimplemented from FGParameter.

Definition at line 72 of file FGPropertyValue.h.

72 {
73 return PropertyNode && (!PropertyNode->isTied()
74 && !PropertyNode->getAttribute(SGPropertyNode::WRITE));
75 }

◆ IsLateBound()

bool IsLateBound ( void  ) const
inline

Definition at line 78 of file FGPropertyValue.h.

78{ return PropertyNode == nullptr; }

◆ SetNode()

void SetNode ( SGPropertyNode node)
inline

Definition at line 76 of file FGPropertyValue.h.

76{PropertyNode = node;}

◆ SetValue()

void SetValue ( double  value)

Definition at line 96 of file FGPropertyValue.cpp.

97{
98 // SetValue() ignores the Sign flag. So make sure it is never called with a
99 // negative sign.
100 assert(Sign == 1);
101 GetNode()->setDoubleValue(value);
102}
bool setDoubleValue(double value)
Set a double value for this node.

The documentation for this class was generated from the following files: