WPILibC++ 2025.1.1
Loading...
Searching...
No Matches
wpi::UnpackCallback< T, N > Class Template Reference

A DirectUnpackCallback backed by a SmallVector<T, N>. More...

#include <wpi/protobuf/ProtobufCallbacks.h>

Inheritance diagram for wpi::UnpackCallback< T, N >:
wpi::DirectUnpackCallback< T, wpi::SmallVector< T, 1 >, 1 >

Public Member Functions

 UnpackCallback ()
 Constructs an UnpackCallback.
 
std::span< T > Items () noexcept
 Gets a span pointing to the storage buffer.
 
std::span< const T > Items () const noexcept
 Gets a const span pointing to the storage buffer.
 
wpi::SmallVector< T, N > & Vec () noexcept
 Gets a reference to the backing small vector.
 
- Public Member Functions inherited from wpi::DirectUnpackCallback< T, wpi::SmallVector< T, 1 >, 1 >
 DirectUnpackCallback (wpi::SmallVector< T, 1 > &storage)
 Constructs a callback from a vector like type.
 
 DirectUnpackCallback (const DirectUnpackCallback &)=delete
 
 DirectUnpackCallback (DirectUnpackCallback &&)=delete
 
DirectUnpackCallbackoperator= (const DirectUnpackCallback &)=delete
 
DirectUnpackCallbackoperator= (DirectUnpackCallback &&)=delete
 
void SetLimits (DecodeLimits limit) noexcept
 Set the limits on what happens if more elements exist in the buffer then expected.
 
pb_callback_t Callback () const
 Gets the nanopb callback pointing to this object.
 

Detailed Description

template<ProtoCallbackUnpackable T, size_t N = 1>
class wpi::UnpackCallback< T, N >

A DirectUnpackCallback backed by a SmallVector<T, N>.

By default, any elements in the packed buffer past N will be ignored, but decoding will still succeed

Template Parameters
Tobject type
Nsmall vector small size/number of expected elements

Constructor & Destructor Documentation

◆ UnpackCallback()

template<ProtoCallbackUnpackable T, size_t N = 1>
wpi::UnpackCallback< T, N >::UnpackCallback ( )
inline

Constructs an UnpackCallback.

Member Function Documentation

◆ Items() [1/2]

template<ProtoCallbackUnpackable T, size_t N = 1>
std::span< const T > wpi::UnpackCallback< T, N >::Items ( ) const
inlinenoexcept

Gets a const span pointing to the storage buffer.

Returns
storage buffer span

◆ Items() [2/2]

template<ProtoCallbackUnpackable T, size_t N = 1>
std::span< T > wpi::UnpackCallback< T, N >::Items ( )
inlinenoexcept

Gets a span pointing to the storage buffer.

Returns
storage buffer span

◆ Vec()

template<ProtoCallbackUnpackable T, size_t N = 1>
wpi::SmallVector< T, N > & wpi::UnpackCallback< T, N >::Vec ( )
inlinenoexcept

Gets a reference to the backing small vector.

Returns
small vector reference

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