mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-28 02:11:43 +00:00
[wpimath] Mark all geometry classes as final (#8790)
In Java, these are likely to become value classes in the future. Make C++ final for consistency.
This commit is contained in:
@@ -15,7 +15,7 @@ namespace wpi::math {
|
||||
* A class representing a coordinate system axis within the NWU coordinate
|
||||
* system.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT CoordinateAxis {
|
||||
class WPILIB_DLLEXPORT CoordinateAxis final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a coordinate system axis within the NWU coordinate system and
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace wpi::math {
|
||||
* A helper class that converts Pose3d objects between different standard
|
||||
* coordinate frames.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT CoordinateSystem {
|
||||
class WPILIB_DLLEXPORT CoordinateSystem final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a coordinate system with the given cardinal directions for each
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace wpi::math {
|
||||
* Represents a 2d ellipse space containing translational, rotational, and
|
||||
* scaling components.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Ellipse2d {
|
||||
class WPILIB_DLLEXPORT Ellipse2d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs an ellipse around a center point and two semi-axes, a horizontal
|
||||
|
||||
@@ -27,7 +27,7 @@ class Transform2d;
|
||||
/**
|
||||
* Represents a 2D pose containing translational and rotational elements.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Pose2d {
|
||||
class WPILIB_DLLEXPORT Pose2d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a pose at the origin facing toward the positive X axis.
|
||||
|
||||
@@ -28,7 +28,7 @@ class Transform3d;
|
||||
/**
|
||||
* Represents a 3D pose containing translational and rotational elements.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Pose3d {
|
||||
class WPILIB_DLLEXPORT Pose3d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a pose at the origin facing toward the positive X axis.
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace wpi::math {
|
||||
/**
|
||||
* Represents a quaternion.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Quaternion {
|
||||
class WPILIB_DLLEXPORT Quaternion final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a quaternion with a default angle of 0 degrees.
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace wpi::math {
|
||||
* Represents a 2d rectangular space containing translational, rotational, and
|
||||
* scaling components.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Rectangle2d {
|
||||
class WPILIB_DLLEXPORT Rectangle2d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a rectangle at the specified position with the specified width
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace wpi::math {
|
||||
* A rotation in a 2D coordinate frame represented by a point on the unit circle
|
||||
* (cosine and sine).
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Rotation2d {
|
||||
class WPILIB_DLLEXPORT Rotation2d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a Rotation2d with a default angle of 0 degrees.
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace wpi::math {
|
||||
* neat property is that applying a series of rotations extrinsically is the
|
||||
* same as applying the same series in the opposite order intrinsically.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Rotation3d {
|
||||
class WPILIB_DLLEXPORT Rotation3d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a Rotation3d representing no rotation.
|
||||
|
||||
@@ -18,7 +18,7 @@ struct Twist2d;
|
||||
/**
|
||||
* Represents a transformation for a Pose2d in the pose's frame.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Transform2d {
|
||||
class WPILIB_DLLEXPORT Transform2d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs the transform that maps the initial pose to the final pose.
|
||||
|
||||
@@ -20,7 +20,7 @@ struct Twist3d;
|
||||
* applied before rotation. (The translation is applied in the pose's original
|
||||
* frame, not the transformed frame.)
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Transform3d {
|
||||
class WPILIB_DLLEXPORT Transform3d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs the transform that maps the initial pose to the final pose.
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace wpi::math {
|
||||
* When the robot is at the origin facing in the positive X direction, forward
|
||||
* is positive X and left is positive Y.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Translation2d {
|
||||
class WPILIB_DLLEXPORT Translation2d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a Translation2d with X and Y components equal to zero.
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace wpi::math {
|
||||
* robot is at the origin facing in the positive X direction, forward is
|
||||
* positive X, left is positive Y, and up is positive Z.
|
||||
*/
|
||||
class WPILIB_DLLEXPORT Translation3d {
|
||||
class WPILIB_DLLEXPORT Translation3d final {
|
||||
public:
|
||||
/**
|
||||
* Constructs a Translation3d with X, Y, and Z components equal to zero.
|
||||
|
||||
@@ -20,7 +20,7 @@ class Transform2d;
|
||||
*
|
||||
* A Twist can be used to represent a difference between two poses.
|
||||
*/
|
||||
struct WPILIB_DLLEXPORT Twist2d {
|
||||
struct WPILIB_DLLEXPORT Twist2d final {
|
||||
/**
|
||||
* Linear "dx" component
|
||||
*/
|
||||
|
||||
@@ -20,7 +20,7 @@ class Transform3d;
|
||||
*
|
||||
* A Twist can be used to represent a difference between two poses.
|
||||
*/
|
||||
struct WPILIB_DLLEXPORT Twist3d {
|
||||
struct WPILIB_DLLEXPORT Twist3d final {
|
||||
/**
|
||||
* Linear "dx" component
|
||||
*/
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry2d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Ellipse2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Ellipse2d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufEllipse2d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Ellipse2d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Ellipse2d>;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "wpimath/protobuf/geometry2d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Pose2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Pose2d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufPose2d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Pose2d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Pose2d>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry3d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Pose3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Pose3d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufPose3d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Pose3d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Pose3d>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry3d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Quaternion> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Quaternion> final {
|
||||
using MessageStruct = wpi_proto_ProtobufQuaternion;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Quaternion>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Quaternion>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry2d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Rectangle2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Rectangle2d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufRectangle2d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Rectangle2d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Rectangle2d>;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "wpimath/protobuf/geometry2d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Rotation2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Rotation2d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufRotation2d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Rotation2d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Rotation2d>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry3d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Rotation3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Rotation3d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufRotation3d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Rotation3d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Rotation3d>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry2d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Transform2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Transform2d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufTransform2d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Transform2d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Transform2d>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry3d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Transform3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Transform3d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufTransform3d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Transform3d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Transform3d>;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "wpimath/protobuf/geometry2d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Translation2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Translation2d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufTranslation2d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Translation2d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Translation2d>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry3d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Translation3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Translation3d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufTranslation3d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Translation3d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Translation3d>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry2d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Twist2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Twist2d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufTwist2d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Twist2d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Twist2d>;
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "wpimath/protobuf/geometry3d.npb.h"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Twist3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Protobuf<wpi::math::Twist3d> final {
|
||||
using MessageStruct = wpi_proto_ProtobufTwist3d;
|
||||
using InputStream = wpi::util::ProtoInputStream<wpi::math::Twist3d>;
|
||||
using OutputStream = wpi::util::ProtoOutputStream<wpi::math::Twist3d>;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Ellipse2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Ellipse2d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Ellipse2d"; }
|
||||
static constexpr size_t GetSize() {
|
||||
return wpi::util::GetStructSize<wpi::math::Pose2d>() + 16;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Pose2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Pose2d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Pose2d"; }
|
||||
static constexpr size_t GetSize() {
|
||||
return wpi::util::GetStructSize<wpi::math::Translation2d>() +
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Pose3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Pose3d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Pose3d"; }
|
||||
static constexpr size_t GetSize() {
|
||||
return wpi::util::GetStructSize<wpi::math::Translation3d>() +
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Quaternion> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Quaternion> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Quaternion"; }
|
||||
static constexpr size_t GetSize() { return 32; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Rectangle2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Rectangle2d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Rectangle2d"; }
|
||||
static constexpr size_t GetSize() {
|
||||
return wpi::util::GetStructSize<wpi::math::Pose2d>() + 16;
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Rotation2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Rotation2d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Rotation2d"; }
|
||||
static constexpr size_t GetSize() { return 8; }
|
||||
static constexpr std::string_view GetSchema() { return "double value"; }
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Rotation3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Rotation3d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Rotation3d"; }
|
||||
static constexpr size_t GetSize() {
|
||||
return wpi::util::GetStructSize<wpi::math::Quaternion>();
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Transform2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Transform2d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Transform2d"; }
|
||||
static constexpr size_t GetSize() {
|
||||
return wpi::util::GetStructSize<wpi::math::Translation2d>() +
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Transform3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Transform3d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Transform3d"; }
|
||||
static constexpr size_t GetSize() {
|
||||
return wpi::util::GetStructSize<wpi::math::Translation3d>() +
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Translation2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Translation2d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Translation2d"; }
|
||||
static constexpr size_t GetSize() { return 16; }
|
||||
static constexpr std::string_view GetSchema() { return "double x;double y"; }
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Translation3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Translation3d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Translation3d"; }
|
||||
static constexpr size_t GetSize() { return 24; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Twist2d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Twist2d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Twist2d"; }
|
||||
static constexpr size_t GetSize() { return 24; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "wpi/util/struct/Struct.hpp"
|
||||
|
||||
template <>
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Twist3d> {
|
||||
struct WPILIB_DLLEXPORT wpi::util::Struct<wpi::math::Twist3d> final {
|
||||
static constexpr std::string_view GetTypeName() { return "Twist3d"; }
|
||||
static constexpr size_t GetSize() { return 48; }
|
||||
static constexpr std::string_view GetSchema() {
|
||||
|
||||
Reference in New Issue
Block a user