WPILibC++ 2024.3.2
|
The DigitalHandleResource class is a way to track handles. More...
#include <hal/handles/DigitalHandleResource.h>
Public Member Functions | |
DigitalHandleResource ()=default | |
DigitalHandleResource (const DigitalHandleResource &)=delete | |
DigitalHandleResource & | operator= (const DigitalHandleResource &)=delete |
std::shared_ptr< TStruct > | Allocate (int16_t index, HAL_HandleEnum enumValue, THandle *handle, int32_t *status) |
int16_t | GetIndex (THandle handle, HAL_HandleEnum enumValue) |
std::shared_ptr< TStruct > | Get (THandle handle, HAL_HandleEnum enumValue) |
void | Free (THandle handle, HAL_HandleEnum enumValue) |
void | ResetHandles () override |
Public Member Functions inherited from hal::HandleBase | |
HandleBase () | |
~HandleBase () | |
HandleBase (const HandleBase &)=delete | |
HandleBase & | operator= (const HandleBase &)=delete |
virtual void | ResetHandles () |
Friends | |
class | DigitalHandleResourceTest |
Additional Inherited Members | |
Static Public Member Functions inherited from hal::HandleBase | |
static void | ResetGlobalHandles () |
Protected Attributes inherited from hal::HandleBase | |
int16_t | m_version |
The DigitalHandleResource class is a way to track handles.
This version allows a limited number of handles that are allocated by index. The enum value is separate, as 2 enum values are allowed per handle Because they are allocated by index, each individual index holds its own mutex, which reduces contention heavily.
THandle | The Handle Type (Must be typedefed from HAL_Handle) |
TStruct | The struct type held by this resource |
size | The number of resources allowed to be allocated |
|
default |
|
delete |
std::shared_ptr< TStruct > hal::DigitalHandleResource< THandle, TStruct, size >::Allocate | ( | int16_t | index, |
HAL_HandleEnum | enumValue, | ||
THandle * | handle, | ||
int32_t * | status | ||
) |
void hal::DigitalHandleResource< THandle, TStruct, size >::Free | ( | THandle | handle, |
HAL_HandleEnum | enumValue | ||
) |
std::shared_ptr< TStruct > hal::DigitalHandleResource< THandle, TStruct, size >::Get | ( | THandle | handle, |
HAL_HandleEnum | enumValue | ||
) |
|
inline |
|
delete |
|
overridevirtual |
Reimplemented from hal::HandleBase.
|
friend |