Skip to main content
Pigweed's logo Pigweed
code_xml
  1. Home
  2. Reference
  3. C/C++
  4. Comms
  5. pw_transfer
  6. pw::transfer::TransferResource Class Reference
Loading...
Searching...
No Matches
pw::transfer::TransferResource Class Reference

Overview

A RAII handle for a registered transfer handler. The handler is closed and deallocated when this object goes out of scope.

Public Member Functions

 TransferResource ()=default
 Creates an invalid handle.
 
 TransferResource (TransferHandlerAllocator &allocator, uint32_t resource_id)
 
 TransferResource (TransferResource &&other) noexcept
 
TransferResource & operator= (TransferResource &&other) noexcept
 
uint32_t resource_id () const
 
 operator bool () const
 
void Close ()
 Unregisters and deallocates the handler if this is a valid handle.
 

Constructor & Destructor Documentation

◆ TransferResource()

pw::transfer::TransferResource::TransferResource ( TransferHandlerAllocator &  allocator,
uint32_t  resource_id 
)
inline

Constructs a TransferResource owned by allocator for resource_id.

Parameters
[in]allocatorThe TransferHandlerAllocator managing this resource.
[in]resource_idAssigned non-zero resource ID.

Member Function Documentation

◆ operator bool()

pw::transfer::TransferResource::operator bool ( ) const
inlineexplicit

Checks whether this handle refers to an active registered resource.

Returns
true if this handle is valid, false otherwise.

◆ resource_id()

uint32_t pw::transfer::TransferResource::resource_id ( ) const
inline

Returns the resource ID associated with this handle, or 0 if invalid.

Returns
The assigned resource ID, or 0 if this handle is invalid.

The documentation for this class was generated from the following file: