Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-9937: Add noexcept specifiers to applicable methods in afw #366

Merged
merged 12 commits into from
Jul 6, 2018
24 changes: 12 additions & 12 deletions include/lsst/afw/cameraGeom/CameraSys.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,20 @@ class CameraSysPrefix {
)
: _sysName(sysName) {}

~CameraSysPrefix() = default;
~CameraSysPrefix() noexcept = default;
CameraSysPrefix(CameraSysPrefix const &) = default;
CameraSysPrefix(CameraSysPrefix &&) = default;
CameraSysPrefix(CameraSysPrefix &&) noexcept = default;
CameraSysPrefix &operator=(CameraSysPrefix const &) = default;
CameraSysPrefix &operator=(CameraSysPrefix &&) = default;
CameraSysPrefix &operator=(CameraSysPrefix &&) noexcept = default;

/**
* Get coordinate system name
*/
std::string getSysName() const { return _sysName; };

bool operator==(CameraSysPrefix const &rhs) const { return _sysName == rhs.getSysName(); }
bool operator==(CameraSysPrefix const &rhs) const noexcept { return _sysName == rhs.getSysName(); }

bool operator!=(CameraSysPrefix const &rhs) const { return !(*this == rhs); }
bool operator!=(CameraSysPrefix const &rhs) const noexcept { return !(*this == rhs); }

/**
* Hash function for this object.
Expand Down Expand Up @@ -101,11 +101,11 @@ class CameraSys {
/// default constructor so SWIG can wrap a vector of pairs containing these
CameraSys() : _sysName("?"), _detectorName(){};

~CameraSys() = default;
~CameraSys() noexcept = default;
CameraSys(CameraSys const &) = default;
CameraSys(CameraSys &&) = default;
CameraSys(CameraSys &&) noexcept = default;
CameraSys &operator=(CameraSys const &) = default;
CameraSys &operator=(CameraSys &&) = default;
CameraSys &operator=(CameraSys &&) noexcept = default;

/**
* Get coordinate system name
Expand All @@ -120,16 +120,16 @@ class CameraSys {
/**
* Does this have a non-blank detector name?
*/
bool hasDetectorName() const { return !_detectorName.empty(); }
bool hasDetectorName() const noexcept { return !_detectorName.empty(); }

