WPILibC++ 2027.0.0-alpha-4
Loading...
Searching...
No Matches
wpi::sim::SimDeviceSim Class Reference

Class to control the simulation side of a SimDevice. More...

#include <wpi/simulation/SimDeviceSim.hpp>

Public Member Functions

 SimDeviceSim (const char *name)
 Constructs a SimDeviceSim.
 SimDeviceSim (const char *name, int index)
 Constructs a SimDeviceSim.
 SimDeviceSim (const char *name, int index, int channel)
 Constructs a SimDeviceSim.
 SimDeviceSim (HAL_SimDeviceHandle handle)
 Constructs a SimDeviceSim.
std::string GetName () const
 Get the name of this object.
wpi::hal::SimValue GetValue (const char *name) const
 Get the property object with the given name.
wpi::hal::SimInt GetInt (const char *name) const
 Get the property object with the given name.
wpi::hal::SimLong GetLong (const char *name) const
 Get the property object with the given name.
wpi::hal::SimDouble GetDouble (const char *name) const
 Get the property object with the given name.
wpi::hal::SimEnum GetEnum (const char *name) const
 Get the property object with the given name.
wpi::hal::SimBoolean GetBoolean (const char *name) const
 Get the property object with the given name.
template<typename F>
void EnumerateValues (F callback) const
 Get all properties.
 operator HAL_SimDeviceHandle () const
 Get the raw handle of this object.

Static Public Member Functions

static std::vector< std::string > GetEnumOptions (hal::SimEnum val)
 Get all options for the given enum.
template<typename F>
static void EnumerateDevices (const char *prefix, F callback)
 Get all sim devices with the given prefix.
static void ResetData ()
 Reset all SimDevice data.

Detailed Description

Class to control the simulation side of a SimDevice.

Constructor & Destructor Documentation

◆ SimDeviceSim() [1/4]

wpi::sim::SimDeviceSim::SimDeviceSim ( const char * name)
explicit

Constructs a SimDeviceSim.

Parameters
namename of the SimDevice

◆ SimDeviceSim() [2/4]

wpi::sim::SimDeviceSim::SimDeviceSim ( const char * name,
int index )

Constructs a SimDeviceSim.

Parameters
namename of the SimDevice
indexdevice index number to append to name

◆ SimDeviceSim() [3/4]

wpi::sim::SimDeviceSim::SimDeviceSim ( const char * name,
int index,
int channel )

Constructs a SimDeviceSim.

Parameters
namename of the SimDevice
indexdevice index number to append to name
channeldevice channel number to append to name

◆ SimDeviceSim() [4/4]

wpi::sim::SimDeviceSim::SimDeviceSim ( HAL_SimDeviceHandle handle)
explicit

Constructs a SimDeviceSim.

Parameters
handlethe low level handle for the corresponding SimDevice.

Member Function Documentation

◆ EnumerateDevices()

template<typename F>
void wpi::sim::SimDeviceSim::EnumerateDevices ( const char * prefix,
F callback )
inlinestatic

Get all sim devices with the given prefix.

Parameters
prefixthe prefix to filter sim devices
callbackcallback function to call for each sim device

◆ EnumerateValues()

template<typename F>
void wpi::sim::SimDeviceSim::EnumerateValues ( F callback) const
inline

Get all properties.

Parameters
callbackcallback called for each property (SimValue). Signature of the callback must be const char*, HAL_SimValueHandle, int, const HAL_Value*

◆ GetBoolean()

wpi::hal::SimBoolean wpi::sim::SimDeviceSim::GetBoolean ( const char * name) const

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ GetDouble()

wpi::hal::SimDouble wpi::sim::SimDeviceSim::GetDouble ( const char * name) const

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ GetEnum()

wpi::hal::SimEnum wpi::sim::SimDeviceSim::GetEnum ( const char * name) const

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ GetEnumOptions()

std::vector< std::string > wpi::sim::SimDeviceSim::GetEnumOptions ( hal::SimEnum val)
static

Get all options for the given enum.

Parameters
valthe enum
Returns
names of the different values for that enum

◆ GetInt()

wpi::hal::SimInt wpi::sim::SimDeviceSim::GetInt ( const char * name) const

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ GetLong()

wpi::hal::SimLong wpi::sim::SimDeviceSim::GetLong ( const char * name) const

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ GetName()

std::string wpi::sim::SimDeviceSim::GetName ( ) const

Get the name of this object.

Returns
name

◆ GetValue()

wpi::hal::SimValue wpi::sim::SimDeviceSim::GetValue ( const char * name) const

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ operator HAL_SimDeviceHandle()

wpi::sim::SimDeviceSim::operator HAL_SimDeviceHandle ( ) const
inline

Get the raw handle of this object.

Returns
the handle used to refer to this object

◆ ResetData()

void wpi::sim::SimDeviceSim::ResetData ( )
static

Reset all SimDevice data.


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