diff --git a/cscore/src/main/native/include/wpi/cs/cscore_c.h b/cscore/src/main/native/include/wpi/cs/cscore_c.h index 64badd6363..47c68137cd 100644 --- a/cscore/src/main/native/include/wpi/cs/cscore_c.h +++ b/cscore/src/main/native/include/wpi/cs/cscore_c.h @@ -7,6 +7,7 @@ #include // NOLINT #include +#include "wpi/util/Handle.h" #include "wpi/util/PixelFormat.h" #include "wpi/util/string.h" @@ -40,7 +41,7 @@ extern "C" { typedef int CS_Bool; typedef int CS_Status; -typedef int CS_Handle; +typedef WPI_Handle CS_Handle; typedef CS_Handle CS_Property; typedef CS_Handle CS_Listener; typedef CS_Handle CS_ListenerPoller; diff --git a/hal/src/main/native/include/wpi/hal/Types.h b/hal/src/main/native/include/wpi/hal/Types.h index 7c93550d3b..e9264837a9 100644 --- a/hal/src/main/native/include/wpi/hal/Types.h +++ b/hal/src/main/native/include/wpi/hal/Types.h @@ -6,15 +6,17 @@ #include +#include "wpi/util/Handle.h" + /** * @defgroup hal_types Type Definitions * @ingroup hal_capi * @{ */ -#define HAL_INVALID_HANDLE 0 +#define HAL_INVALID_HANDLE WPI_INVALID_HANDLE -typedef int32_t HAL_Handle; +typedef WPI_Handle HAL_Handle; typedef HAL_Handle HAL_AlertHandle; diff --git a/hal/src/main/native/include/wpi/hal/Types.hpp b/hal/src/main/native/include/wpi/hal/Types.hpp deleted file mode 100644 index dc0206b0fd..0000000000 --- a/hal/src/main/native/include/wpi/hal/Types.hpp +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright (c) FIRST and other WPILib contributors. -// Open Source Software; you can modify and/or share it under the terms of -// the WPILib BSD license file in the root directory of this project. - -#pragma once - -#include "wpi/hal/Types.h" - -namespace wpi::hal { -/** - * A move-only C++ wrapper around a HAL handle. - * Will free the handle if FreeFunction is provided - */ -template -class Handle { - public: - Handle() = default; - /*implicit*/ Handle(CType val) : m_handle(val) {} // NOLINT - - Handle(const Handle&) = delete; - Handle& operator=(const Handle&) = delete; - - Handle(Handle&& rhs) : m_handle(rhs.m_handle) { rhs.m_handle = CInvalid; } - - Handle& operator=(Handle&& rhs) { - if (this != &rhs) { -// FIXME: GCC gives the false positive "the address of will never -// be NULL" because it doesn't realize the default template parameter can make -// GetDefault nullptr. Fixed in GCC 13. -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94554 -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105885 -#if __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Waddress" -#endif // __GNUC__ - if constexpr (FreeFunction != nullptr) { -#if __GNUC__ -#pragma GCC diagnostic pop -#endif // __GNUC__ - if (m_handle != CInvalid) { - FreeFunction(m_handle); - } - } - } - m_handle = rhs.m_handle; - rhs.m_handle = CInvalid; - return *this; - } - - ~Handle() { -// FIXME: GCC gives the false positive "the address of will never -// be NULL" because it doesn't realize the default template parameter can make -// GetDefault nullptr. Fixed in GCC 13. -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94554 -// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105885 -#if __GNUC__ -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Waddress" -#endif // __GNUC__ - if constexpr (FreeFunction != nullptr) { -#if __GNUC__ -#pragma GCC diagnostic pop -#endif // __GNUC__ - if (m_handle != CInvalid) { - FreeFunction(m_handle); - } - } - } - - operator CType() const { return m_handle; } // NOLINT - - private: - CType m_handle = CInvalid; -}; - -} // namespace wpi::hal diff --git a/ntcore/src/main/native/include/wpi/nt/ntcore_c.h b/ntcore/src/main/native/include/wpi/nt/ntcore_c.h index ef09d5aa5b..c7d28bf186 100644 --- a/ntcore/src/main/native/include/wpi/nt/ntcore_c.h +++ b/ntcore/src/main/native/include/wpi/nt/ntcore_c.h @@ -6,6 +6,7 @@ #include +#include "wpi/util/Handle.h" #include "wpi/util/string.h" #ifdef __cplusplus @@ -31,7 +32,7 @@ struct WPI_DataLog; /** Typedefs */ typedef int NT_Bool; -typedef unsigned int NT_Handle; +typedef WPI_Handle NT_Handle; typedef NT_Handle NT_ConnectionDataLogger; typedef NT_Handle NT_DataLogger; typedef NT_Handle NT_Entry; diff --git a/ntcore/src/test/native/cpp/ConnectionListenerTest.cpp b/ntcore/src/test/native/cpp/ConnectionListenerTest.cpp index fe32ef387f..cab82c9012 100644 --- a/ntcore/src/test/native/cpp/ConnectionListenerTest.cpp +++ b/ntcore/src/test/native/cpp/ConnectionListenerTest.cpp @@ -51,10 +51,10 @@ void ConnectionListenerTest::Connect(const char* address, unsigned int port4) { TEST_F(ConnectionListenerTest, Polled) { // set up the poller NT_ListenerPoller poller = wpi::nt::CreateListenerPoller(server_inst); - ASSERT_NE(poller, 0u); + ASSERT_NE(poller, 0); NT_Listener handle = wpi::nt::AddPolledListener( poller, server_inst, wpi::nt::EventFlags::CONNECTION); - ASSERT_NE(handle, 0u); + ASSERT_NE(handle, 0); // trigger a connect event Connect("127.0.0.1", 10020); diff --git a/ntcore/src/test/native/cpp/LocalStorageTest.cpp b/ntcore/src/test/native/cpp/LocalStorageTest.cpp index 95d35101f1..195ad64647 100644 --- a/ntcore/src/test/native/cpp/LocalStorageTest.cpp +++ b/ntcore/src/test/native/cpp/LocalStorageTest.cpp @@ -73,11 +73,11 @@ TEST_F(LocalStorageTest, GetTopic2) { } TEST_F(LocalStorageTest, GetTopicEmptyName) { - EXPECT_EQ(storage.GetTopic(""), 0u); + EXPECT_EQ(storage.GetTopic(""), 0); } TEST_F(LocalStorageTest, GetEntryEmptyName) { - EXPECT_EQ(storage.GetEntry(""), 0u); + EXPECT_EQ(storage.GetEntry(""), 0); } TEST_F(LocalStorageTest, GetEntryCached) { @@ -538,11 +538,11 @@ TEST_F(LocalStorageTest, PublishUntyped) { std::string_view{"cannot publish 'foo' with an unassigned " "type or empty type string"})); - EXPECT_EQ(storage.Publish(fooTopic, NT_UNASSIGNED, "", {}, {}), 0u); + EXPECT_EQ(storage.Publish(fooTopic, NT_UNASSIGNED, "", {}, {}), 0); } TEST_F(LocalStorageTest, SetValueInvalidHandle) { - EXPECT_FALSE(storage.SetEntryValue(0u, {})); + EXPECT_FALSE(storage.SetEntryValue(0, {})); } class LocalStorageDuplicatesTest : public LocalStorageTest { diff --git a/wpilibc/src/main/native/include/wpi/counter/Tachometer.hpp b/wpilibc/src/main/native/include/wpi/counter/Tachometer.hpp index 3165441fe2..3159aa3622 100644 --- a/wpilibc/src/main/native/include/wpi/counter/Tachometer.hpp +++ b/wpilibc/src/main/native/include/wpi/counter/Tachometer.hpp @@ -6,10 +6,10 @@ #include "EdgeConfiguration.hpp" #include "wpi/hal/Counter.h" -#include "wpi/hal/Types.hpp" #include "wpi/units/angular_velocity.hpp" #include "wpi/units/frequency.hpp" #include "wpi/units/time.hpp" +#include "wpi/util/Handle.hpp" #include "wpi/util/sendable/Sendable.hpp" #include "wpi/util/sendable/SendableHelper.hpp" @@ -110,7 +110,7 @@ class Tachometer : public wpi::util::Sendable, void InitSendable(wpi::util::SendableBuilder& builder) override; private: - wpi::hal::Handle m_handle; + wpi::util::Handle m_handle; int m_edgesPerRevolution; int32_t m_channel; }; diff --git a/wpilibc/src/main/native/include/wpi/counter/UpDownCounter.hpp b/wpilibc/src/main/native/include/wpi/counter/UpDownCounter.hpp index 003d8acf79..908679402f 100644 --- a/wpilibc/src/main/native/include/wpi/counter/UpDownCounter.hpp +++ b/wpilibc/src/main/native/include/wpi/counter/UpDownCounter.hpp @@ -6,7 +6,7 @@ #include "EdgeConfiguration.hpp" #include "wpi/hal/Counter.h" -#include "wpi/hal/Types.hpp" +#include "wpi/util/Handle.hpp" #include "wpi/util/sendable/Sendable.hpp" #include "wpi/util/sendable/SendableHelper.hpp" @@ -54,7 +54,7 @@ class UpDownCounter : public wpi::util::Sendable, void InitSendable(wpi::util::SendableBuilder& builder) override; private: - wpi::hal::Handle m_handle; + wpi::util::Handle m_handle; int32_t m_channel; }; } // namespace wpi diff --git a/wpilibc/src/main/native/include/wpi/driverstation/Alert.hpp b/wpilibc/src/main/native/include/wpi/driverstation/Alert.hpp index 66b4bb7a4e..dc65d572ba 100644 --- a/wpilibc/src/main/native/include/wpi/driverstation/Alert.hpp +++ b/wpilibc/src/main/native/include/wpi/driverstation/Alert.hpp @@ -8,7 +8,7 @@ #include #include "wpi/hal/Alert.h" -#include "wpi/hal/Types.hpp" +#include "wpi/util/Handle.hpp" namespace wpi { @@ -116,7 +116,7 @@ class Alert { private: Level m_type; - wpi::hal::Handle m_handle; + wpi::util::Handle m_handle; }; } // namespace wpi diff --git a/wpilibc/src/main/native/include/wpi/framework/TimedRobot.hpp b/wpilibc/src/main/native/include/wpi/framework/TimedRobot.hpp index 66c7d32520..dff475eff2 100644 --- a/wpilibc/src/main/native/include/wpi/framework/TimedRobot.hpp +++ b/wpilibc/src/main/native/include/wpi/framework/TimedRobot.hpp @@ -8,10 +8,10 @@ #include "wpi/framework/IterativeRobotBase.hpp" #include "wpi/hal/Notifier.hpp" -#include "wpi/hal/Types.hpp" #include "wpi/internal/PeriodicPriorityQueue.hpp" #include "wpi/units/frequency.hpp" #include "wpi/units/time.hpp" +#include "wpi/util/Handle.hpp" namespace wpi { @@ -88,7 +88,7 @@ class TimedRobot : public IterativeRobotBase { wpi::units::second_t offset = 0_s); protected: - wpi::hal::Handle m_notifier; + wpi::util::Handle m_notifier; std::chrono::microseconds m_startTime; private: diff --git a/wpilibc/src/main/native/include/wpi/hardware/bus/CAN.hpp b/wpilibc/src/main/native/include/wpi/hardware/bus/CAN.hpp index ea9c6ddb32..061fc90248 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/bus/CAN.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/bus/CAN.hpp @@ -7,7 +7,7 @@ #include #include "wpi/hal/CANAPI.h" -#include "wpi/hal/Types.hpp" +#include "wpi/util/Handle.hpp" namespace wpi { @@ -155,6 +155,6 @@ class CAN { HAL_CAN_DEV_MISCELLANEOUS; private: - wpi::hal::Handle m_handle; + wpi::util::Handle m_handle; }; } // namespace wpi diff --git a/wpilibc/src/main/native/include/wpi/hardware/bus/I2C.hpp b/wpilibc/src/main/native/include/wpi/hardware/bus/I2C.hpp index bf43e8c6b6..7a344ccf6f 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/bus/I2C.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/bus/I2C.hpp @@ -8,7 +8,7 @@ #include "wpi/hal/I2C.h" #include "wpi/hal/I2CTypes.h" -#include "wpi/hal/Types.hpp" +#include "wpi/util/Handle.hpp" namespace wpi { @@ -154,7 +154,7 @@ class I2C { bool VerifySensor(int registerAddress, int count, const uint8_t* expected); private: - wpi::hal::Handle m_port; + wpi::util::Handle m_port; int m_deviceAddress; }; diff --git a/wpilibc/src/main/native/include/wpi/hardware/bus/SerialPort.hpp b/wpilibc/src/main/native/include/wpi/hardware/bus/SerialPort.hpp index 5c181ec013..990b9a8f17 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/bus/SerialPort.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/bus/SerialPort.hpp @@ -7,8 +7,8 @@ #include #include "wpi/hal/SerialPort.h" -#include "wpi/hal/Types.hpp" #include "wpi/units/time.hpp" +#include "wpi/util/Handle.hpp" namespace wpi { @@ -253,7 +253,7 @@ class SerialPort { void Reset(); private: - wpi::hal::Handle m_portHandle; + wpi::util::Handle m_portHandle; }; } // namespace wpi diff --git a/wpilibc/src/main/native/include/wpi/hardware/discrete/AnalogInput.hpp b/wpilibc/src/main/native/include/wpi/hardware/discrete/AnalogInput.hpp index 2c0942b8fb..2f943b1079 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/discrete/AnalogInput.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/discrete/AnalogInput.hpp @@ -7,7 +7,7 @@ #include #include "wpi/hal/AnalogInput.h" -#include "wpi/hal/Types.hpp" +#include "wpi/util/Handle.hpp" #include "wpi/util/sendable/Sendable.hpp" #include "wpi/util/sendable/SendableHelper.hpp" @@ -78,7 +78,7 @@ class AnalogInput : public wpi::util::Sendable, private: int m_channel; - wpi::hal::Handle m_port; + wpi::util::Handle m_port; }; } // namespace wpi diff --git a/wpilibc/src/main/native/include/wpi/hardware/discrete/DigitalInput.hpp b/wpilibc/src/main/native/include/wpi/hardware/discrete/DigitalInput.hpp index 407666ba7d..21ea53d3ca 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/discrete/DigitalInput.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/discrete/DigitalInput.hpp @@ -5,7 +5,7 @@ #pragma once #include "wpi/hal/DIO.h" -#include "wpi/hal/Types.hpp" +#include "wpi/util/Handle.hpp" #include "wpi/util/sendable/Sendable.hpp" #include "wpi/util/sendable/SendableHelper.hpp" @@ -60,7 +60,7 @@ class DigitalInput : public wpi::util::Sendable, private: int m_channel; - wpi::hal::Handle m_handle; + wpi::util::Handle m_handle; }; } // namespace wpi diff --git a/wpilibc/src/main/native/include/wpi/hardware/discrete/DigitalOutput.hpp b/wpilibc/src/main/native/include/wpi/hardware/discrete/DigitalOutput.hpp index 387816a987..34cbfd7cf5 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/discrete/DigitalOutput.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/discrete/DigitalOutput.hpp @@ -5,8 +5,8 @@ #pragma once #include "wpi/hal/DIO.h" -#include "wpi/hal/Types.hpp" #include "wpi/units/time.hpp" +#include "wpi/util/Handle.hpp" #include "wpi/util/sendable/Sendable.hpp" #include "wpi/util/sendable/SendableHelper.hpp" @@ -142,8 +142,8 @@ class DigitalOutput : public wpi::util::Sendable, private: int m_channel; - wpi::hal::Handle m_handle; - wpi::hal::Handle m_pwmGenerator; + wpi::util::Handle m_handle; + wpi::util::Handle m_pwmGenerator; }; } // namespace wpi diff --git a/wpilibc/src/main/native/include/wpi/hardware/discrete/PWM.hpp b/wpilibc/src/main/native/include/wpi/hardware/discrete/PWM.hpp index cf216a6120..3c0343b8b4 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/discrete/PWM.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/discrete/PWM.hpp @@ -7,8 +7,8 @@ #include #include "wpi/hal/PWM.h" -#include "wpi/hal/Types.hpp" #include "wpi/units/time.hpp" +#include "wpi/util/Handle.hpp" #include "wpi/util/sendable/Sendable.hpp" #include "wpi/util/sendable/SendableHelper.hpp" @@ -90,7 +90,7 @@ class PWM : public wpi::util::Sendable, public wpi::util::SendableHelper { private: int m_channel; - wpi::hal::Handle m_handle; + wpi::util::Handle m_handle; }; } // namespace wpi diff --git a/wpilibc/src/main/native/include/wpi/hardware/led/AddressableLED.hpp b/wpilibc/src/main/native/include/wpi/hardware/led/AddressableLED.hpp index 2a12f1a0bd..8e246b9a7b 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/led/AddressableLED.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/led/AddressableLED.hpp @@ -9,9 +9,9 @@ #include "wpi/hal/AddressableLED.h" #include "wpi/hal/AddressableLEDTypes.h" -#include "wpi/hal/Types.hpp" #include "wpi/util/Color.hpp" #include "wpi/util/Color8Bit.hpp" +#include "wpi/util/Handle.hpp" namespace wpi { @@ -170,7 +170,7 @@ class AddressableLED { std::span ledData); private: - wpi::hal::Handle m_handle; + wpi::util::Handle m_handle; int m_channel; int m_start{0}; int m_length{0}; diff --git a/wpilibc/src/main/native/include/wpi/hardware/power/PowerDistribution.hpp b/wpilibc/src/main/native/include/wpi/hardware/power/PowerDistribution.hpp index 092a4bbef1..3a203f2321 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/power/PowerDistribution.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/power/PowerDistribution.hpp @@ -7,7 +7,7 @@ #include #include "wpi/hal/PowerDistribution.h" -#include "wpi/hal/Types.hpp" +#include "wpi/util/Handle.hpp" #include "wpi/util/sendable/Sendable.hpp" #include "wpi/util/sendable/SendableHelper.hpp" @@ -346,7 +346,7 @@ class PowerDistribution : public wpi::util::Sendable, void InitSendable(wpi::util::SendableBuilder& builder) override; private: - wpi::hal::Handle + wpi::util::Handle m_handle; int m_module; }; diff --git a/wpilibc/src/main/native/include/wpi/hardware/rotation/DutyCycle.hpp b/wpilibc/src/main/native/include/wpi/hardware/rotation/DutyCycle.hpp index acae3e0449..3f981f10bd 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/rotation/DutyCycle.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/rotation/DutyCycle.hpp @@ -5,9 +5,9 @@ #pragma once #include "wpi/hal/DutyCycle.h" -#include "wpi/hal/Types.hpp" #include "wpi/units/frequency.hpp" #include "wpi/units/time.hpp" +#include "wpi/util/Handle.hpp" #include "wpi/util/sendable/Sendable.hpp" #include "wpi/util/sendable/SendableHelper.hpp" @@ -72,6 +72,6 @@ class DutyCycle : public wpi::util::Sendable, private: void InitDutyCycle(); int m_channel; - wpi::hal::Handle m_handle; + wpi::util::Handle m_handle; }; } // namespace wpi diff --git a/wpilibc/src/main/native/include/wpi/hardware/rotation/Encoder.hpp b/wpilibc/src/main/native/include/wpi/hardware/rotation/Encoder.hpp index 4ece4d88f3..0748d85502 100644 --- a/wpilibc/src/main/native/include/wpi/hardware/rotation/Encoder.hpp +++ b/wpilibc/src/main/native/include/wpi/hardware/rotation/Encoder.hpp @@ -5,8 +5,8 @@ #pragma once #include "wpi/hal/Encoder.h" -#include "wpi/hal/Types.hpp" #include "wpi/hardware/discrete/CounterBase.hpp" +#include "wpi/util/Handle.hpp" #include "wpi/util/sendable/Sendable.hpp" #include "wpi/util/sendable/SendableHelper.hpp" @@ -272,7 +272,7 @@ class Encoder : public CounterBase, */ double DecodingScaleFactor() const; - wpi::hal::Handle m_encoder; + wpi::util::Handle m_encoder; }; } // namespace wpi diff --git a/wpiutil/src/main/native/include/wpi/util/Handle.h b/wpiutil/src/main/native/include/wpi/util/Handle.h new file mode 100644 index 0000000000..c1392eac81 --- /dev/null +++ b/wpiutil/src/main/native/include/wpi/util/Handle.h @@ -0,0 +1,19 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +#pragma once + +#include + +#define WPI_INVALID_HANDLE 0 + +/** + * Generic handle for all WPI handle-based interfaces. + * + * Handle data layout: + * - Bits 0-23: Type-specific + * - Bits 24-30: Type + * - Bit 31: Error + */ +typedef int32_t WPI_Handle; // NOLINT diff --git a/wpiutil/src/main/native/include/wpi/util/Handle.hpp b/wpiutil/src/main/native/include/wpi/util/Handle.hpp new file mode 100644 index 0000000000..ea35add438 --- /dev/null +++ b/wpiutil/src/main/native/include/wpi/util/Handle.hpp @@ -0,0 +1,61 @@ +// Copyright (c) FIRST and other WPILib contributors. +// Open Source Software; you can modify and/or share it under the terms of +// the WPILib BSD license file in the root directory of this project. + +#pragma once + +#include + +#include + +#include "wpi/util/Handle.h" + +namespace wpi::util { +/** + * A move-only C++ wrapper around a WPI handle. + * Will free the handle if FreeFunction is provided + */ +template + requires std::same_as || + std::invocable +class Handle { + public: + Handle() = default; + /*implicit*/ Handle(CType val) : m_handle(val) {} // NOLINT + + Handle(const Handle&) = delete; + Handle& operator=(const Handle&) = delete; + + Handle(Handle&& rhs) : m_handle(rhs.m_handle) { + rhs.m_handle = static_cast(CInvalid); + } + + Handle& operator=(Handle&& rhs) { + if (this != &rhs) { + if constexpr (std::invocable) { + if (m_handle != static_cast(CInvalid)) { + FreeFunction(m_handle); + } + } + } + m_handle = rhs.m_handle; + rhs.m_handle = static_cast(CInvalid); + return *this; + } + + ~Handle() { + if constexpr (std::invocable) { + if (m_handle != static_cast(CInvalid)) { + FreeFunction(m_handle); + } + } + } + + operator CType() const { return m_handle; } // NOLINT + + private: + CType m_handle = static_cast(CInvalid); +}; + +} // namespace wpi::util diff --git a/wpiutil/src/main/native/include/wpi/util/Synchronization.h b/wpiutil/src/main/native/include/wpi/util/Synchronization.h index fa232f70b1..368524da45 100644 --- a/wpiutil/src/main/native/include/wpi/util/Synchronization.h +++ b/wpiutil/src/main/native/include/wpi/util/Synchronization.h @@ -4,15 +4,7 @@ #pragma once -/** - * Generic handle for all WPI handle-based interfaces. - * - * Handle data layout: - * - Bits 0-23: Type-specific - * - Bits 24-30: Type - * - Bit 31: Error - */ -typedef unsigned int WPI_Handle; // NOLINT +#include "wpi/util/Handle.h" /** An event handle. */ typedef WPI_Handle WPI_EventHandle; // NOLINT