56 for(
auto& prop: tied_properties)
59 tied_properties.clear();
70 if( lowercase && isupper(
name[
i]) )
72 else if( isspace(
name[
i]) )
84 SGPropertyNode* node = getNode(path.c_str(), create);
86 cerr <<
"FGPropertyManager::GetNode() No node found for " << path << endl;
88 return (FGPropertyNode*)node;
96 SGPropertyNode* node = getNode(relpath.c_str(), index, create);
98 cerr <<
"FGPropertyManager::GetNode() No node found for " << relpath
99 <<
"[" << index <<
"]" << endl;
101 return (FGPropertyNode*)node;
108 const SGPropertyNode* node = getNode(path.c_str(),
false);
116 string temp_string(getNameString());
117 size_t initial_location=0;
118 size_t found_location;
120 found_location = temp_string.rfind(
"/");
121 if (found_location != string::npos)
122 temp_string = temp_string.substr(found_location);
124 found_location = temp_string.find(
'_',initial_location);
125 while (found_location != string::npos) {
126 temp_string.replace(found_location,1,
" ");
127 initial_location = found_location+1;
128 found_location = temp_string.find(
'_',initial_location);
137 vector<string> stack;
138 stack.push_back( getDisplayName(
true) );
139 const SGPropertyNode* tmpn=getParent();
142 stack.push_back( tmpn->getDisplayName(
true) );
143 if( !tmpn->getParent() )
146 tmpn=tmpn->getParent();
150 for(
size_t i=stack.size()-1;
i>0;
i--) {
164 size_t len = path.length();
165 if ( (len > 0) && (temp_string.substr(0,len) == path) ) {
166 temp_string = temp_string.erase(0,len);
177 return getBoolValue(
name.c_str(), defaultValue);
184 return getIntValue(
name.c_str(), defaultValue);
191 return getLongValue(
name.c_str(), defaultValue);
198 return getFloatValue(
name.c_str(), defaultValue);
205 return getDoubleValue(
name.c_str(), defaultValue);
212 return string(getStringValue(
name.c_str(), defaultValue.c_str()));
219 return setBoolValue(
name.c_str(), val);
226 return setIntValue(
name.c_str(), val);
233 return setLongValue(
name.c_str(), val);
240 return setFloatValue(
name.c_str(), val);
247 return setDoubleValue(
name.c_str(), val);
254 return setStringValue(
name.c_str(), val.c_str());
261 SGPropertyNode * node = getNode(
name.c_str());
264 "Attempt to set archive flag for non-existent property "
267 node->setAttribute(SGPropertyNode::ARCHIVE, state);
274 SGPropertyNode * node = getNode(
name.c_str());
277 "Attempt to set read flag for non-existant property "
280 node->setAttribute(SGPropertyNode::READ, state);
287 SGPropertyNode * node = getNode(
name.c_str());
290 "Attempt to set write flag for non-existant property "
293 node->setAttribute(SGPropertyNode::WRITE, state);
300 SGPropertyNode*
property = root->getNode(
name.c_str());
302 cerr <<
"Attempt to untie a non-existant property." <<
name << endl;
313 const string&
name =
property->getNameString();
315 assert(property->isTied());
317 for (
auto it = tied_properties.begin(); it != tied_properties.end(); ++it) {
318 if (*it == property) {
320 tied_properties.erase(it);
326 cerr <<
"Failed to untie property " <<
name << endl
327 <<
"JSBSim is not the owner of this property." << endl;
void Untie(const std::string &name)
Untie a property from an external data source.
std::string mkPropertyName(std::string name, bool lowercase)
Property-ify a name replaces spaces with '-' and, optionally, makes name all lower case.
void Unbind(void)
Unbind all properties bound by this manager to an external data source.
Class wrapper for property handling.
bool SetLong(const std::string &name, long val)
Set a long value for a property.
std::string GetFullyQualifiedName(void) const
Get the fully qualified name of a node This function is very slow, so is probably useful for debuggin...
void SetWritable(const std::string &name, bool state=true)
Set the state of the write attribute for a property.
bool SetBool(const std::string &name, bool val)
Set a bool value for a property.
int GetLong(const std::string &name, long defaultValue=0L) const
Get a long value for a property.
bool HasNode(const std::string &path)
Test whether a given node exists.
bool SetFloat(const std::string &name, float val)
Set a float value for a property.
bool SetInt(const std::string &name, int val)
Set an int value for a property.
float GetFloat(const std::string &name, float defaultValue=0.0) const
Get a float value for a property.
void SetArchivable(const std::string &name, bool state=true)
Set the state of the archive attribute for a property.
int GetInt(const std::string &name, int defaultValue=0) const
Get an int value for a property.
std::string GetString(const std::string &name, std::string defaultValue="") const
Get a string value for a property.
bool GetBool(const std::string &name, bool defaultValue=false) const
Get a bool value for a property.
FGPropertyNode * GetNode(const std::string &path, bool create=false)
Get a property node.
std::string GetPrintableName(void) const
Get the name of a node without underscores, etc.
bool SetString(const std::string &name, const std::string &val)
Set a string value for a property.
std::string GetRelativeName(const std::string &path="/fdm/jsbsim/") const
Get the qualified name of a node relative to given base path, otherwise the fully qualified name.
void SetReadable(const std::string &name, bool state=true)
Set the state of the read attribute for a property.
bool SetDouble(const std::string &name, double val)
Set a double value for a property.
double GetDouble(const std::string &name, double defaultValue=0.0) const
Get a double value for a property.