16template <
int Size,
int Options,
int MaxRows,
int MaxCols>
24 static std::optional<frc::Matrixd<Size, 1, Options, MaxRows, MaxCols>>
Unpack(
26 constexpr bool isSmall = Size *
sizeof(double) < 256;
28 std::conditional_t<isSmall, wpi::UnpackCallback<double, Size>,
31 rows.
Vec().reserve(Size);
34 .rows = rows.Callback(),
40 auto items = rows.Items();
42 if (items.size() != Size) {
47 for (
int i = 0; i < Size; i++) {
57 std::span<const double> rowsSpan{value.data(),
static_cast<size_t>(Size)};
60 .rows = rows.Callback(),
A callback method that will pack elements when called.
Definition ProtobufCallbacks.h:486
Class for wrapping a nanopb ostream.
Definition Protobuf.h:119
bool Encode(const typename Protobuf< std::remove_cvref_t< T > >::MessageStruct &msg)
Decodes a protobuf.
Definition Protobuf.h:211
A DirectUnpackCallback backed by a std::vector.
Definition ProtobufCallbacks.h:381
std::vector< T > & Vec() noexcept
Gets a reference to the backing vector.
Definition ProtobufCallbacks.h:410
Eigen::Matrix< double, Rows, Cols, Options, MaxRows, MaxCols > Matrixd
Definition EigenCore.h:21
Definition wpimath.npb.h:28
static std::optional< frc::Matrixd< Size, 1, Options, MaxRows, MaxCols > > Unpack(InputStream &stream)
Definition VectorProto.h:24
static bool Pack(OutputStream &stream, const frc::Matrixd< Size, 1, Options, MaxRows, MaxCols > &value)
Definition VectorProto.h:54
Protobuf serialization template.
Definition Protobuf.h:36
struct _wpi_proto_ProtobufVector wpi_proto_ProtobufVector