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
SGRawValueFunctions< T > Class Template Reference

Detailed Description

template<class T>
class SGRawValueFunctions< T >

A value managed through static functions.

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

Definition at line 469 of file props.hxx.

#include <props.hxx>

+ Inheritance diagram for SGRawValueFunctions< T >:
+ Collaboration diagram for SGRawValueFunctions< T >:

Public Types

typedef T(* getter_t) ()
 The template type of a static getter function.
 
typedef void(* setter_t) (T)
 The template type of a static setter function.
 

Public Member Functions

 SGRawValueFunctions (getter_t getter=0, setter_t setter=0)
 Explicit constructor.
 
virtual ~SGRawValueFunctions ()
 Destructor.
 
virtual SGRawclone () const
 Create a copy of this raw value, bound to the same functions.
 
virtual T getValue () const
 Get the underlying value.
 
virtual bool setValue (T value)
 Set the 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 T >
typedef T(* getter_t) ()

The template type of a static getter function.

Definition at line 476 of file props.hxx.

◆ setter_t

template<class T >
typedef void(* setter_t) (T)

The template type of a static setter function.

Definition at line 481 of file props.hxx.

Constructor & Destructor Documentation

◆ SGRawValueFunctions()

template<class T >
SGRawValueFunctions ( getter_t  getter = 0,
setter_t  setter = 0 
)
inline

Explicit constructor.

Create a new raw value bound to the getter and setter supplied.

Parameters
getterA static function for getting a value, or 0 to read-disable the value.
setterA static function for setting a value, or 0 to write-disable the value.

Definition at line 493 of file props.hxx.

494 : _getter(getter), _setter(setter) {}

◆ ~SGRawValueFunctions()

template<class T >
virtual ~SGRawValueFunctions ( )
inlinevirtual

Destructor.

Definition at line 499 of file props.hxx.

499{}

Member Function Documentation

◆ clone()

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

Create a copy of this raw value, bound to the same functions.

Definition at line 528 of file props.hxx.

528 {
529 return new SGRawValueFunctions(_getter,_setter);
530 }
A value managed through static functions.
Definition props.hxx:470

◆ getValue()

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

Get the underlying value.

This method will invoke the getter function to get a value. If no getter function was supplied, this method will always return the default value for the type.

Implements SGRawValue< T >.

Definition at line 508 of file props.hxx.

508 {
509 if (_getter) return (*_getter)();
510 else return SGRawValue<T>::DefaultValue();
511 }
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 T >
virtual bool setValue ( value)
inlinevirtual

Set the underlying value.

This method will invoke the setter function to change the underlying value. If no setter function was supplied, this method will return false.

Implements SGRawValue< T >.

Definition at line 520 of file props.hxx.

520 {
521 if (_setter) { (*_setter)(value); return true; }
522 else return false;
523 }

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