18 #ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_HEADING_H_
19 #define LOCATION_SERVICE_COM_UBUNTU_LOCATION_HEADING_H_
21 #include "com/ubuntu/location/accuracy.h"
22 #include "com/ubuntu/location/units/units.h"
36 typedef units::PlaneAngle Unit;
37 typedef units::Quantity<Unit> Quantity;
39 static const Quantity& min()
41 static const auto instance = Heading::Quantity::from_value(0.);
44 static const Quantity& max()
46 static const auto instance = Heading::Quantity::from_value(360.);
50 Heading(
const Quantity& value = Quantity()) : value(value)
53 throw std::out_of_range(
"");
55 throw std::out_of_range(
"");
58 bool operator==(
const Heading& rhs)
const
60 return value == rhs.value;
63 bool operator!=(
const Heading& rhs)
const
65 return value != rhs.value;
71 inline std::ostream& operator<<(std::ostream& out,
const Heading& heading)
73 out <<
"Heading(" << heading.value <<
")";
80 static AccuracyLevel classify(
const Heading& h)
82 static const auto half = 0.5 * Heading::max();
84 return AccuracyLevel::worst;
87 return AccuracyLevel::best;
89 return AccuracyLevel::worst;
106 #endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_HEADING_H_