JSBSim Flight Dynamics Model 1.2.3 (07 Jun 2025)
An Open Source Flight Dynamics and Control Software Library in C++
Loading...
Searching...
No Matches
SGRawValueMethods< C, T > Class Template Reference

Detailed Description

template<class C, class T>
class SGRawValueMethods< C, T >

A value managed through an object and access methods.

A read-only value will not have a setter; a write-only value will not have a getter.

Definition at line 582 of file props.hxx.

#include <props.hxx>

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

Public Types

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

Public Member Functions

 SGRawValueMethods (C &obj, getter_t getter=0, setter_t setter=0)
 
virtual SGRawclone () const
 
virtual T getValue () const
 Return the underlying value.
 
virtual bool setValue (T value)
 Assign a new underlying value.
 
- Public Member Functions inherited from SGRawValue< T >
 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< T >
static T 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 585 of file props.hxx.

◆ setter_t

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

Definition at line 586 of file props.hxx.

Constructor & Destructor Documentation

◆ SGRawValueMethods()

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

Definition at line 587 of file props.hxx.

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

◆ ~SGRawValueMethods()

template<class C , class T >
virtual ~SGRawValueMethods ( )
inlinevirtual

Definition at line 589 of file props.hxx.

589{}

Member Function Documentation

◆ clone()

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

Definition at line 598 of file props.hxx.

598 {
599 return new SGRawValueMethods(_obj, _getter, _setter);
600 }
A value managed through an object and access methods.
Definition props.hxx:583

◆ getValue()

template<class C , class T >
virtual T getValue ( ) const
inlinevirtual

Return the underlying value.

Returns
The actual value for the property.
See also
setValue

Implements SGRawValue< T >.

Definition at line 590 of file props.hxx.

590 {
591 if (_getter) { return (_obj.*_getter)(); }
592 else { return SGRawValue<T>::DefaultValue(); }
593 }
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 >
virtual bool setValue ( value)
inlinevirtual

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< T >.

Definition at line 594 of file props.hxx.

594 {
595 if (_setter) { (_obj.*_setter)(value); return true; }
596 else return false;
597 }

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