16template <
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
29 constexpr bool isSmall = Rows * Cols *
sizeof(double) < 256;
30 using UnpackType = std::conditional_t<
34 data.
Vec().reserve(Rows * Cols);
37 msg.
data = data.Callback();
46 auto items = data.Items();
48 if (items.size() != Rows * Cols) {
53 for (
int i = 0; i < Rows * Cols; i++) {
63 std::span<const double> dataSpan{value.data(),
64 static_cast<size_t>(Rows * Cols)};
A callback method that will pack elements when called.
Definition ProtobufCallbacks.hpp:487
pb_callback_t Callback() const
Gets the nanopb callback pointing to this object.
Definition ProtobufCallbacks.hpp:519
Class for wrapping a nanopb ostream.
Definition Protobuf.hpp:119
bool Encode(const typename Protobuf< std::remove_cvref_t< T > >::MessageStruct &msg)
Decodes a protobuf.
Definition Protobuf.hpp:211
A DirectUnpackCallback backed by a std::vector.
Definition ProtobufCallbacks.hpp:382
std::vector< T > & Vec() noexcept
Gets a reference to the backing vector.
Definition ProtobufCallbacks.hpp:411
A DirectUnpackCallback backed by a SmallVector<T, N>.
Definition ProtobufCallbacks.hpp:335
Eigen::Matrix< double, Rows, Cols, Options, MaxRows, MaxCols > Matrixd
Definition EigenCore.hpp:21
@ Fail
Definition ProtobufCallbacks.hpp:30
uint32_t num_rows
Definition wpimath.npb.h:23
pb_callback_t data
Definition wpimath.npb.h:25
uint32_t num_cols
Definition wpimath.npb.h:24
wpi_proto_ProtobufMatrix MessageStruct
Definition MatrixProto.hpp:20
wpi::util::ProtoInputStream< wpi::math::Matrixd< Rows, Cols, Options, MaxRows, MaxCols > > InputStream
Definition MatrixProto.hpp:21
wpi::util::ProtoOutputStream< wpi::math::Matrixd< Rows, Cols, Options, MaxRows, MaxCols > > OutputStream
Definition MatrixProto.hpp:23
static bool Pack(OutputStream &stream, const wpi::math::Matrixd< Rows, Cols, Options, MaxRows, MaxCols > &value)
Definition MatrixProto.hpp:60
static std::optional< wpi::math::Matrixd< Rows, Cols, Options, MaxRows, MaxCols > > Unpack(InputStream &stream)
Definition MatrixProto.hpp:28
Protobuf serialization template.
Definition Protobuf.hpp:36
struct _wpi_proto_ProtobufMatrix wpi_proto_ProtobufMatrix