LSSTApplications  20.0.0
LSSTDataManagementBasePackage
Public Member Functions | Friends | List of all members
lsst::geom::AngleUnit Class Referencefinal

A class used to convert scalar POD types such as double to Angle. More...

#include <Angle.h>

Public Member Functions

constexpr AngleUnit (double val)
 Define a new angle unit. More...
 
constexpr bool operator== (AngleUnit const &rhs) const noexcept
 Test if two units are the same. More...
 
std::size_t hash_value () const noexcept
 Return a hash of this object. More...
 

Friends

class Angle
 
template<typename T >
constexpr friend Angle operator* (T lhs, AngleUnit rhs) noexcept
 Use AngleUnit to convert a POD (e.g. int, double) to an Angle; e.g. 180*degrees. More...
 

Detailed Description

A class used to convert scalar POD types such as double to Angle.

For example, given the predefined AngleUnit degrees:

Angle pi = 180*degrees;

is equivalent to

Angle pi(180, degrees);

Definition at line 70 of file Angle.h.

Constructor & Destructor Documentation

◆ AngleUnit()

constexpr lsst::geom::AngleUnit::AngleUnit ( double  val)
inlineexplicitconstexpr

Define a new angle unit.

Parameters
valthe number of radians in one unit. See degrees for an example.
Exception Safety\n Provides strong exception safety.

Definition at line 85 of file Angle.h.

85 : _val(val) {}

Member Function Documentation

◆ hash_value()

std::size_t lsst::geom::AngleUnit::hash_value ( ) const
inlinenoexcept

Return a hash of this object.

Definition at line 98 of file Angle.h.

98 { return std::hash<double>()(_val); }

◆ operator==()

constexpr bool lsst::geom::AngleUnit::operator== ( AngleUnit const &  rhs) const
inlineconstexprnoexcept

Test if two units are the same.

Parameters
rhsthe unit to compare this to
Returns
true if the two units have the same size, false otherwise.
Exception Safety\n Shall not throw exceptions.

Definition at line 104 of file Angle.h.

104  {
105  return (_val == rhs._val);
106 }

Friends And Related Function Documentation

◆ Angle

friend class Angle
friend

Definition at line 71 of file Angle.h.

◆ operator*

template<typename T >
constexpr friend Angle operator* ( lhs,
AngleUnit  rhs 
)
friend

Use AngleUnit to convert a POD (e.g. int, double) to an Angle; e.g. 180*degrees.

Parameters
lhsthe value to convert
rhsthe conversion coefficient
Exception Safety\n Shall not throw exceptions.

Definition at line 395 of file Angle.h.

395  {
396  static_assert(std::is_arithmetic<T>::value,
397  "Only numeric types may be multiplied by an AngleUnit to create an Angle!");
398  return Angle(lhs * rhs._val);
399 }

The documentation for this class was generated from the following file:
lsst::geom::AngleUnit::Angle
friend class Angle
Definition: Angle.h:71
val
ImageT val
Definition: CR.cc:146
std::is_arithmetic
std::hash