~ci-train-bot/location-service/location-service-ubuntu-yakkety-1895

« back to all changes in this revision

Viewing changes to include/location_service/com/ubuntu/location/wgs84/longitude.h

  • Committer: Thomas Voß
  • Date: 2013-05-28 14:20:45 UTC
  • Revision ID: thomas.voss@canonical.com-20130528142045-kq5umqdmm4o53vwk
Initial push.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LONGITUDE_H_
 
2
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LONGITUDE_H_
 
3
 
 
4
#include "com/ubuntu/location/units/units.h"
 
5
#include "com/ubuntu/location/wgs84/coordinate.h"
 
6
 
 
7
#include <stdexcept>
 
8
 
 
9
namespace com
 
10
{
 
11
namespace ubuntu
 
12
{
 
13
namespace location
 
14
{
 
15
namespace wgs84
 
16
{
 
17
namespace tag
 
18
{
 
19
struct Longitude;
 
20
}
 
21
typedef Coordinate<tag::Longitude, units::PlaneAngle> Longitude;
 
22
 
 
23
template<>
 
24
struct CoordinateTraits<Longitude>
 
25
{
 
26
    static double min()
 
27
    {
 
28
        return -180;
 
29
    };
 
30
    static double max()
 
31
    {
 
32
        return 180;
 
33
    };
 
34
 
 
35
    static void check_and_throw_if_invalid(const typename Longitude::Quantity& coordinate)
 
36
    {
 
37
        if (coordinate.value() < min())
 
38
            throw std::out_of_range(u8"Longitude(coordinate.value() < min())");
 
39
        if (coordinate.value() > max())
 
40
            throw std::out_of_range(u8"Longitude(coordinate.value() > max())");
 
41
    }
 
42
};
 
43
}
 
44
}
 
45
}
 
46
}
 
47
#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_WGS84_LATITUDE_H_