]> git.tdb.fi Git - libs/math.git/commitdiff
Use the override specifier on overridden virtual functions
authorMikko Rasa <tdb@tdb.fi>
Sat, 25 Jan 2025 23:05:52 +0000 (01:05 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sat, 25 Jan 2025 23:05:52 +0000 (01:05 +0200)
source/geometry/compositeshape.h
source/geometry/extrudedshape.h
source/geometry/halfspace.h
source/geometry/hyperbox.h
source/geometry/hypersphere.h
source/geometry/intersection.h
source/geometry/loader.h
source/geometry/negation.h
source/geometry/transformedshape.h
source/geometry/union.h

index b6206369ceece8afc549d1aea37f80d81e1e6f09..0baa57919889ccabd28e87a66bd4986daf1cf7f8 100644 (file)
@@ -32,13 +32,13 @@ protected:
        CompositeShape(const CompositeShape &);
        CompositeShape &operator=(const CompositeShape &);
 public:
-       virtual ~CompositeShape();
+       ~CompositeShape() override;
 
-       virtual BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const;
-       virtual bool contains(const LinAl::Vector<T, D> &) const;
-       virtual unsigned get_max_ray_intersections() const { return max_isect; }
-       virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const;
-       virtual Coverage get_coverage(const BoundingBox<T, D> &) const;
+       BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const override;
+       bool contains(const LinAl::Vector<T, D> &) const override;
+       unsigned get_max_ray_intersections() const override { return max_isect; }
+       unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const override;
+       Coverage get_coverage(const BoundingBox<T, D> &) const override;
 };
 
 template<typename T, unsigned D, typename O>
index 21a503a468bb11fffaf6734ad1ff4c08b1d05007..7fe1ab858143daa0265187686f27a98e4f1be827 100644 (file)
@@ -24,18 +24,18 @@ public:
        ExtrudedShape(const Shape<T, D-1> &, T);
        ExtrudedShape(const ExtrudedShape &);
        ExtrudedShape &operator=(const ExtrudedShape &);
-       virtual ~ExtrudedShape();
+       ~ExtrudedShape() override;
 
-       virtual ExtrudedShape *clone() const;
+       ExtrudedShape *clone() const override;
 
        const Shape<T, D-1> &get_base() const { return *base; }
        T get_length() const { return length; }
 
-       virtual BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const;
-       virtual bool contains(const LinAl::Vector<T, D> &) const;
-       virtual unsigned get_max_ray_intersections() const;
-       virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const;
-       virtual Coverage get_coverage(const BoundingBox<T, D> &) const;
+       BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const override;
+       bool contains(const LinAl::Vector<T, D> &) const override;
+       unsigned get_max_ray_intersections() const override;
+       unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const override;
+       Coverage get_coverage(const BoundingBox<T, D> &) const override;
 };
 
 template<typename T, unsigned D>
index 9fdcdadfbd02b0dec41ef88c3e97539013cf2cbd..5271bd683fba434c3c7b7f3ffe57867d730f59d0 100644 (file)
@@ -20,15 +20,15 @@ public:
        HalfSpace();
        HalfSpace(const LinAl::Vector<T, D> &);
 
-       virtual HalfSpace *clone() const;
+       HalfSpace *clone() const override;
 
        const LinAl::Vector<T, D> &get_normal() const { return normal; }
 
-       virtual BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const;
-       virtual bool contains(const LinAl::Vector<T, D> &) const;
-       virtual unsigned get_max_ray_intersections() const { return 1; }
-       virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const;
-       virtual Coverage get_coverage(const BoundingBox<T, D> &) const;
+       BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const override;
+       bool contains(const LinAl::Vector<T, D> &) const override;
+       unsigned get_max_ray_intersections() const override { return 1; }
+       unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const override;
+       Coverage get_coverage(const BoundingBox<T, D> &) const override;
 };
 
 template<typename T, unsigned D>
index e3236e8cfaf03d69877fdfe94f7a75dc8e9f811e..1743251c5e6e445a791017cea52cb601dc8788ab 100644 (file)
@@ -24,16 +24,16 @@ public:
        HyperBox();
        explicit HyperBox(const LinAl::Vector<T, D> &);
 
-       virtual HyperBox *clone() const;
+       HyperBox *clone() const override;
 
        const LinAl::Vector<T, D> &get_dimensions() const { return dimensions; }
        T get_dimension(unsigned) const;
 
-       virtual BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const;
-       virtual bool contains(const LinAl::Vector<T, D> &) const;
-       virtual unsigned get_max_ray_intersections() const { return 2; }
-       virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const;
-       virtual Coverage get_coverage(const BoundingBox<T, D> &) const;
+       BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const override;
+       bool contains(const LinAl::Vector<T, D> &) const override;
+       unsigned get_max_ray_intersections() const override { return 2; }
+       unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const override;
+       Coverage get_coverage(const BoundingBox<T, D> &) const override;
 };
 
 template<typename T, unsigned D>
