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
SGRawValueMethodsIndexed< C, T > Class Template Reference

Detailed Description

template<class C, class T>
class SGRawValueMethodsIndexed< C, T >

An indexed 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 615 of file props.hxx.

#include <props.hxx>

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

Public Types

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

Public Member Functions

 SGRawValueMethodsIndexed (C &obj, int index, 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) (int) const

Definition at line 618 of file props.hxx.

◆ setter_t

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

Definition at line 619 of file props.hxx.

Constructor & Destructor Documentation

◆ SGRawValueMethodsIndexed()

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

Definition at line 620 of file props.hxx.

622 : _obj(obj), _index(index), _getter(getter), _setter(setter) {}

◆ ~SGRawValueMethodsIndexed()

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

Definition at line 623 of file props.hxx.

623{}

Member Function Documentation

◆ clone()

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

Definition at line 632 of file props.hxx.

632 {
633 return new SGRawValueMethodsIndexed(_obj, _index, _getter, _setter);
634 }
An indexed value managed through an object and access methods.
Definition props.hxx:616

◆ 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 624 of file props.hxx.

624 {
625 if (_getter) { return (_obj.*_getter)(_index); }
626 else { return SGRawValue<T>::DefaultValue(); }
627 }
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 628 of file props.hxx.

628 {
629 if (_setter) { (_obj.*_setter)(_index, value); return true; }
630 else return false;
631 }

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