From ccac3191fd4fdd6eb3eb43a850131fc5645b6771 Mon Sep 17 00:00:00 2001 From: Russell Owen Date: Fri, 6 Jul 2018 12:57:44 -0700 Subject: [PATCH 1/3] Make Mapping an abstract class remove copyPolymorphic so subclasses must override it. Update functional.cc accordingly. --- include/astshim/Mapping.h | 8 -------- src/functional.cc | 2 +- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/include/astshim/Mapping.h b/include/astshim/Mapping.h index df8d5d9e..372b2c46 100644 --- a/include/astshim/Mapping.h +++ b/include/astshim/Mapping.h @@ -68,9 +68,6 @@ class Mapping : public Object { Mapping &operator=(Mapping const &) = delete; Mapping &operator=(Mapping &&) = default; - /// Return a deep copy of this object. - std::shared_ptr copy() const { return std::static_pointer_cast(copyPolymorphic()); } - /** Get @ref Mapping_NIn "NIn": the number of input axes */ @@ -406,11 +403,6 @@ class Mapping : public Object { } } - // Protected implementation of deep-copy. - virtual std::shared_ptr copyPolymorphic() const override { - return std::static_pointer_cast(copyImpl()); - } - /** Return a deep copy of one of the two component mappings. diff --git a/src/functional.cc b/src/functional.cc index 8baa7690..145927ca 100644 --- a/src/functional.cc +++ b/src/functional.cc @@ -56,7 +56,7 @@ std::shared_ptr makeRadialMapping(std::vector const& center, Ma " outputs, instead of 1"); } auto unitNormMap = UnitNormMap(center); - return std::make_shared( + return std::make_shared( unitNormMap.then(UnitMap(naxes).under(mapping1d)).then(*unitNormMap.getInverse())); } From 280091f3efc4b128babfd6ac7c9bfe1abb330cf6 Mon Sep 17 00:00:00 2001 From: Russell Owen Date: Fri, 6 Jul 2018 13:01:27 -0700 Subject: [PATCH 2/3] Remove `virtual` from methods with `override` since `virtual` is implied. --- include/astshim/Channel.h | 2 +- include/astshim/ChebyMap.h | 2 +- include/astshim/CmpFrame.h | 2 +- include/astshim/CmpMap.h | 2 +- include/astshim/Frame.h | 2 +- include/astshim/FrameDict.h | 2 +- include/astshim/FrameSet.h | 2 +- include/astshim/KeyMap.h | 2 +- include/astshim/LutMap.h | 2 +- include/astshim/MathMap.h | 2 +- include/astshim/MatrixMap.h | 2 +- include/astshim/NormMap.h | 2 +- include/astshim/ParallelMap.h | 2 +- include/astshim/PcdMap.h | 2 +- include/astshim/PermMap.h | 2 +- include/astshim/PolyMap.h | 2 +- include/astshim/RateMap.h | 2 +- include/astshim/SeriesMap.h | 2 +- include/astshim/ShiftMap.h | 2 +- include/astshim/SkyFrame.h | 2 +- include/astshim/SlaMap.h | 2 +- include/astshim/SpecFrame.h | 2 +- include/astshim/SphMap.h | 2 +- include/astshim/TimeFrame.h | 2 +- include/astshim/TimeMap.h | 2 +- include/astshim/TranMap.h | 2 +- include/astshim/UnitMap.h | 2 +- include/astshim/UnitNormMap.h | 2 +- include/astshim/WcsMap.h | 2 +- include/astshim/WinMap.h | 2 +- include/astshim/ZoomMap.h | 2 +- 31 files changed, 31 insertions(+), 31 deletions(-) diff --git a/include/astshim/Channel.h b/include/astshim/Channel.h index c7d27c72..cc1cdae6 100644 --- a/include/astshim/Channel.h +++ b/include/astshim/Channel.h @@ -156,7 +156,7 @@ class Channel : public Object { int write(Object const &object); protected: - virtual std::shared_ptr copyPolymorphic() const override { return std::shared_ptr(); } + std::shared_ptr copyPolymorphic() const override { return std::shared_ptr(); } /** Construct a channel from an AST channel pointer and a @ref Stream diff --git a/include/astshim/ChebyMap.h b/include/astshim/ChebyMap.h index 8ff6cd63..6088991e 100644 --- a/include/astshim/ChebyMap.h +++ b/include/astshim/ChebyMap.h @@ -304,7 +304,7 @@ class ChebyMap : public Mapping { ChebyMap polyTran(bool forward, double acc, double maxacc, int maxorder) const; protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/CmpFrame.h b/include/astshim/CmpFrame.h index 1bcf9c3a..a3ed26f2 100644 --- a/include/astshim/CmpFrame.h +++ b/include/astshim/CmpFrame.h @@ -96,7 +96,7 @@ class CmpFrame : public Frame { std::shared_ptr operator[](int i) const { return decompose(i, false); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/CmpMap.h b/include/astshim/CmpMap.h index fd002e84..ce9dd013 100644 --- a/include/astshim/CmpMap.h +++ b/include/astshim/CmpMap.h @@ -102,7 +102,7 @@ class CmpMap : public Mapping { bool getSeries() { return detail::isSeries(reinterpret_cast(getRawPtr())); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/Frame.h b/include/astshim/Frame.h index 1c596151..713230ab 100644 --- a/include/astshim/Frame.h +++ b/include/astshim/Frame.h @@ -1523,7 +1523,7 @@ class Frame : public Mapping { } } - virtual std::shared_ptr copyPolymorphic() const override { return copyImpl(); } + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } private: /** diff --git a/include/astshim/FrameDict.h b/include/astshim/FrameDict.h index 7d004270..085b8612 100644 --- a/include/astshim/FrameDict.h +++ b/include/astshim/FrameDict.h @@ -254,7 +254,7 @@ class FrameDict : public FrameSet { void setDomain(std::string const &domain) override; protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/FrameSet.h b/include/astshim/FrameSet.h index 02a409a8..e338ae7a 100644 --- a/include/astshim/FrameSet.h +++ b/include/astshim/FrameSet.h @@ -475,7 +475,7 @@ class FrameSet : public Frame { void setCurrent(int ind) { setI("Current", ind); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/KeyMap.h b/include/astshim/KeyMap.h index 55e2af05..d05b4fed 100644 --- a/include/astshim/KeyMap.h +++ b/include/astshim/KeyMap.h @@ -579,7 +579,7 @@ class KeyMap : public Object { protected: // Protected implementation of deep-copy. - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return std::static_pointer_cast(copyImpl()); } diff --git a/include/astshim/LutMap.h b/include/astshim/LutMap.h index 650709aa..633346dd 100644 --- a/include/astshim/LutMap.h +++ b/include/astshim/LutMap.h @@ -98,7 +98,7 @@ class LutMap : public Mapping { int getLutInterp() const { return getI("LutInterp"); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/MathMap.h b/include/astshim/MathMap.h index b79084b3..e698da09 100644 --- a/include/astshim/MathMap.h +++ b/include/astshim/MathMap.h @@ -405,7 +405,7 @@ class MathMap : public Mapping { bool getSimpIF() const { return getB("SimpIF"); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/MatrixMap.h b/include/astshim/MatrixMap.h index 92974ade..4a5a6c20 100644 --- a/include/astshim/MatrixMap.h +++ b/include/astshim/MatrixMap.h @@ -85,7 +85,7 @@ class MatrixMap : public Mapping { std::shared_ptr copy() const { return std::static_pointer_cast(copyPolymorphic()); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/NormMap.h b/include/astshim/NormMap.h index a71e891c..c5053a0c 100644 --- a/include/astshim/NormMap.h +++ b/include/astshim/NormMap.h @@ -74,7 +74,7 @@ class NormMap : public Mapping { std::shared_ptr copy() const { return std::static_pointer_cast(copyPolymorphic()); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/ParallelMap.h b/include/astshim/ParallelMap.h index 5daffc34..ffd0f064 100644 --- a/include/astshim/ParallelMap.h +++ b/include/astshim/ParallelMap.h @@ -83,7 +83,7 @@ class ParallelMap : public CmpMap { } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/PcdMap.h b/include/astshim/PcdMap.h index fd3d723d..26594b87 100644 --- a/include/astshim/PcdMap.h +++ b/include/astshim/PcdMap.h @@ -114,7 +114,7 @@ class PcdMap : public Mapping { } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/PermMap.h b/include/astshim/PermMap.h index be6501b0..5f230ef7 100644 --- a/include/astshim/PermMap.h +++ b/include/astshim/PermMap.h @@ -90,7 +90,7 @@ class PermMap : public Mapping { std::shared_ptr copy() const { return std::static_pointer_cast(copyPolymorphic()); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/PolyMap.h b/include/astshim/PolyMap.h index 4e5f8602..c850e2a2 100644 --- a/include/astshim/PolyMap.h +++ b/include/astshim/PolyMap.h @@ -233,7 +233,7 @@ class PolyMap : public Mapping { std::vector const &ubnd) const; protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/RateMap.h b/include/astshim/RateMap.h index 31ae4266..69f007c6 100644 --- a/include/astshim/RateMap.h +++ b/include/astshim/RateMap.h @@ -84,7 +84,7 @@ class RateMap : public Mapping { std::shared_ptr copy() const { return std::static_pointer_cast(copyPolymorphic()); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/SeriesMap.h b/include/astshim/SeriesMap.h index 02a8bddd..90cd860f 100644 --- a/include/astshim/SeriesMap.h +++ b/include/astshim/SeriesMap.h @@ -83,7 +83,7 @@ class SeriesMap : public CmpMap { } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/ShiftMap.h b/include/astshim/ShiftMap.h index cf1e86c2..8ddab006 100644 --- a/include/astshim/ShiftMap.h +++ b/include/astshim/ShiftMap.h @@ -62,7 +62,7 @@ class ShiftMap : public Mapping { std::shared_ptr copy() const { return std::static_pointer_cast(copyPolymorphic()); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/SkyFrame.h b/include/astshim/SkyFrame.h index 2086a137..fdfac642 100644 --- a/include/astshim/SkyFrame.h +++ b/include/astshim/SkyFrame.h @@ -239,7 +239,7 @@ class SkyFrame : public Frame { } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/SlaMap.h b/include/astshim/SlaMap.h index 6d3308d8..627d5fff 100644 --- a/include/astshim/SlaMap.h +++ b/include/astshim/SlaMap.h @@ -178,7 +178,7 @@ class SlaMap : public Mapping { } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/SpecFrame.h b/include/astshim/SpecFrame.h index 27e203d2..7a716d37 100644 --- a/include/astshim/SpecFrame.h +++ b/include/astshim/SpecFrame.h @@ -271,7 +271,7 @@ class SpecFrame : public Frame { void setStdOfRest(std::string const &stdOfRest) { setC("StdOfRest", stdOfRest); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/SphMap.h b/include/astshim/SphMap.h index 1d80d506..ada41909 100644 --- a/include/astshim/SphMap.h +++ b/include/astshim/SphMap.h @@ -81,7 +81,7 @@ class SphMap : public Mapping { double getPolarLong() const { return getD("PolarLong"); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/TimeFrame.h b/include/astshim/TimeFrame.h index 861749a0..ee94c547 100644 --- a/include/astshim/TimeFrame.h +++ b/include/astshim/TimeFrame.h @@ -145,7 +145,7 @@ class TimeFrame : public Frame { void setTimeScale(std::string const &scale) { return setC("TimeScale", scale); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/TimeMap.h b/include/astshim/TimeMap.h index e698e2d4..6b738952 100644 --- a/include/astshim/TimeMap.h +++ b/include/astshim/TimeMap.h @@ -184,7 +184,7 @@ class TimeMap : public Mapping { } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/TranMap.h b/include/astshim/TranMap.h index f9afbd57..0f7b890d 100644 --- a/include/astshim/TranMap.h +++ b/include/astshim/TranMap.h @@ -82,7 +82,7 @@ class TranMap : public Mapping { std::shared_ptr copy() const { return std::static_pointer_cast(copyPolymorphic()); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/UnitMap.h b/include/astshim/UnitMap.h index 67a38b3d..37138c5d 100644 --- a/include/astshim/UnitMap.h +++ b/include/astshim/UnitMap.h @@ -66,7 +66,7 @@ class UnitMap : public Mapping { std::shared_ptr copy() const { return std::static_pointer_cast(copyPolymorphic()); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/UnitNormMap.h b/include/astshim/UnitNormMap.h index f050fdc9..18facfaa 100644 --- a/include/astshim/UnitNormMap.h +++ b/include/astshim/UnitNormMap.h @@ -81,7 +81,7 @@ class UnitNormMap : public Mapping { } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/WcsMap.h b/include/astshim/WcsMap.h index 1662775a..4ebabaf8 100644 --- a/include/astshim/WcsMap.h +++ b/include/astshim/WcsMap.h @@ -254,7 +254,7 @@ class WcsMap : public Mapping { WcsType getWcsType() const { return static_cast(getI("WcsType")); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/WinMap.h b/include/astshim/WinMap.h index 501a3b33..6cb6b13f 100644 --- a/include/astshim/WinMap.h +++ b/include/astshim/WinMap.h @@ -75,7 +75,7 @@ class WinMap : public Mapping { std::shared_ptr copy() const { return std::static_pointer_cast(copyPolymorphic()); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } diff --git a/include/astshim/ZoomMap.h b/include/astshim/ZoomMap.h index 2ee12baa..3c84de71 100644 --- a/include/astshim/ZoomMap.h +++ b/include/astshim/ZoomMap.h @@ -76,7 +76,7 @@ class ZoomMap : public Mapping { double getZoom() const { return getF("Zoom"); } protected: - virtual std::shared_ptr copyPolymorphic() const override { + std::shared_ptr copyPolymorphic() const override { return copyImpl(); } From 460cbaa82b37543e094cbd89b6b3001f4dbaa4e3 Mon Sep 17 00:00:00 2001 From: Russell Owen Date: Fri, 6 Jul 2018 13:10:15 -0700 Subject: [PATCH 3/3] git hide .coverage --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f985ef5f..5b886ed2 100755 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ config.log .sconf_temp .cache .pytest_cache +.coverage *.o *.os *.so