From: Mikko Rasa Date: Sat, 25 Jan 2025 23:05:52 +0000 (+0200) Subject: Use the override specifier on overridden virtual functions X-Git-Url: https://git.tdb.fi/?a=commitdiff_plain;h=a3d0c94bc23e9f3a5670ee78e40018126c88acd5;p=libs%2Fmath.git Use the override specifier on overridden virtual functions --- diff --git a/source/geometry/compositeshape.h b/source/geometry/compositeshape.h index b620636..0baa579 100644 --- a/source/geometry/compositeshape.h +++ b/source/geometry/compositeshape.h @@ -32,13 +32,13 @@ protected: CompositeShape(const CompositeShape &); CompositeShape &operator=(const CompositeShape &); public: - virtual ~CompositeShape(); + ~CompositeShape() override; - virtual BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const; - virtual bool contains(const LinAl::Vector &) const; - virtual unsigned get_max_ray_intersections() const { return max_isect; } - virtual unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const; - virtual Coverage get_coverage(const BoundingBox &) const; + BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const override; + bool contains(const LinAl::Vector &) const override; + unsigned get_max_ray_intersections() const override { return max_isect; } + unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const override; + Coverage get_coverage(const BoundingBox &) const override; }; template diff --git a/source/geometry/extrudedshape.h b/source/geometry/extrudedshape.h index 21a503a..7fe1ab8 100644 --- a/source/geometry/extrudedshape.h +++ b/source/geometry/extrudedshape.h @@ -24,18 +24,18 @@ public: ExtrudedShape(const Shape &, T); ExtrudedShape(const ExtrudedShape &); ExtrudedShape &operator=(const ExtrudedShape &); - virtual ~ExtrudedShape(); + ~ExtrudedShape() override; - virtual ExtrudedShape *clone() const; + ExtrudedShape *clone() const override; const Shape &get_base() const { return *base; } T get_length() const { return length; } - virtual BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const; - virtual bool contains(const LinAl::Vector &) const; - virtual unsigned get_max_ray_intersections() const; - virtual unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const; - virtual Coverage get_coverage(const BoundingBox &) const; + BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const override; + bool contains(const LinAl::Vector &) const override; + unsigned get_max_ray_intersections() const override; + unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const override; + Coverage get_coverage(const BoundingBox &) const override; }; template diff --git a/source/geometry/halfspace.h b/source/geometry/halfspace.h index 9fdcdad..5271bd6 100644 --- a/source/geometry/halfspace.h +++ b/source/geometry/halfspace.h @@ -20,15 +20,15 @@ public: HalfSpace(); HalfSpace(const LinAl::Vector &); - virtual HalfSpace *clone() const; + HalfSpace *clone() const override; const LinAl::Vector &get_normal() const { return normal; } - virtual BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const; - virtual bool contains(const LinAl::Vector &) const; - virtual unsigned get_max_ray_intersections() const { return 1; } - virtual unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const; - virtual Coverage get_coverage(const BoundingBox &) const; + BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const override; + bool contains(const LinAl::Vector &) const override; + unsigned get_max_ray_intersections() const override { return 1; } + unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const override; + Coverage get_coverage(const BoundingBox &) const override; }; template diff --git a/source/geometry/hyperbox.h b/source/geometry/hyperbox.h index e3236e8..1743251 100644 --- a/source/geometry/hyperbox.h +++ b/source/geometry/hyperbox.h @@ -24,16 +24,16 @@ public: HyperBox(); explicit HyperBox(const LinAl::Vector &); - virtual HyperBox *clone() const; + HyperBox *clone() const override; const LinAl::Vector &get_dimensions() const { return dimensions; } T get_dimension(unsigned) const; - virtual BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const; - virtual bool contains(const LinAl::Vector &) const; - virtual unsigned get_max_ray_intersections() const { return 2; } - virtual unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const; - virtual Coverage get_coverage(const BoundingBox &) const; + BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const override; + bool contains(const LinAl::Vector &) const override; + unsigned get_max_ray_intersections() const override { return 2; } + unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const override; + Coverage get_coverage(const BoundingBox &) const override; }; template diff --git a/source/geometry/hypersphere.h b/source/geometry/hypersphere.h index 0b327cf..94ccae9 100644 --- a/source/geometry/hypersphere.h +++ b/source/geometry/hypersphere.h @@ -23,15 +23,15 @@ public: HyperSphere() = default; explicit HyperSphere(T); - virtual HyperSphere *clone() const; + HyperSphere *clone() const override; T get_radius() const { return radius; } - virtual BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const; - virtual bool contains(const LinAl::Vector &) const; - virtual unsigned get_max_ray_intersections() const { return 2; } - virtual unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const; - virtual Coverage get_coverage(const BoundingBox &) const; + BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const override; + bool contains(const LinAl::Vector &) const override; + unsigned get_max_ray_intersections() const override { return 2; } + unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const override; + Coverage get_coverage(const BoundingBox &) const override; }; template diff --git a/source/geometry/intersection.h b/source/geometry/intersection.h index 9bf3416..6ea0602 100644 --- a/source/geometry/intersection.h +++ b/source/geometry/intersection.h @@ -28,7 +28,7 @@ public: template static Intersection from_iterator_range(const Iter &, const Iter &); - virtual Intersection *clone() const; + Intersection *clone() const override; }; template diff --git a/source/geometry/loader.h b/source/geometry/loader.h index 58ca8a0..c5d7e56 100644 --- a/source/geometry/loader.h +++ b/source/geometry/loader.h @@ -25,7 +25,7 @@ protected: DimensionIndependentLoader(bool = true); public: - virtual ~DimensionIndependentLoader(); + ~DimensionIndependentLoader() override; const Shape &get_shape() const; diff --git a/source/geometry/negation.h b/source/geometry/negation.h index 231a610..4947bbf 100644 --- a/source/geometry/negation.h +++ b/source/geometry/negation.h @@ -22,15 +22,15 @@ public: Negation &operator=(const Negation &); ~Negation(); - virtual Negation *clone() const; + Negation *clone() const override; const Shape &get_shape() const { return *shape; } - virtual BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const; - virtual bool contains(const LinAl::Vector &) const; - virtual unsigned get_max_ray_intersections() const { return shape->get_max_ray_intersections(); } - virtual unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const; - virtual Coverage get_coverage(const BoundingBox &) const; + BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const override; + bool contains(const LinAl::Vector &) const override; + unsigned get_max_ray_intersections() const override { return shape->get_max_ray_intersections(); } + unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const override; + Coverage get_coverage(const BoundingBox &) const override; }; template diff --git a/source/geometry/transformedshape.h b/source/geometry/transformedshape.h index 2c39201..1cab022 100644 --- a/source/geometry/transformedshape.h +++ b/source/geometry/transformedshape.h @@ -24,16 +24,16 @@ public: TransformedShape &operator=(const TransformedShape &); ~TransformedShape(); - virtual TransformedShape *clone() const; + TransformedShape *clone() const override; const Shape &get_shape() const { return *shape; } const AffineTransform &get_transformation() const { return transformation; } - virtual BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const; - virtual bool contains(const LinAl::Vector &) const; - virtual unsigned get_max_ray_intersections() const { return shape->get_max_ray_intersections(); } - virtual unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const; - virtual Coverage get_coverage(const BoundingBox &) const; + BoundingBox get_axis_aligned_bounding_box(unsigned = 0) const override; + bool contains(const LinAl::Vector &) const override; + unsigned get_max_ray_intersections() const override { return shape->get_max_ray_intersections(); } + unsigned get_intersections(const Ray &, SurfacePoint *, unsigned) const override; + Coverage get_coverage(const BoundingBox &) const override; }; template diff --git a/source/geometry/union.h b/source/geometry/union.h index 0a2de4f..7d77ed1 100644 --- a/source/geometry/union.h +++ b/source/geometry/union.h @@ -28,7 +28,7 @@ public: template static Union from_iterator_range(const Iter &, const Iter &); - virtual Union *clone() const; + Union *clone() const override; }; template