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

Class for wrapping a nanopb istream. More...

#include <wpi/protobuf/Protobuf.h>

Public Member Functions

 ProtoInputStream (pb_istream_t *stream)
 Constructs a nanopb istream from an existing istream object.
 
 ProtoInputStream (std::span< const uint8_t > stream)
 Constructs a nanopb istream from a buffer.
 
pb_istream_tStream () noexcept
 Gets the backing nanopb stream object.
 
const pb_msgdesc_tMsgDesc () const noexcept
 Gets the nanopb message descriptor.
 
bool Decode (typename Protobuf< std::remove_cvref_t< T > >::MessageStruct &msg, unsigned int flags=0)
 Decodes a protobuf.
 

Detailed Description

template<typename T>
class wpi::ProtoInputStream< T >

Class for wrapping a nanopb istream.

Constructor & Destructor Documentation

◆ ProtoInputStream() [1/2]

template<typename T >
wpi::ProtoInputStream< T >::ProtoInputStream ( pb_istream_t * stream)
inlineexplicit

Constructs a nanopb istream from an existing istream object.

Generally used internally for decoding submessages

Parameters
[in]streamthe nanopb istream

◆ ProtoInputStream() [2/2]

template<typename T >
wpi::ProtoInputStream< T >::ProtoInputStream ( std::span< const uint8_t > stream)
inlineexplicit

Constructs a nanopb istream from a buffer.

Parameters
[in]streamthe stream buffer

Member Function Documentation

◆ Decode()

template<typename T >
bool wpi::ProtoInputStream< T >::Decode ( typename Protobuf< std::remove_cvref_t< T > >::MessageStruct & msg,
unsigned int flags = 0 )
inline

Decodes a protobuf.

Flags are the same flags passed to pb_decode_ex.

Parameters
[in]msgThe message to decode into
[in]flagsFlags to pass
Returns
true if decoding was successful, false otherwise

◆ MsgDesc()

template<typename T >
const pb_msgdesc_t * wpi::ProtoInputStream< T >::MsgDesc ( ) const
inlinenoexcept

Gets the nanopb message descriptor.

Returns
the nanopb message descriptor

◆ Stream()

template<typename T >
pb_istream_t * wpi::ProtoInputStream< T >::Stream ( )
inlinenoexcept

Gets the backing nanopb stream object.

Returns
nanopb stream

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