bool operator==(CameraSys const &rhs) const {
bool operator==(CameraSys const &rhs) const noexcept {
return _sysName == rhs.getSysName() && _detectorName == rhs.getDetectorName();
}

bool operator!=(CameraSys const &rhs) const { return !(*this == rhs); }
bool operator!=(CameraSys const &rhs) const noexcept { return !(*this == rhs); }

// less-than operator required for use in std::map
bool operator<(CameraSys const &rhs) const {
bool operator<(CameraSys const &rhs) const noexcept {
if (_sysName == rhs.getSysName()) {
return _detectorName < rhs.getDetectorName();
} else {
Expand Down
22 changes: 11 additions & 11 deletions include/lsst/afw/cameraGeom/Orientation.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,29 +65,29 @@ class Orientation {
0) ///< roll: rotation about X'' (Y''=Y' to Z''), 3rd rotation
);

~Orientation();
Orientation(Orientation const &);
Orientation(Orientation &&);
Orientation &operator=(Orientation const &);
Orientation &operator=(Orientation &&);
~Orientation() noexcept;
Orientation(Orientation const &) noexcept;
Orientation(Orientation &&) noexcept;
Orientation &operator=(Orientation const &) noexcept;
Orientation &operator=(Orientation &&) noexcept;

/// Return focal plane position of detector reference point (mm)
lsst::geom::Point2D getFpPosition() const { return _fpPosition; }
lsst::geom::Point2D getFpPosition() const noexcept { return _fpPosition; }

/// Return detector reference point (pixels)
lsst::geom::Point2D getReferencePoint() const { return _refPoint; }
lsst::geom::Point2D getReferencePoint() const noexcept { return _refPoint; }

/// Return the yaw angle
lsst::geom::Angle getYaw() const { return _yaw; }
lsst::geom::Angle getYaw() const noexcept { return _yaw; }

/// Return the pitch angle
lsst::geom::Angle getPitch() const { return _pitch; }
lsst::geom::Angle getPitch() const noexcept { return _pitch; }

/// Return the roll angle
lsst::geom::Angle getRoll() const { return _roll; }
lsst::geom::Angle getRoll() const noexcept { return _roll; }

/// Return the number of quarter turns (rounded to the closest quarter)
int getNQuarter() const;
int getNQuarter() const noexcept;

/**
* Generate a Transform from pixel to focal plane coordinates
Expand Down
9 changes: 1 addition & 8 deletions include/lsst/afw/coord/Coord.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,9 @@
/*
* Functions to handle coordinates
*/
#include <iostream>
#include <limits>
#include <map>
#include <memory>
#include <string>

#include "lsst/base.h"
#include "lsst/geom/Point.h"
#include "lsst/geom/Angle.h"
#include "lsst/afw/coord/Observatory.h"
#include "lsst/daf/base.h"

namespace lsst {
namespace afw {
Expand Down
20 changes: 10 additions & 10 deletions include/lsst/afw/coord/Observatory.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ class Observatory {
*/
Observatory(std::string const& longitude, std::string const& latitude, double const elevation);

~Observatory();
Observatory(Observatory const&);
Observatory(Observatory&&);
Observatory& operator=(Observatory const&);
Observatory& operator=(Observatory&&);
~Observatory() noexcept;
Observatory(Observatory const&) noexcept;
Observatory(Observatory&&) noexcept;
Observatory& operator=(Observatory const&) noexcept;
Observatory& operator=(Observatory&&) noexcept;

/// set telescope longitude
void setLongitude(lsst::geom::Angle const longitude);
Expand All @@ -73,11 +73,11 @@ class Observatory {
void setElevation(double const elevation);

/// get telescope longitude (positive values are E of Greenwich)
lsst::geom::Angle getLongitude() const;
lsst::geom::Angle getLongitude() const noexcept;
/// get telescope latitude
lsst::geom::Angle getLatitude() const;
lsst::geom::Angle getLatitude() const noexcept;
/// get telescope elevation (meters above reference spheroid)
double getElevation() const { return _elevation; }
double getElevation() const noexcept { return _elevation; }

/// get telescope longitude as a dd:mm:ss.s string (positive values are E of Greenwich)
std::string getLongitudeStr() const;
Expand All @@ -86,13 +86,13 @@ class Observatory {
/// get string representation
std::string toString() const;

bool operator==(Observatory const& rhs) const {
bool operator==(Observatory const& rhs) const noexcept {
auto deltaLongitude = (_latitude - rhs.getLatitude()).wrapCtr();
auto deltaLatitude = (_longitude - rhs.getLongitude()).wrapCtr();
return (deltaLongitude == 0.0 * lsst::geom::degrees) &&
(deltaLatitude == 0.0 * lsst::geom::degrees) && ((_elevation - rhs._elevation) == 0.0);
}
bool operator!=(Observatory const& rhs) const { return !(*this == rhs); }
bool operator!=(Observatory const& rhs) const noexcept { return !(*this == rhs); }

private:
lsst::geom::Angle _latitude;
Expand Down
20 changes: 10 additions & 10 deletions include/lsst/afw/coord/Weather.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,24 +47,24 @@ class Weather {
*/
explicit Weather(double airTemperature, double airPressure, double humidity);

~Weather() = default;
~Weather() noexcept = default;

Weather(Weather const &) = default;
Weather(Weather &&) = default;
Weather &operator=(Weather const &) = default;
Weather &operator=(Weather &&) = default;
Weather(Weather const &) noexcept = default;
Weather(Weather &&) noexcept = default;
Weather &operator=(Weather const &) noexcept = default;
Weather &operator=(Weather &&) noexcept = default;

bool operator==(Weather const &other) const;
bool operator!=(Weather const &other) const { return !(*this == other); }
bool operator==(Weather const &other) const noexcept;
bool operator!=(Weather const &other) const noexcept { return !(*this == other); }

/// get outside air temperature (C)
double getAirTemperature() const { return _airTemperature; };
double getAirTemperature() const noexcept { return _airTemperature; };

/// get outside air pressure (Pascal)
double getAirPressure() const { return _airPressure; };
double getAirPressure() const noexcept { return _airPressure; };

/// get outside relative humidity (%)
double getHumidity() const { return _humidity; };
double getHumidity() const noexcept { return _humidity; };

private:
double _airTemperature; ///< air temperature (C)
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/afw/detection/Footprint.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class Footprint : public lsst::daf::base::Citizen,
/**
* Report if this object is persistable
*/
bool isPersistable() const override { return true; }
bool isPersistable() const noexcept override { return true; }

/**
* Dilate the Footprint with a defined kernel
Expand Down
4 changes: 2 additions & 2 deletions include/lsst/afw/detection/FootprintSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -137,15 +137,15 @@ class FootprintSet : public lsst::daf::base::Citizen {
FootprintSet& operator=(FootprintSet const& rhs);
FootprintSet& operator=(FootprintSet&& rhs);

void swap(FootprintSet& rhs) {
void swap(FootprintSet& rhs) noexcept {
using std::swap; // See Meyers, Effective C++, Item 25
swap(*_footprints, *rhs.getFootprints());
lsst::geom::Box2I rhsRegion = rhs.getRegion();
rhs.setRegion(getRegion());
setRegion(rhsRegion);
}

void swapFootprintList(FootprintList& rhs) {
void swapFootprintList(FootprintList& rhs) noexcept {
using std::swap;
swap(*_footprints, rhs);
}
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/afw/detection/GaussianPsf.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class GaussianPsf : public afw::table::io::PersistableFacade<GaussianPsf>, publi
double getSigma() const { return _sigma; }

/// Whether the Psf is persistable; always true.
virtual bool isPersistable() const { return true; }
virtual bool isPersistable() const noexcept override { return true; }

protected:
virtual std::string getPersistenceName() const;
Expand Down
18 changes: 9 additions & 9 deletions include/lsst/afw/detection/Threshold.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ class Threshold {
)
: _value(value), _type(type), _polarity(polarity), _includeMultiplier(includeMultiplier) {}

~Threshold() = default;
Threshold(Threshold const &) = default;
Threshold(Threshold &&) = default;
Threshold &operator=(Threshold const &) = default;
Threshold &operator=(Threshold &&) = default;
~Threshold() noexcept = default;
Threshold(Threshold const &) noexcept = default;
Threshold(Threshold &&) noexcept = default;
Threshold &operator=(Threshold const &) noexcept = default;
Threshold &operator=(Threshold &&) noexcept = default;

/// return type of threshold
ThresholdType getType() const { return _type; }
ThresholdType getType() const noexcept { return _type; }

static ThresholdType parseTypeString(std::string const &typeStr);
static std::string getTypeString(ThresholdType const &type);
Expand All @@ -89,15 +89,15 @@ class Threshold {
double getValue(ImageT const &image) const;

/// return Threshold's polarity
bool getPolarity() const { return _polarity; }
bool getPolarity() const noexcept { return _polarity; }
/// set Threshold's polarity
void setPolarity(bool const polarity ///< desired polarity
) {
) noexcept {
_polarity = polarity;
}

/// return includeMultiplier
double getIncludeMultiplier() const { return _includeMultiplier; }
double getIncludeMultiplier() const noexcept { return _includeMultiplier; }
/// set includeMultiplier
void setIncludeMultiplier(double const includeMultiplier ///< desired multiplier
) {
Expand Down
2 changes: 1 addition & 1 deletion include/lsst/afw/geom/SkyWcs.h
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ class SkyWcs final : public table::io::PersistableFacade<SkyWcs>, public table::
*/
bool isFlipped() const;

bool isPersistable() const override { return true; }
bool isPersistable() const noexcept override { return true; }

/**
* Return the local linear approximation to pixelToSky at a point given in sky coordinates.
Expand Down
62 changes: 32 additions & 30 deletions include/lsst/afw/geom/Span.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,49 +62,51 @@ class Span {
: _y(y), _x0(x0), _x1(x1) {}

/// Construct an empty Span with zero width at the origin.
Span() : _y(0), _x0(0), _x1(-1) {}
Span() noexcept : _y(0), _x0(0), _x1(-1) {}

Span(Span const&) = default;
Span(Span&&) = default;
Span& operator=(Span const&) = default;
Span& operator=(Span&&) = default;
~Span() = default;
Span(Span const&) noexcept = default;
Span(Span&&) noexcept = default;
Span& operator=(Span const&) noexcept = default;
Span& operator=(Span&&) noexcept = default;
~Span() noexcept = default;

/// Return an iterator to the first pixel in the Span.
Iterator begin() const { return Iterator(lsst::geom::Point2I(_x0, _y)); }
Iterator begin() const noexcept { return Iterator(lsst::geom::Point2I(_x0, _y)); }

/// Return an iterator to one past the last pixel in the Span.
Iterator end() const { return Iterator(lsst::geom::Point2I(_x1 + 1, _y)); }

int getX0() const { return _x0; } ///< Return the starting x-value
int& getX0() { return _x0; } ///< Return the starting x-value
int getX1() const { return _x1; } ///< Return the ending x-value
int& getX1() { return _x1; } ///< Return the ending x-value
int getY() const { return _y; } ///< Return the y-value
int& getY() { return _y; } ///< Return the y-value
int getWidth() const { return _x1 - _x0 + 1; } ///< Return the number of pixels
int getMinX() const { return _x0; } ///< Minimum x-value.
int getMaxX() const { return _x1; } ///< Maximum x-value.
int getBeginX() const { return _x0; } ///< Begin (inclusive) x-value.
int getEndX() const { return _x1 + 1; } ///< End (exclusive) x-value.
lsst::geom::Point2I const getMin() const {
Iterator end() const noexcept { return Iterator(lsst::geom::Point2I(_x1 + 1, _y)); }

int getX0() const noexcept { return _x0; } ///< Return the starting x-value
int& getX0() noexcept { return _x0; } ///< Return the starting x-value
int getX1() const noexcept { return _x1; } ///< Return the ending x-value
int& getX1() noexcept { return _x1; } ///< Return the ending x-value
int getY() const noexcept { return _y; } ///< Return the y-value
int& getY() noexcept { return _y; } ///< Return the y-value
int getWidth() const noexcept { return _x1 - _x0 + 1; } ///< Return the number of pixels
int getMinX() const noexcept { return _x0; } ///< Minimum x-value.
int getMaxX() const noexcept { return _x1; } ///< Maximum x-value.
int getBeginX() const noexcept { return _x0; } ///< Begin (inclusive) x-value.
int getEndX() const noexcept { return _x1 + 1; } ///< End (exclusive) x-value.
lsst::geom::Point2I const getMin() const noexcept {
return lsst::geom::Point2I(_x0, _y);
} ///< Point corresponding to minimum x.
lsst::geom::Point2I const getMax() const {
lsst::geom::Point2I const getMax() const noexcept {
return lsst::geom::Point2I(_x1, _y);
} ///< Point corresponding to maximum x.

bool contains(int x) const { return (x >= _x0) && (x <= _x1); }
bool contains(int x, int y) const { return (x >= _x0) && (x <= _x1) && (y == _y); }
bool contains(lsst::geom::Point2I const& point) const { return contains(point.getX(), point.getY()); }
bool contains(int x) const noexcept { return (x >= _x0) && (x <= _x1); }
bool contains(int x, int y) const noexcept { return (x >= _x0) && (x <= _x1) && (y == _y); }
bool contains(lsst::geom::Point2I const& point) const noexcept {
return contains(point.getX(), point.getY());
}

/// Return true if the span contains no pixels.
bool isEmpty() const { return _x1 < _x0; }
bool isEmpty() const noexcept { return _x1 < _x0; }

/// Return a string-representation of a Span
std::string toString() const;

void shift(int dx, int dy) {
void shift(int dx, int dy) noexcept {
_x0 += dx;
_x1 += dx;
_y += dy;
Expand All @@ -113,16 +115,16 @@ class Span {
/// Stream output; delegates to toString().
friend std::ostream& operator<<(std::ostream& os, Span const& span) { return os << span.toString(); }

bool operator==(Span const& other) const {
bool operator==(Span const& other) const noexcept {
return other.getY() == getY() && other.getMinX() == getMinX() && other.getMaxX() == getMaxX();
}
bool operator!=(Span const& other) const { return !(*this == other); }
bool operator!=(Span const& other) const noexcept { return !(*this == other); }

/* Required to make Span "LessThanComparable" so they can be used
* in sorting, binary search, etc.
* http://www.sgi.com/tech/stl/LessThanComparable.html
*/
bool operator<(const Span& b) const;
bool operator<(const Span& b) const noexcept;

friend class detection::Footprint;

Expand Down