16template <
int Size,
int Options,
int MaxRows,
int MaxCols>
25 static std::optional<wpi::math::Matrixd<Size, 1, Options, MaxRows, MaxCols>>
27 constexpr bool isSmall = Size *
sizeof(double) < 256;
29 std::conditional_t<isSmall, wpi::util::UnpackCallback<double, Size>,
32 rows.
Vec().reserve(Size);
35 .rows = rows.Callback(),
41 auto items = rows.Items();
43 if (items.size() != Size) {
48 for (
int i = 0; i < Size; i++) {
58 std::span<const double> rowsSpan{value.data(),
static_cast<size_t>(Size)};
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
Eigen::Matrix< double, Rows, Cols, Options, MaxRows, MaxCols > Matrixd
Definition EigenCore.hpp:21
@ Fail
Definition ProtobufCallbacks.hpp:30
Definition CvSource.hpp:15
wpi_proto_ProtobufVector MessageStruct
Definition VectorProto.hpp:19
wpi::util::ProtoOutputStream< wpi::math::Matrixd< Size, 1, Options, MaxRows, MaxCols > > OutputStream
Definition VectorProto.hpp:22
wpi::util::ProtoInputStream< wpi::math::Matrixd< Size, 1, Options, MaxRows, MaxCols > > InputStream
Definition VectorProto.hpp:20
static bool Pack(OutputStream &stream, const wpi::math::Matrixd< Size, 1, Options, MaxRows, MaxCols > &value)
Definition VectorProto.hpp:55
static std::optional< wpi::math::Matrixd< Size, 1, Options, MaxRows, MaxCols > > Unpack(InputStream &stream)
Definition VectorProto.hpp:26
Protobuf serialization template.
Definition Protobuf.hpp:36
struct _wpi_proto_ProtobufVector wpi_proto_ProtobufVector