CARMA C++
|
The Length class can represent a length in any units. More...
#include <carma/services/Length.h>
Public Member Functions | |
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... | |
Additional Inherited Members | |
![]() | |
Units | u_ |
Used for converting between units. More... | |
The Length class can represent a length in any units.
It uses the Units class internally to handle conversion of any length unit to any other length unit. For example,
Length length1(1000.0,"m")
both
Length length2(1.0,"km")
length1
and length2
represent the same physical quantity. Binary operations + and - are supported, as is the stream operation <<.
carma::services::Length::Length | ( | double | value, |
const std::string & | units | ||
) |
Construct an Length given a value and units.
value | The value of this length |
units | The units of the value. |
|
virtual |
Destructor.
double carma::services::Length::meters | ( | ) | const |
double carma::services::Length::millimeters | ( | ) | const |
Add two Lengths.
ConformabilityException |
Subtract two Lengths.
ConformabilityException |