index 0b327cf7be4f513835405ba60806a635925c6551..94ccae9b83c7eb767e74140c65ac4ab50beba7c3 100644 (file)
@@ -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<T, D> get_axis_aligned_bounding_box(unsigned = 0) const;
-       virtual bool contains(const LinAl::Vector<T, D> &) const;
-       virtual unsigned get_max_ray_intersections() const { return 2; }
-       virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const;
-       virtual Coverage get_coverage(const BoundingBox<T, D> &) const;
+       BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const override;
+       bool contains(const LinAl::Vector<T, D> &) const override;
+       unsigned get_max_ray_intersections() const override { return 2; }
+       unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const override;
+       Coverage get_coverage(const BoundingBox<T, D> &) const override;
 };
 
 template<typename T, unsigned D>
index 9bf34165717cbd808c72995e4dba46baabfea261..6ea0602ff336a516206a645b42fee14b84608705 100644 (file)
@@ -28,7 +28,7 @@ public:
        template<typename Iter>
        static Intersection from_iterator_range(const Iter &, const Iter &);
 
-       virtual Intersection *clone() const;
+       Intersection *clone() const override;
 };
 
 template<typename T, unsigned D>
index 58ca8a0026c85f3d6b654e4f9b01b93ef1710a17..c5d7e563324527d65e97c29716a6b5206216d652 100644 (file)
@@ -25,7 +25,7 @@ protected:
 
        DimensionIndependentLoader(bool = true);
 public:
-       virtual ~DimensionIndependentLoader();
+       ~DimensionIndependentLoader() override;
 
        const Shape<T, D> &get_shape() const;
 
index 231a610567db7ac8e190a41672bc00ae40540bd3..4947bbf4415f346c0423165c56de3accc724ed4e 100644 (file)
@@ -22,15 +22,15 @@ public:
        Negation &operator=(const Negation &);
        ~Negation();
 
-       virtual Negation *clone() const;
+       Negation *clone() const override;
 
        const Shape<T, D> &get_shape() const { return *shape; }
 
-       virtual BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const;
-       virtual bool contains(const LinAl::Vector<T, D> &) const;
-       virtual unsigned get_max_ray_intersections() const { return shape->get_max_ray_intersections(); }
-       virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const;
-       virtual Coverage get_coverage(const BoundingBox<T, D> &) const;
+       BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const override;
+       bool contains(const LinAl::Vector<T, D> &) const override;
+       unsigned get_max_ray_intersections() const override { return shape->get_max_ray_intersections(); }
+       unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const override;
+       Coverage get_coverage(const BoundingBox<T, D> &) const override;
 };
 
 template<typename T, unsigned D>
index 2c39201d441f8ecae7d02efbc279b5b0fd9abf28..1cab02266672cfdce60049df0e86f067b427dd8d 100644 (file)
@@ -24,16 +24,16 @@ public:
        TransformedShape &operator=(const TransformedShape &);
        ~TransformedShape();
 
-       virtual TransformedShape *clone() const;
+       TransformedShape *clone() const override;
 
        const Shape<T, D> &get_shape() const { return *shape; }
        const AffineTransform<T, D> &get_transformation() const { return transformation; }
 
-       virtual BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const;
-       virtual bool contains(const LinAl::Vector<T, D> &) const;
-       virtual unsigned get_max_ray_intersections() const { return shape->get_max_ray_intersections(); }
-       virtual unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const;
-       virtual Coverage get_coverage(const BoundingBox<T, D> &) const;
+       BoundingBox<T, D> get_axis_aligned_bounding_box(unsigned = 0) const override;
+       bool contains(const LinAl::Vector<T, D> &) const override;
+       unsigned get_max_ray_intersections() const override { return shape->get_max_ray_intersections(); }
+       unsigned get_intersections(const Ray<T, D> &, SurfacePoint<T, D> *, unsigned) const override;
+       Coverage get_coverage(const BoundingBox<T, D> &) const override;
 };
 
 template<typename T, unsigned D>
index 0a2de4fe6f17a0ba0c86a10e8e9b593b91068371..7d77ed18033dc84ee0dca5acbd5bc7008cc0ca53 100644 (file)
@@ -28,7 +28,7 @@ public:
        template<typename Iter>
        static Union from_iterator_range(const Iter &, const Iter &);
 
-       virtual Union *clone() const;
+       Union *clone() const override;
 };
 
 template<typename T, unsigned D>