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

Detailed Description

template<class T>
class SGRawValuePointer< T >

A raw value bound to a pointer.

This is the most efficient way to tie an external value, but also the most dangerous, because there is no way for the supplier to perform bounds checking and derived calculations except by polling the variable to see if it has changed. There is no default constructor, because this class would be meaningless without a pointer.

Definition at line 412 of file props.hxx.

#include <props.hxx>

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

Public Member Functions

 SGRawValuePointer (T *ptr)
 Explicit pointer constructor.
 
virtual ~SGRawValuePointer ()
 Destructor.
 
virtual SGRawclone () const
 Create a copy of this raw value.
 
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.
 

Constructor & Destructor Documentation

◆ SGRawValuePointer()

template<class T >
SGRawValuePointer ( T *  ptr)
inline

Explicit pointer constructor.

Create a new raw value bound to the value of the variable referenced by the pointer.

Parameters
ptrThe pointer to the variable to which this raw value will be bound.

Definition at line 425 of file props.hxx.

425: _ptr(ptr) {}

◆ ~SGRawValuePointer()

template<class T >
virtual ~SGRawValuePointer ( )
inlinevirtual

Destructor.

Definition at line 430 of file props.hxx.

430{}

Member Function Documentation

◆ clone()

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

Create a copy of this raw value.

The copy will use the same external pointer as the original.

Definition at line 453 of file props.hxx.

453 {
454 return new SGRawValuePointer(_ptr);
455 }
A raw value bound to a pointer.
Definition props.hxx:413

◆ getValue()

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

Get the underlying value.

This method will dereference the pointer and return the variable's value.

Implements SGRawValue< T >.

Definition at line 438 of file props.hxx.

438{ return *_ptr; }

◆ setValue()

template<class T >
virtual bool setValue ( value)
inlinevirtual

Set the underlying value.

This method will dereference the pointer and change the variable's value.

Implements SGRawValue< T >.

Definition at line 446 of file props.hxx.

446{ *_ptr = value; return true; }

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