JSBSim Flight Dynamics Model 1.2.4 (07 Feb 2026)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
SGRawValueMethodsEnum< C, T > Class Template Reference

Detailed Description

template<class C, class T>
class SGRawValueMethodsEnum< C, T >

Definition at line 60 of file FGPropertyManager.h.

+ Inheritance diagram for SGRawValueMethodsEnum< C, T >:
+ Collaboration diagram for SGRawValueMethodsEnum< C, T >:

Public Types

typedef T(C::* getter_t) () const
 
typedef void(C::* setter_t) (T)
 

Public Member Functions

 SGRawValueMethodsEnum (C &obj, getter_t getter=nullptr, setter_t setter=nullptr)
 
SGRawclone () const override
 
int getValue () const override
 Return the underlying value.
 
bool setValue (int value) override
 Assign a new underlying value.
 
- Public Member Functions inherited from SGRawValue< int >
 SGRawValue ()
 Constructor.
 
virtual ~SGRawValue ()
 Destructor.
 
bool DefaultValue ()
 
const char * DefaultValue ()
 
virtual simgear::props::Type getType () const
 Return the type tag for this raw value type.
 

Additional Inherited Members

- Static Public Member Functions inherited from SGRawValue< int >
static int DefaultValue ()
 The default underlying value for this type.
 

Member Typedef Documentation

◆ getter_t

template<class C , class T >
typedef T(C::* getter_t) () const

Definition at line 63 of file FGPropertyManager.h.

◆ setter_t

template<class C , class T >
typedef void(C::* setter_t) (T)

Definition at line 64 of file FGPropertyManager.h.

Constructor & Destructor Documentation

◆ SGRawValueMethodsEnum()

template<class C , class T >
SGRawValueMethodsEnum ( C &  obj,
getter_t  getter = nullptr,
setter_t  setter = nullptr 
)
inline

Definition at line 65 of file FGPropertyManager.h.

67 : _obj(obj), _getter(getter), _setter(setter) {}

Member Function Documentation

◆ clone()

template<class C , class T >
SGRaw * clone ( ) const
inlineoverride

Definition at line 76 of file FGPropertyManager.h.

76 {
77 return new SGRawValueMethodsEnum(_obj, _getter, _setter);
78 }

◆ getValue()

template<class C , class T >
int getValue ( ) const
inlineoverridevirtual

Return the underlying value.

Returns
The actual value for the property.
See also
setValue

Implements SGRawValue< int >.

Definition at line 68 of file FGPropertyManager.h.

68 {
69 if (_getter) { return static_cast<int>((_obj.*_getter)()); }
70 else { return SGRawValue<int>::DefaultValue(); }
71 }
static T DefaultValue()
The default underlying value for this type.
Definition props.hxx:332
+ Here is the call graph for this function:

◆ setValue()

template<class C , class T >
bool setValue ( int  value)
inlineoverridevirtual

Assign a new underlying value.

If the new value cannot be set (because this is a read-only raw value, or because the new value is not acceptable for some reason) this method returns false and leaves the original value unchanged.

Parameters
valueThe actual value for the property.
Returns
true if the value was set successfully, false otherwise.
See also
getValue

Implements SGRawValue< int >.

Definition at line 72 of file FGPropertyManager.h.

72 {
73 if (_setter) { (_obj.*_setter)(static_cast<T>(value)); return true; }
74 else return false;
75 }

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