SCRIPT: wpiformat

This commit is contained in:
PJ Reiniger
2025-11-07 20:01:58 -05:00
committed by Peter Johnson
parent ae6bdc9d25
commit 2109161534
749 changed files with 5504 additions and 3936 deletions

View File

@@ -65,8 +65,8 @@ enum WPI_PixelFormat {
*/
enum WPI_TimestampSource {
WPI_TIMESRC_UNKNOWN = 0, // unknown
WPI_TIMESRC_FRAME_DEQUEUE, // wpi::util::Now when the new frame was dequeued by
// CSCore. Does not account for camera exposure
WPI_TIMESRC_FRAME_DEQUEUE, // wpi::util::Now when the new frame was dequeued
// by CSCore. Does not account for camera exposure
// time or V4L latency.
WPI_TIMESRC_V4L_EOF, // End of Frame. Same as V4L2_BUF_FLAG_TSTAMP_SRC_EOF,
// translated into wpi::util::Now's timebase.

View File

@@ -89,7 +89,8 @@ constexpr const T&& get(const wpi::util::array<T, N>&& arr) noexcept {
namespace std { // NOLINT
// Partial specialization for wpi::util::array
template <typename T, size_t N>
struct tuple_size<wpi::util::array<T, N>> : public integral_constant<size_t, N> {};
struct tuple_size<wpi::util::array<T, N>>
: public integral_constant<size_t, N> {};
// Partial specialization for wpi::util::array
template <size_t I, typename T, size_t N>

View File

@@ -161,7 +161,7 @@ class JStringRef {
}
} else {
wpi::util::print(stderr, "JStringRef was passed a null pointer at\n",
GetJavaStackTrace(env));
GetJavaStackTrace(env));
}
// Ensure str is null-terminated.
m_str.push_back('\0');
@@ -285,7 +285,7 @@ class JSpanBase {
bb ? env->GetDirectBufferAddress(bb) : nullptr)} {
if (!bb) {
wpi::util::print(stderr, "JSpan was passed a null pointer at\n",
GetJavaStackTrace(env));
GetJavaStackTrace(env));
}
}
@@ -304,7 +304,7 @@ class JSpanBase {
}
} else {
wpi::util::print(stderr, "JSpan was passed a null pointer at\n",
GetJavaStackTrace(env));
GetJavaStackTrace(env));
}
}

View File

