CARMA C++
carma::services::HourAngle Class Reference

The HourAngle class extends carma::services::Angle to specifically support hour angles. More...

#include <carma/services/HourAngle.h>

Inheritance diagram for carma::services::HourAngle:
carma::services::Angle carma::services::ConformableQuantity

Public Member Functions

double convert (const std::string &convertTo) const
 Converts this quantity to any conformable units. More...
 
std::string getLstString (int precision=0)
 Return LST for HourAngle value in +/-hh:mm:ss.s format. More...
 
std::string getString (int precision=0)
 Return the HourAngle value as a string in +/-hh:mm:ss.s format. More...
 
std::string getUnits () const
 
 HourAngle (double value, const std::string &units)
 Construct an HourAngle given a value and units. More...
 
double hours () const
 Convenience method that returns the value of this angle in hours. More...
 
const HourAngle operator+ (const HourAngle &angle) const
 Add two HourAngles. More...
 
HourAngleoperator+= (const HourAngle &frequency)
 Increment HourAngle. More...
 
const HourAngle operator- (const HourAngle &angle) const
 Subtract two HourAngles. More...
 
HourAngleoperator-= (const HourAngle &frequency)
 Decrement HourAngle. More...
 
void reset (double value, const std::string &units)
 Reset method to change value and/or units. More...
 
virtual ~HourAngle ()
 Destructor. More...
 
- Public Member Functions inherited from carma::services::Angle
 Angle ()
 Default constructor. More...
 
 Angle (double value, const std::string &units)
 Construct an Angle given a value and units. More...
 
double arcMinutes (bool modulo=false) const
 Convenience method that returns the value of this angle in arcminutes. More...
 
double arcSeconds (bool modulo=false) const
 Convenience method that returns the value of this angle in arcseconds. More...
 
double degrees (bool modulo=false) const
 Convenience method that returns the value of this angle in degrees. More...
 
std::string dms (bool modulo=true, int precision=0) const
 
double hours (bool modulo=true) const
 Convenience method that returns the value of this angle in hours. More...
 
Angleoperator*= (double scalar)
 Multiply an angle by a scalar. More...
 
const Angle operator+ (const Angle &angle) const
 Add two Angles. More...
 
Angleoperator+= (const Angle &angle)
 Add Angle. More...
 
const Angle operator- (const Angle &angle) const
 Subtract two Angles. More...
 
Angleoperator-= (const Angle &angle)
 Subtract Angle. More...
 
const Angle operator/ (double scalar) const
 Divide an angle by a scalar. More...
 
Angleoperator/= (double scalar)
 Divide by a scalar. More...
 
bool operator< (const Angle &right) const
 Less than comparison. More...
 
bool operator<= (const Angle &right) const
 Less than or equal comparison. More...
 
bool operator> (const Angle &right) const
 Greater than comparison. More...
 
bool operator>= (const Angle &right) const
 Greater than or equal comparison. More...
 
double radians (bool modulo=true) const
 Convenience method that returns the value of this angle in radians. More...
 
void setRadians (double radians)
 Set the value of this angle in radians. More...
 
virtual ~Angle ()
 Destructor. More...
 
- Public Member Functions inherited from carma::services::ConformableQuantity
 ConformableQuantity (double value, const std::string &units)
 Construct an ConformableQuantity given a value and units. More...
 
double getValue () const
 
virtual const ConformableQuantity operator+ (const ConformableQuantity &quantity) const
 Add two ConformableQuantities. More...
 
virtual ConformableQuantityoperator+= (const ConformableQuantity &quantity)
 Add ConformableQuantity to itself. More...
 
virtual const ConformableQuantity operator- (const ConformableQuantity &quantity) const
 Subtract two ConformableQuantities. More...
 
virtual ConformableQuantityoperator-= (const ConformableQuantity &quantity)
 Subtract ConformableQuantity from itself. More...
 
virtual ~ConformableQuantity ()
 Destructor. More...
 

Static Public Member Functions

static std::string getAngleString (double angle, int precision=0)
 return angle in a +/-hh:mm:ss.s format More...
 
static std::string hms (double decimalHours, int precision)
 
- Static Public Member Functions inherited from carma::services::Angle
static std::string getString (double angle, int precision=0)
 Return a zero filled string +/-ddd:mm:ss.s. More...
 

