WPILibC++ 2025.3.1
Loading...
Searching...
No Matches
frc::sim::SimDeviceSim Class Reference

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

#include <frc/simulation/SimDeviceSim.h>

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.
 
hal::SimValue GetValue (const char *name) const
 Get the property object with the given name.
 
hal::SimInt GetInt (const char *name) const
 Get the property object with the given name.
 
hal::SimLong GetLong (const char *name) const
 Get the property object with the given name.
 
hal::SimDouble GetDouble (const char *name) const
 Get the property object with the given name.
 
hal::SimEnum GetEnum (const char *name) const
 Get the property object with the given name.
 
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]

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

Constructs a SimDeviceSim.

Parameters
namename of the SimDevice

◆ SimDeviceSim() [2/4]

frc::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]

frc::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]

frc::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 >
static void frc::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 frc::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()

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

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ GetDouble()

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

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ GetEnum()

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

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ GetEnumOptions()

static std::vector< std::string > frc::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()

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

Get the property object with the given name.

Parameters
namethe property name
Returns
the property object

◆ GetLong()

hal::SimLong frc::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 frc::sim::SimDeviceSim::GetName ( ) const

Get the name of this object.

Returns
name

◆ GetValue()

hal::SimValue frc::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()

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

Get the raw handle of this object.

Returns
the handle used to refer to this object

◆ ResetData()

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

Reset all SimDevice data.


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