7#include <initializer_list>
424 int32_t initialValue) {
426 static_cast<int32_t
>(direction), initialValue);
441 int64_t initialValue) {
443 m_handle,
name,
static_cast<int32_t
>(direction), initialValue);
458 double initialValue) {
460 m_handle,
name,
static_cast<int32_t
>(direction), initialValue);
478 std::initializer_list<const char*> options,
479 int32_t initialValue) {
481 m_handle,
name,
static_cast<int32_t
>(direction), options.size(),
482 const_cast<const char**
>(options.begin()), initialValue);
500 std::span<const char* const> options,
501 int32_t initialValue) {
503 m_handle,
name,
static_cast<int32_t
>(direction), options.size(),
504 const_cast<const char**
>(options.data()), initialValue);
524 std::initializer_list<const char*> options,
525 std::initializer_list<double> optionValues,
526 int32_t initialValue) {
527 if (options.size() != optionValues.size()) {
531 m_handle,
name,
static_cast<int32_t
>(direction), options.size(),
532 const_cast<const char**
>(options.begin()), optionValues.begin(),
553 std::span<const char* const> options,
554 std::span<const double> optionValues,
555 int32_t initialValue) {
556 if (options.size() != optionValues.size()) {
560 m_handle,
name,
static_cast<int32_t
>(direction), options.size(),
561 const_cast<const char**
>(options.data()), optionValues.data(),
579 m_handle,
name,
static_cast<int32_t
>(direction), initialValue);
HAL_SimValueHandle HAL_CreateSimValue(HAL_SimDeviceHandle device, const char *name, int32_t direction, const HAL_Value &initialValue)
Definition SimDevice.hpp:13
HAL_Value HAL_GetSimValue(HAL_SimValueHandle handle)
Definition SimDevice.hpp:20
void HAL_SetSimValue(HAL_SimValueHandle handle, const HAL_Value &value)
Definition SimDevice.hpp:26
@ index
Definition base.h:690
@ name
Definition base.h:690
C++ wrapper around a HAL simulator boolean value handle.
Definition SimDevice.hpp:244
SimBoolean()=default
Default constructor that results in an "empty" object that is false in a boolean context.
bool Get() const
Gets the simulated value.
Definition SimDevice.hpp:265
SimBoolean(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValueBoolean().
Definition SimDevice.hpp:257
void Set(bool value)
Sets the simulated value.
Definition SimDevice.hpp:272
SimDevice(SimDevice &&rhs)
Definition SimDevice.hpp:361
SimEnum CreateEnum(const char *name, Direction direction, std::span< const char *const > options, int32_t initialValue)
Creates an enumerated value on the simulated device.
Definition SimDevice.hpp:499
SimBoolean CreateBoolean(const char *name, Direction direction, bool initialValue)
Creates a boolean value on the simulated device.
Definition SimDevice.hpp:576
SimDevice(const SimDevice &)=delete
SimDevice(const char *name, int index, int channel)
Creates a simulated device.
SimDevice & operator=(const SimDevice &)=delete
HAL_SimDeviceHandle m_handle
Definition SimDevice.hpp:583
SimDevice & operator=(SimDevice &&rhs)
Definition SimDevice.hpp:365
SimDevice(const char *name)
Creates a simulated device.
Definition SimDevice.hpp:311
SimDouble CreateDouble(const char *name, Direction direction, double initialValue)
Creates a double value on the simulated device.
Definition SimDevice.hpp:457
SimDevice()=default
Default constructor that results in an "empty" object that is false in a boolean context.
SimEnum CreateEnumDouble(const char *name, Direction direction, std::span< const char *const > options, std::span< const double > optionValues, int32_t initialValue)
Creates an enumerated value on the simulated device with double values.
Definition SimDevice.hpp:552
~SimDevice()
Definition SimDevice.hpp:352
SimValue CreateValue(const char *name, Direction direction, const HAL_Value &initialValue)
Creates a value on the simulated device.
Definition SimDevice.hpp:406
SimDevice(const char *name, int index)
Creates a simulated device.
Direction
Direction of a simulated value (from the perspective of user code).
Definition SimDevice.hpp:283
@ OUTPUT
Definition SimDevice.hpp:285
@ INPUT
Definition SimDevice.hpp:284
@ BIDIR
Definition SimDevice.hpp:286
std::string GetName() const
Get the name of the simulated device.
Definition SimDevice.hpp:391
SimEnum CreateEnum(const char *name, Direction direction, std::initializer_list< const char * > options, int32_t initialValue)
Creates an enumerated value on the simulated device.
Definition SimDevice.hpp:477
SimLong CreateLong(const char *name, Direction direction, int64_t initialValue)
Creates a long value on the simulated device.
Definition SimDevice.hpp:440
SimInt CreateInt(const char *name, Direction direction, int32_t initialValue)
Creates an int value on the simulated device.
Definition SimDevice.hpp:423
SimEnum CreateEnumDouble(const char *name, Direction direction, std::initializer_list< const char * > options, std::initializer_list< double > optionValues, int32_t initialValue)
Creates an enumerated value on the simulated device with double values.
Definition SimDevice.hpp:523
C++ wrapper around a HAL simulator double value handle.
Definition SimDevice.hpp:169
SimDouble(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValueDouble().
Definition SimDevice.hpp:182
SimDouble()=default
Default constructor that results in an "empty" object that is false in a boolean context.
void Reset()
Resets the simulated value to 0.
Definition SimDevice.hpp:204
void Set(double value)
Sets the simulated value.
Definition SimDevice.hpp:197
double Get() const
Gets the simulated value.
Definition SimDevice.hpp:190
C++ wrapper around a HAL simulator enum value handle.
Definition SimDevice.hpp:210
int32_t Get() const
Gets the simulated value.
Definition SimDevice.hpp:231
SimEnum()=default
Default constructor that results in an "empty" object that is false in a boolean context.
SimEnum(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValueEnum().
Definition SimDevice.hpp:223
void Set(int32_t value)
Sets the simulated value.
Definition SimDevice.hpp:238
C++ wrapper around a HAL simulator int value handle.
Definition SimDevice.hpp:87
int32_t Get() const
Gets the simulated value.
Definition SimDevice.hpp:108
void Set(int32_t value)
Sets the simulated value.
Definition SimDevice.hpp:115
SimInt(HAL_SimValueHandle val)
Wraps a simulated value handle as returned by HAL_CreateSimValueInt().
Definition SimDevice.hpp:100
SimInt()=default
Default constructor that results in an "empty" object that is false in a boolean context.
void Reset()
Resets the simulated value to 0.
Definition SimDevice.hpp:122
C++ wrapper around a HAL simulator long value handle.
Definition SimDevice.hpp:128
int64_t Get() const
Gets the simulated value.
Definition SimDevice.hpp:149
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().
Definition SimDevice.hpp:141
void Set(int64_t value)
Sets the simulated value.
Definition SimDevice.hpp:156
void Reset()
Resets the simulated value to 0.
Definition SimDevice.hpp:163
C++ wrapper around a HAL simulator value handle.
Definition SimDevice.hpp:35
void SetValue(const HAL_Value &value)
Sets the simulated value.
Definition SimDevice.hpp:78
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().
Definition SimDevice.hpp:48
HAL_Value GetValue() const
Gets the simulated value.
Definition SimDevice.hpp:71
HAL_SimValueHandle m_handle
Definition SimDevice.hpp:81
HAL_SimValueHandle HAL_CreateSimValueEnumDouble(HAL_SimDeviceHandle device, const char *name, int32_t direction, int32_t numOptions, const char **options, const double *optionValues, int32_t initialValue)
Creates an enumerated value on a simulated device with double values.
HAL_SimValueHandle HAL_CreateSimValueInt(HAL_SimDeviceHandle device, const char *name, int32_t direction, int32_t initialValue)
Creates an int value on a simulated device.
Definition SimDevice.h:101
double HAL_GetSimValueDouble(HAL_SimValueHandle handle)
Gets a simulated value (double).
Definition SimDevice.h:251
HAL_SimValueHandle HAL_CreateSimValue(HAL_SimDeviceHandle device, const char *name, int32_t direction, const struct HAL_Value *initialValue)
Creates a value on a simulated device.
int32_t HAL_GetSimValueEnum(HAL_SimValueHandle handle)
Gets a simulated value (enum).
Definition SimDevice.h:263
HAL_SimValueHandle HAL_CreateSimValueBoolean(HAL_SimDeviceHandle device, const char *name, int32_t direction, HAL_Bool initialValue)
Creates a boolean value on a simulated device.
Definition SimDevice.h:205
void HAL_SetSimValueEnum(HAL_SimValueHandle handle, int32_t value)
Sets a simulated value (enum).
Definition SimDevice.h:328
void HAL_SetSimValueDouble(HAL_SimValueHandle handle, double value)
Sets a simulated value (double).
Definition SimDevice.h:317
void HAL_FreeSimDevice(HAL_SimDeviceHandle handle)
Frees a simulated device.
void HAL_SetSimValue(HAL_SimValueHandle handle, const struct HAL_Value *value)
Sets a simulated value.
void HAL_SetSimValueLong(HAL_SimValueHandle handle, int64_t value)
Sets a simulated value (long).
Definition SimDevice.h:306
HAL_SimDeviceHandle HAL_CreateSimDevice(const char *name)
Creates a simulated device.
HAL_SimValueHandle HAL_CreateSimValueEnum(HAL_SimDeviceHandle device, const char *name, int32_t direction, int32_t numOptions, const char **options, int32_t initialValue)
Creates an enumerated value on a simulated device.
HAL_SimValueHandle HAL_CreateSimValueDouble(HAL_SimDeviceHandle device, const char *name, int32_t direction, double initialValue)
Creates a double value on a simulated device.
Definition SimDevice.h:141
HAL_SimValueHandle HAL_CreateSimValueLong(HAL_SimDeviceHandle device, const char *name, int32_t direction, int64_t initialValue)
Creates a long value on a simulated device.
Definition SimDevice.h:121
void HAL_SetSimValueInt(HAL_SimValueHandle handle, int value)
Sets a simulated value (int).
Definition SimDevice.h:295
HAL_Bool HAL_GetSimValueBoolean(HAL_SimValueHandle handle)
Gets a simulated value (boolean).
Definition SimDevice.h:275
void HAL_GetSimValue(HAL_SimValueHandle handle, struct HAL_Value *value)
Gets a simulated value.
int64_t HAL_GetSimValueLong(HAL_SimValueHandle handle)
Gets a simulated value (long).
Definition SimDevice.h:239
const char * HAL_GetSimDeviceName(HAL_SimDeviceHandle handle)
Get the name of a simulated device.
void HAL_SetSimValueBoolean(HAL_SimValueHandle handle, HAL_Bool value)
Sets a simulated value (boolean).
Definition SimDevice.h:339
int32_t HAL_GetSimValueInt(HAL_SimValueHandle handle)
Gets a simulated value (int).
Definition SimDevice.h:227
void HAL_ResetSimValue(HAL_SimValueHandle handle)
Resets a simulated double or integral value to 0.
@ HAL_SIM_VALUE_OUTPUT
output from user code to the simulator
Definition SimDevice.h:29
@ HAL_SIM_VALUE_INPUT
input to user code from the simulator
Definition SimDevice.h:28
@ HAL_SIM_VALUE_BIDIR
bidirectional between user code and simulator
Definition SimDevice.h:30
#define HAL_INVALID_HANDLE
Definition Types.h:15
HAL_Handle HAL_SimDeviceHandle
Definition Types.h:45
HAL_Handle HAL_SimValueHandle
Definition Types.h:47
WPILib Hardware Abstraction Layer (HAL) namespace.
Definition Types.hpp:9
HAL Entry Value.
Definition Value.h:26