Additional Inherited Members

- Static Public Attributes inherited from carma::services::Angle
static const std::string ARCMIN_STR
 A const string that may be used for unit conversion. More...
 
static const std::string ARCSEC_STR
 A const string that may be used for unit conversion. More...
 
static const std::string DEGREES_STR
 A const string that may be used for unit conversion. More...
 
static const std::string HOURS_STR
 A const string that may be used for unit conversion. More...
 
static const std::string RADIANS_STR
 A const string that may be used for unit conversion. More...
 
- Static Protected Member Functions inherited from carma::services::Angle
static std::string getAngleString (double a, int precision=0, bool dms=true, bool useSign=false)
 
- Protected Attributes inherited from carma::services::ConformableQuantity
Units u_
 Used for converting between units. More...
 
- Static Protected Attributes inherited from carma::services::Angle
static const double twoPi_ = 2 * M_PIl
 Two pi. More...
 

Detailed Description

The HourAngle class extends carma::services::Angle to specifically support hour angles.


HourAngle angle1(M_PI,"radians")
HourAngle angle2(180.0,"degrees")
both angle1 and angle2 represent the same physical quantity. Binary operations + and - are supported, as is the stream operation <<.

Definition at line 36 of file HourAngle.h.

Constructor & Destructor Documentation

carma::services::HourAngle::HourAngle ( double  value,
const std::string &  units 
)

Construct an HourAngle given a value and units.

Parameters
valueThe value of this angle
unitsThe units of the value.
virtual carma::services::HourAngle::~HourAngle ( )
virtual

Destructor.

Member Function Documentation

double carma::services::HourAngle::convert ( const std::string &  convertTo) const
virtual

Converts this quantity to any conformable units.

This method is virtual in case subclasses need to munge the input variable for conformability. (e.g. HourAngle)

Parameters
convertToA string representing the units to convert to.
Returns
the value of this ConformableQuantity converted to the desired units
Exceptions
ConformabilityException

Reimplemented from carma::services::ConformableQuantity.

static std::string carma::services::HourAngle::getAngleString ( double  angle,
int  precision = 0 
)
static

return angle in a +/-hh:mm:ss.s format

Parameters
angleangle in radians
precisionnumber of digits after decimal point for secondsx

Definition at line 120 of file HourAngle.h.

std::string carma::services::HourAngle::getLstString ( int  precision = 0)

Return LST for HourAngle value in +/-hh:mm:ss.s format.

Parameters
precisionnumber of digits after the decimal point
std::string carma::services::HourAngle::getString ( int  precision = 0)

Return the HourAngle value as a string in +/-hh:mm:ss.s format.

Parameters
precisionnumber of digits after the decimal point
std::string carma::services::HourAngle::getUnits ( ) const
virtual
Returns
the units of this ConformableQuantity when it was instantiated.

Reimplemented from carma::services::ConformableQuantity.

double carma::services::HourAngle::hours ( ) const

Convenience method that returns the value of this angle in hours.

Provides some backwards compatibility with sza::util::HourAngle.

Returns
angular value in hours
const HourAngle carma::services::HourAngle::operator+ ( const HourAngle angle) const

Add two HourAngles.

Returns
an HourAngle with radian units that is the sum of the two HourAngles modulo PI (i.e. between -12h and 12h).
Exceptions
ConformabilityException
HourAngle& carma::services::HourAngle::operator+= ( const HourAngle frequency)

Increment HourAngle.

Returns
incremented HourAngle
const HourAngle carma::services::HourAngle::operator- ( const HourAngle angle) const

Subtract two HourAngles.

Returns
an HourAngle with radian units that is the sum of the two angles modulo PI (i.e. between -12h and 12h).
Exceptions
ConformabilityException
HourAngle& carma::services::HourAngle::operator-= ( const HourAngle frequency)

Decrement HourAngle.

Returns
decremented HourAngle
void carma::services::HourAngle::reset ( double  value,
const std::string &  units 
)
virtual

Reset method to change value and/or units.

This method is needed meant so that HourAngle can reassign "hours" to be "circle (hours/day)" so that Units will work transparently.

Parameters
valueThe value of this quantity
unitsThe units of the value.

Reimplemented from carma::services::ConformableQuantity.


The documentation for this class was generated from the following file: