WPILibC++ 2024.3.2
hal::SimValue Class Reference

C++ wrapper around a HAL simulator value handle. More...

#include <hal/SimDevice.h>

Inheritance diagram for hal::SimValue:
hal::SimBoolean hal::SimDouble hal::SimEnum hal::SimInt hal::SimLong

Public Member Functions

 SimValue ()=default
 Default constructor that results in an "empty" object that is false in a boolean context. More...
 
 SimValue (HAL_SimValueHandle val)
 Wraps a simulated value handle as returned by HAL_CreateSimValue(). More...
 
 operator bool () const
 Determine if handle is empty. More...
 
 operator HAL_SimValueHandle () const
 Get the internal device handle. More...
 
HAL_Value GetValue () const
 Gets the simulated value. More...
 
void SetValue (const HAL_Value &value)
 Sets the simulated value. More...
 

Protected Attributes

HAL_SimValueHandle m_handle = HAL_kInvalidHandle
 

Detailed Description

C++ wrapper around a HAL simulator value handle.

Constructor & Destructor Documentation

◆ SimValue() [1/2]

hal::SimValue::SimValue ( )
default

Default constructor that results in an "empty" object that is false in a boolean context.

◆ SimValue() [2/2]

hal::SimValue::SimValue ( HAL_SimValueHandle  val)
inline

Wraps a simulated value handle as returned by HAL_CreateSimValue().

Parameters
valsimulated value handle

Member Function Documentation

◆ GetValue()

HAL_Value hal::SimValue::GetValue ( ) const
inline

Gets the simulated value.

Returns
The current value

◆ operator bool()

hal::SimValue::operator bool ( ) const
inlineexplicit

Determine if handle is empty.

Should be used to optimize out code paths that are taken/not taken in simulation.

Returns
False if handle is empty, true if handle is valid.

◆ operator HAL_SimValueHandle()

hal::SimValue::operator HAL_SimValueHandle ( ) const
inline

Get the internal device handle.

Returns
internal handle

◆ SetValue()

void hal::SimValue::SetValue ( const HAL_Value value)
inline

Sets the simulated value.

Parameters
valuethe value to set

Member Data Documentation

◆ m_handle

HAL_SimValueHandle hal::SimValue::m_handle = HAL_kInvalidHandle
protected

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