@@ -232,9 +232,9 @@ class ProtoOutputStream {
* values into a nanopb Stream and deserialization consists of
* reading values from nanopb Stream.
*
* Implementations must define a template specialization for wpi::util::Protobuf with
* T being the type that is being serialized/deserialized, with the following
* static members (as enforced by this concept):
* Implementations must define a template specialization for wpi::util::Protobuf
* with T being the type that is being serialized/deserialized, with the
* following static members (as enforced by this concept):
* - using MessageStruct = nanopb_message_struct_here: typedef to the wpilib
* modified nanopb message struct
* - std::optional<T> Unpack(wpi::util::ProtoInputStream<T>&): function
@@ -250,7 +250,8 @@ class ProtoOutputStream {
template <typename T>
concept ProtobufSerializable = requires(
wpi::util::ProtoOutputStream<std::remove_cvref_t<T>>& ostream,
wpi::util::ProtoInputStream<std::remove_cvref_t<T>>& istream, const T& value) {
wpi::util::ProtoInputStream<std::remove_cvref_t<T>>& istream,
const T& value) {
typename Protobuf<typename std::remove_cvref_t<T>>;
{
Protobuf<typename std::remove_cvref_t<T>>::Unpack(istream)
@@ -275,8 +276,8 @@ concept ProtobufSerializable = requires(
*
* In addition to meeting ProtobufSerializable, implementations must define a
* wpi::util::Protobuf<T> static member -
* `bool UnpackInto(T*, wpi::util::ProtoInputStream<T>&)` to update the pointed-to T
* with the contents of the message.
* `bool UnpackInto(T*, wpi::util::ProtoInputStream<T>&)` to update the
* pointed-to T with the contents of the message.
*/
template <typename T>
concept MutableProtobufSerializable =

View File

@@ -338,7 +338,8 @@ class UnpackCallback
* Constructs an UnpackCallback.
*/
UnpackCallback()
: DirectUnpackCallback<T, wpi::util::SmallVector<T, N>, N>{m_storedBuffer} {
: DirectUnpackCallback<T, wpi::util::SmallVector<T, N>, N>{
m_storedBuffer} {
this->SetLimits(DecodeLimits::Ignore);
}

View File

@@ -277,7 +277,8 @@ class SendableBuilder {
*/
virtual void AddSmallStringProperty(
std::string_view key,
std::function<std::string_view(wpi::util::SmallVectorImpl<char>& buf)> getter,
std::function<std::string_view(wpi::util::SmallVectorImpl<char>& buf)>
getter,
std::function<void(std::string_view)> setter) = 0;
/**
@@ -316,7 +317,8 @@ class SendableBuilder {
*/
virtual void AddSmallFloatArrayProperty(
std::string_view key,
std::function<std::span<const float>(wpi::util::SmallVectorImpl<float>& buf)>
std::function<
std::span<const float>(wpi::util::SmallVectorImpl<float>& buf)>
getter,
std::function<void(std::span<const float>)> setter) = 0;
@@ -329,7 +331,8 @@ class SendableBuilder {
*/
virtual void AddSmallDoubleArrayProperty(
std::string_view key,
std::function<std::span<const double>(wpi::util::SmallVectorImpl<double>& buf)>
std::function<
std::span<const double>(wpi::util::SmallVectorImpl<double>& buf)>
getter,
std::function<void(std::span<const double>)> setter) = 0;
@@ -342,8 +345,8 @@ class SendableBuilder {
*/
virtual void AddSmallStringArrayProperty(
std::string_view key,
std::function<
std::span<const std::string>(wpi::util::SmallVectorImpl<std::string>& buf)>
std::function<std::span<const std::string>(
wpi::util::SmallVectorImpl<std::string>& buf)>
getter,
std::function<void(std::span<const std::string>)> setter) = 0;
@@ -357,7 +360,8 @@ class SendableBuilder {
*/
virtual void AddSmallRawProperty(
std::string_view key, std::string_view typeString,
std::function<std::span<uint8_t>(wpi::util::SmallVectorImpl<uint8_t>& buf)>
std::function<
std::span<uint8_t>(wpi::util::SmallVectorImpl<uint8_t>& buf)>
getter,
std::function<void(std::span<const uint8_t>)> setter) = 0;

View File

@@ -120,7 +120,8 @@ class static_circular_buffer {
* Returns const end iterator.
*/
constexpr const_iterator end() const {
return const_iterator(this, ::wpi::util::static_circular_buffer<T, N>::size());
return const_iterator(this,
::wpi::util::static_circular_buffer<T, N>::size());
}
/**
@@ -132,7 +133,8 @@ class static_circular_buffer {
* Returns const end iterator.
*/
constexpr const_iterator cend() const {
return const_iterator(this, ::wpi::util::static_circular_buffer<T, N>::size());
return const_iterator(this,
::wpi::util::static_circular_buffer<T, N>::size());
}
/**

View File

@@ -47,9 +47,9 @@ struct Struct {};
* values into a mutable std::span and deserialization consists of reading
* values from an immutable std::span.
*
* Implementations must define a template specialization for wpi::util::Struct with
* T being the type that is being serialized/deserialized, with the following
* static members (as enforced by this concept):
* Implementations must define a template specialization for wpi::util::Struct
* with T being the type that is being serialized/deserialized, with the
* following static members (as enforced by this concept):
* - std::string_view GetTypeName(): function that returns the type name
* - size_t GetSize(): function that returns the structure size in bytes
* - std::string_view GetSchema(): function that returns the struct schema
@@ -96,8 +96,8 @@ concept StructSerializable = requires(std::span<const uint8_t> in,
* Specifies that a type is capable of in-place raw struct deserialization.
*
* In addition to meeting StructSerializable, implementations must define a
* wpi::util::Struct<T> static member `void UnpackInto(T*, std::span<const uint8_t>)`
* to update the pointed-to T with the contents of the span.
* wpi::util::Struct<T> static member `void UnpackInto(T*, std::span<const
* uint8_t>)` to update the pointed-to T with the contents of the span.
*/
template <typename T, typename... I>
concept MutableStructSerializable =