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

A DirectUnpackCallback backed by a std::vector. More...

#include <wpi/protobuf/ProtobufCallbacks.h>

Inheritance diagram for wpi::StdVectorUnpackCallback< T, N >:
wpi::DirectUnpackCallback< T, std::vector< T >, 1 >

Public Member Functions

 StdVectorUnpackCallback ()
 Constructs a StdVectorUnpackCallback.
 
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.
 
std::vector< T > & Vec () noexcept
 Gets a reference to the backing vector.
 
- Public Member Functions inherited from wpi::DirectUnpackCallback< T, std::vector< T >, 1 >
 DirectUnpackCallback (std::vector< T > &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::StdVectorUnpackCallback< T, N >

A DirectUnpackCallback backed by a std::vector.

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

Template Parameters
Tobject type
Nnumber of expected elements

Constructor & Destructor Documentation

◆ StdVectorUnpackCallback()

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

Constructs a StdVectorUnpackCallback.

Member Function Documentation

◆ Items() [1/2]

template<ProtoCallbackUnpackable T, size_t N = 1>
std::span< const T > wpi::StdVectorUnpackCallback< 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::StdVectorUnpackCallback< T, N >::Items ( )
inlinenoexcept

Gets a span pointing to the storage buffer.

Returns
storage buffer span

◆ Vec()

template<ProtoCallbackUnpackable T, size_t N = 1>
std::vector< T > & wpi::StdVectorUnpackCallback< T, N >::Vec ( )
inlinenoexcept

Gets a reference to the backing vector.

Returns
vector reference

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