10#include <initializer_list>
35 HAL_SimValueInput = 0,
91 const char* name,
int32_t direction,
160 double initialValue) {
184 const char** options,
206 int32_t numOptions,
const char** options,
const double* optionValues,
407 SimValue() =
default;
453class SimInt :
public SimValue {
494class SimLong :
public SimValue {
535class SimDouble :
public SimValue {
541 SimDouble() =
default;
576class SimEnum :
public SimValue {
610class SimBoolean :
public SimValue {
616 SimBoolean() =
default;
650 kInput = HAL_SimValueInput,
651 kOutput = HAL_SimValueOutput,
652 kBidir = HAL_SimValueBidir
659 SimDevice() =
default;
690 SimDevice(
const char* name,
int index);
707 SimDevice(
const char* name,
int index,
int channel);
715 SimDevice(
const SimDevice&) =
delete;
716 SimDevice& operator=(
const SimDevice&) =
delete;
718 SimDevice(SimDevice&& rhs) : m_handle(rhs.m_handle) {
722 SimDevice& operator=(SimDevice&& rhs) {
723 m_handle = rhs.m_handle;
748 std::string GetName()
const {
763 SimValue CreateValue(
const char* name,
int32_t direction,
779 SimInt CreateInt(
const char* name,
int32_t direction,
int32_t initialValue) {
794 SimLong CreateLong(
const char* name,
int32_t direction,
810 SimDouble CreateDouble(
const char* name,
int32_t direction,
811 double initialValue) {
829 SimEnum CreateEnum(
const char* name,
int32_t direction,
830 std::initializer_list<const char*> options,
833 const_cast<const char**
>(options.begin()),
851 SimEnum CreateEnum(
const char* name,
int32_t direction,
852 std::span<const char* const> options,
855 const_cast<const char**
>(options.data()),
875 SimEnum CreateEnumDouble(
const char* name,
int32_t direction,
876 std::initializer_list<const char*> options,
877 std::initializer_list<double> optionValues,
879 if (options.size() != optionValues.size()) {
883 m_handle, name, direction, options.size(),
884 const_cast<const char**
>(options.begin()), optionValues.begin(),
904 SimEnum CreateEnumDouble(
const char* name,
int32_t direction,
905 std::span<const char* const> options,
906 std::span<const double> optionValues,
908 if (options.size() != optionValues.size()) {
912 m_handle, name, direction, options.size(),
913 const_cast<const char**
>(options.data()), optionValues.data(),
928 SimBoolean CreateBoolean(
const char* name,
int32_t direction,
struct HAL_Value HAL_MakeBoolean(HAL_Bool v)
Definition: Value.h:35
struct HAL_Value HAL_MakeDouble(double v)
Definition: Value.h:63
struct HAL_Value HAL_MakeEnum(int v)
Definition: Value.h:42
struct HAL_Value HAL_MakeInt(int v)
Definition: Value.h:49
struct HAL_Value HAL_MakeLong(int64_t v)
Definition: Value.h:56
@ HAL_DOUBLE
Definition: Value.h:13
@ HAL_LONG
Definition: Value.h:16
@ HAL_BOOLEAN
Definition: Value.h:12
@ HAL_INT
Definition: Value.h:15
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:117
double HAL_GetSimValueDouble(HAL_SimValueHandle handle)
Gets a simulated value (double).
Definition: SimDevice.h:277
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:289
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:221
void HAL_SetSimValueEnum(HAL_SimValueHandle handle, int32_t value)
Sets a simulated value (enum).
Definition: SimDevice.h:362
void HAL_SetSimValueDouble(HAL_SimValueHandle handle, double value)
Sets a simulated value (double).
Definition: SimDevice.h:351
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:340
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:157
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:137
void HAL_SetSimValueInt(HAL_SimValueHandle handle, int value)
Sets a simulated value (int).
Definition: SimDevice.h:329
HAL_Bool HAL_GetSimValueBoolean(HAL_SimValueHandle handle)
Gets a simulated value (boolean).
Definition: SimDevice.h:301
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:265
HAL_ENUM(HAL_SimValueDirection)
Direction of a simulated value (from the perspective of user code).
Definition: SimDevice.h:34
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:373
int32_t HAL_GetSimValueInt(HAL_SimValueHandle handle)
Gets a simulated value (int).
Definition: SimDevice.h:253
void HAL_ResetSimValue(HAL_SimValueHandle handle)
Resets a simulated double or integral value to 0.
int32_t HAL_Bool
Definition: Types.h:73
HAL_Handle HAL_SimDeviceHandle
Definition: Types.h:53
HAL_Handle HAL_SimValueHandle
Definition: Types.h:55
#define HAL_kInvalidHandle
Definition: Types.h:15
::int32_t int32_t
Definition: Meta.h:57
::int64_t int64_t
Definition: Meta.h:59
WPILib Hardware Abstraction Layer (HAL) namespace.
Definition: ChipObject.h:40
constexpr const char * name(const T &)
HAL Entry Value.
Definition: Value.h:20
double v_double
Definition: Value.h:26
int64_t v_long
Definition: Value.h:25
HAL_Bool v_boolean
Definition: Value.h:22
int32_t v_int
Definition: Value.h:24
enum HAL_Type type
Definition: Value.h:28
int32_t v_enum
Definition: Value.h:23