WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::hal::SimLong Class Reference

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

#include <wpi/hal/SimDevice.hpp>

Inheritance diagram for wpi::hal::SimLong:
wpi::hal::SimValue

Public Member Functions

 SimLong ()=default
 Default constructor that results in an "empty" object that is false in a boolean context.
 SimLong (HAL_SimValueHandle val)
 Wraps a simulated value handle as returned by HAL_CreateSimValueLong().
int64_t Get () const
 Gets the simulated value.
void Set (int64_t value)
 Sets the simulated value.
void Reset ()
 Resets the simulated value to 0.
Public Member Functions inherited from wpi::hal::SimValue
 SimValue ()=default
 Default constructor that results in an "empty" object that is false in a boolean context.
 SimValue (HAL_SimValueHandle val)
 Wraps a simulated value handle as returned by HAL_CreateSimValue().
 operator bool () const
 Determine if handle is empty.
 operator HAL_SimValueHandle () const
 Get the internal device handle.
HAL_Value GetValue () const
 Gets the simulated value.
void SetValue (const HAL_Value &value)
 Sets the simulated value.

Additional Inherited Members

Protected Attributes inherited from wpi::hal::SimValue
HAL_SimValueHandle m_handle = HAL_kInvalidHandle

Detailed Description

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

Constructor & Destructor Documentation

◆ SimLong() [1/2]

wpi::hal::SimLong::SimLong ( )
default

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

◆ SimLong() [2/2]

wpi::hal::SimLong::SimLong ( HAL_SimValueHandle val)
inline

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

Parameters
valsimulated value handle

Member Function Documentation

◆ Get()

int64_t wpi::hal::SimLong::Get ( ) const
inline

Gets the simulated value.

Returns
The current value

◆ Reset()

void wpi::hal::SimLong::Reset ( )
inline

Resets the simulated value to 0.

Use this instead of Set(0) for resetting incremental sensor values like encoder counts or gyro accumulated angle to ensure correct behavior in a distributed system (e.g. WebSockets).

◆ Set()

void wpi::hal::SimLong::Set ( int64_t value)
inline

Sets the simulated value.

Parameters
valuethe value to set

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