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

Static Public Member Functions

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

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,
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 ( 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: