CARMA C++
|
The Distance class can represent an distance in any units. More...
#include <carma/services/Distance.h>
Public Member Functions | |
Distance (double value, const std::string &units) | |
Construct an Distance given a value and units. More... | |
const Angle | getParallax () const |
Get the equivalent trigonometric parallax for this distance. More... | |
bool | isInfinite () const |
const Distance | operator+ (const Distance &distance) const |
Add two Distances. More... | |
Distance & | operator+= (const Distance &distance) |
Increment Distance. More... | |
const Distance | operator- (const Distance &distance) const |
Subtract two Distances. More... | |
Distance & | operator-= (const Distance &distance) |
Decrement Distance. More... | |
virtual | ~Distance () |
Destructor. More... | |
![]() | |
Length (double value, const std::string &units) | |
Construct an Length given a value and units. More... | |
double | meters () const |
Convenience method to return value in meters. More... | |
double | millimeters () const |
Convenience method to return value in millimeters. More... | |
const Length | operator+ (const Length &length) const |
Add two Lengths. More... | |
Length & | operator+= (const Length &frequency) |
Increment Length. More... | |
const Length | operator- (const Length &length) const |
Subtract two Lengths. More... | |
Length & | operator-= (const Length &frequency) |
Decrement Length. More... | |
virtual | ~Length () |
Destructor. More... | |
![]() | |
ConformableQuantity (double value, const std::string &units) | |
Construct an ConformableQuantity given a value and units. More... | |
virtual double | convert (const std::string &convertTo) const |
Converts this quantity to any conformable units. More... | |
virtual std::string | getUnits () const |
double | getValue () const |
virtual const ConformableQuantity | operator+ (const ConformableQuantity &quantity) const |
Add two ConformableQuantities. More... | |
virtual ConformableQuantity & | operator+= (const ConformableQuantity &quantity) |
Add ConformableQuantity to itself. More... | |
virtual const ConformableQuantity | operator- (const ConformableQuantity &quantity) const |
Subtract two ConformableQuantities. More... | |
virtual ConformableQuantity & | operator-= (const ConformableQuantity &quantity) |
Subtract ConformableQuantity from itself. More... | |
virtual void | reset (double value, const std::string &units) |
Reset method to change value and/or units. More... | |
virtual | ~ConformableQuantity () |
Destructor. More... | |
Static Public Member Functions | |
static Distance | getDistance (const Angle ¶llax) |
Given an parallax angle, return the equivalent distance. More... | |
Additional Inherited Members | |
![]() | |
Units | u_ |
Used for converting between units. More... | |
The Distance class can represent an distance in any units.
Distance subclasses Length–the main difference is that distances are not allowed to be negative. As with other Conformable Quantities, Distance uses the Units class internally to handle conversion of any distance unit to any other distance unit. For example,
Distance distance1(149598000.0,"km")
both
Distance distance2(1.0,"au")
distance1
and distance2
represent the same physical quantity. Binary operations + and - are supported, as is the stream operation <<.
Definition at line 43 of file Distance.h.
carma::services::Distance::Distance | ( | double | value, |
const std::string & | units | ||
) |
Construct an Distance given a value and units.
value | The non-negative value of this distance |
units | The units of the value. |
IllegalArgumentException | if value < 0. |
|
virtual |
Destructor.
const Angle carma::services::Distance::getParallax | ( | ) | const |
Add two Distances.
ConformabilityException |
Subtract two Distances.
ConformabilityException |