FlightGear next
JSBSim::FGPropertyManager Class Reference

#include <FGPropertyManager.h>

Public Member Functions

 FGPropertyManager (void)
 Default constructor.
 
 FGPropertyManager (FGPropertyNode *_root)
 Constructor.
 
virtual ~FGPropertyManager (void)
 Destructor.
 
FGPropertyNodeGetNode (void) const
 
FGPropertyNodeGetNode (const std::string &path, bool create=false)
 
FGPropertyNodeGetNode (const std::string &relpath, int index, bool create=false)
 
bool HasNode (const std::string &path) const
 
std::string mkPropertyName (std::string name, bool lowercase)
 Property-ify a name replaces spaces with '-' and, optionally, makes name all lower case.
 
void Untie (const std::string &name)
 Untie a property from an external data source.
 
void Untie (SGPropertyNode *property)
 Untie a property from an external data source.
 
void Unbind (void)
 Unbind all properties bound by this manager to an external data source.
 
template<typename T>
void Tie (const std::string &name, T *pointer)
 Tie a property to an external variable.
 
template<typename T>
void Tie (const std::string &name, T(*getter)(), void(*setter)(T)=nullptr)
 Tie a property to a pair of simple functions.
 
template<typename T>
void Tie (const std::string &name, int index, T(*getter)(int), void(*setter)(int, T)=nullptr)
 Tie a property to a pair of indexed functions.
 
template<class T, class V>
void Tie (const std::string &name, T *obj, V(T::*getter)() const, void(T::*setter)(V)=nullptr)
 Tie a property to a pair of object methods.
 
template<class T, class V>
void Tie (const std::string &name, T *obj, int index, V(T::*getter)(int) const, void(T::*setter)(int, V)=nullptr)
 Tie a property to a pair of indexed object methods.
 
template<class T>
simgear::PropertyObject< T > CreatePropertyObject (const std::string &path)
 

Detailed Description

Definition at line 354 of file FGPropertyManager.h.

Constructor & Destructor Documentation

◆ FGPropertyManager() [1/2]

JSBSim::FGPropertyManager::FGPropertyManager ( void )
inline

Default constructor.

Definition at line 358 of file FGPropertyManager.h.

◆ FGPropertyManager() [2/2]

JSBSim::FGPropertyManager::FGPropertyManager ( FGPropertyNode * _root)
inlineexplicit

Constructor.

Definition at line 361 of file FGPropertyManager.h.

◆ ~FGPropertyManager()

virtual JSBSim::FGPropertyManager::~FGPropertyManager ( void )
inlinevirtual

Destructor.

Definition at line 364 of file FGPropertyManager.h.

Member Function Documentation

◆ CreatePropertyObject()

template<class T>
simgear::PropertyObject< T > JSBSim::FGPropertyManager::CreatePropertyObject ( const std::string & path)
inline

Definition at line 603 of file FGPropertyManager.h.

◆ GetNode() [1/3]

FGPropertyNode * JSBSim::FGPropertyManager::GetNode ( const std::string & path,
bool create = false )
inline

Definition at line 367 of file FGPropertyManager.h.

◆ GetNode() [2/3]

FGPropertyNode * JSBSim::FGPropertyManager::GetNode ( const std::string & relpath,
int index,
bool create = false )
inline

Definition at line 371 of file FGPropertyManager.h.

◆ GetNode() [3/3]

FGPropertyNode * JSBSim::FGPropertyManager::GetNode ( void ) const
inline

Definition at line 366 of file FGPropertyManager.h.

◆ HasNode()

bool JSBSim::FGPropertyManager::HasNode ( const std::string & path) const
inline

Definition at line 375 of file FGPropertyManager.h.

◆ mkPropertyName()

string JSBSim::FGPropertyManager::mkPropertyName ( std::string name,
bool lowercase )

Property-ify a name replaces spaces with '-' and, optionally, makes name all lower case.

Parameters
namestring to change
lowercasetrue to change all upper case chars to lower NOTE: this function changes its argument and thus relies on pass by value

Definition at line 64 of file FGPropertyManager.cpp.

◆ Tie() [1/5]

template<typename T>
void JSBSim::FGPropertyManager::Tie ( const std::string & name,
int index,
T(* getter )(int),
void(* setter )(int, T) = nullptr )
inline

Tie a property to a pair of indexed functions.

Every time the property value is queried, the getter (if any) will be invoked with the index provided; every time the property value is modified, the setter (if any) will be invoked with the index provided. The getter can be 0 to make the property unreadable, and the setter can be 0 to make the property unmodifiable.

Parameters
nameThe property name to tie (full path).
indexThe integer argument to pass to the getter and setter functions.
getterThe getter function, or 0 if the value is unreadable.
setterThe setter function, or 0 if the value is unmodifiable.

Definition at line 503 of file FGPropertyManager.h.

◆ Tie() [2/5]

template<class T, class V>
void JSBSim::FGPropertyManager::Tie ( const std::string & name,
T * obj,
int index,
V(T::* getter )(int) const,
void(T::* setter )(int, V) = nullptr )
inline

Tie a property to a pair of indexed object methods.

Every time the property value is queried, the getter (if any) will be invoked with the index provided; every time the property value is modified, the setter (if any) will be invoked with the index provided. The getter can be 0 to make the property unreadable, and the setter can be 0 to make the property unmodifiable.

Parameters
nameThe property name to tie (full path).
objThe object whose methods should be invoked.
indexThe integer argument to pass to the getter and setter methods.
getterThe getter method, or 0 if the value is unreadable.
setterThe setter method, or 0 if the value is unmodifiable.

Definition at line 580 of file FGPropertyManager.h.

◆ Tie() [3/5]

template<class T, class V>
void JSBSim::FGPropertyManager::Tie ( const std::string & name,
T * obj,
V(T::* getter )() const,
void(T::* setter )(V) = nullptr )
inline

Tie a property to a pair of object methods.

Every time the property value is queried, the getter (if any) will be invoked; every time the property value is modified, the setter (if any) will be invoked. The getter can be 0 to make the property unreadable, and the setter can be 0 to make the property unmodifiable.

Parameters
nameThe property name to tie (full path).
objThe object whose methods should be invoked.
getterThe object's getter method, or 0 if the value is unreadable.
setterThe object's setter method, or 0 if the value is unmodifiable.

Definition at line 542 of file FGPropertyManager.h.

◆ Tie() [4/5]

template<typename T>
void JSBSim::FGPropertyManager::Tie ( const std::string & name,
T * pointer )
inline

Tie a property to an external variable.

The property's value will automatically mirror the variable's value, and vice-versa, until the property is untied.

Parameters
nameThe property name to tie (full path).
pointerA pointer to the variable.

Definition at line 435 of file FGPropertyManager.h.

◆ Tie() [5/5]

template<typename T>
void JSBSim::FGPropertyManager::Tie ( const std::string & name,
T(* getter )(),
void(* setter )(T) = nullptr )
inline

Tie a property to a pair of simple functions.

Every time the property value is queried, the getter (if any) will be invoked; every time the property value is modified, the setter (if any) will be invoked. The getter can be 0 to make the property unreadable, and the setter can be 0 to make the property unmodifiable.

Parameters
nameThe property name to tie (full path).
getterThe getter function, or 0 if the value is unreadable.
setterThe setter function, or 0 if the value is unmodifiable.

Definition at line 467 of file FGPropertyManager.h.

◆ Unbind()

void JSBSim::FGPropertyManager::Unbind ( void )

Unbind all properties bound by this manager to an external data source.

Classes should use this function to release control of any properties they have bound using this property manager.

Definition at line 54 of file FGPropertyManager.cpp.

◆ Untie() [1/2]

void JSBSim::FGPropertyManager::Untie ( const std::string & name)

Untie a property from an external data source.

Classes should use this function to release control of any properties they are managing.

Parameters
nameThe property name to untie (full path).

◆ Untie() [2/2]

void JSBSim::FGPropertyManager::Untie ( SGPropertyNode * property)

Untie a property from an external data source.

Classes should use this function to release control of any properties they are managing.

Parameters
propertyA pointer to the property to untie.

Definition at line 311 of file FGPropertyManager.cpp.


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