ubuntu-location-service
0.0.2
Main Page
Classes
Files
File List
include
location_service
com
ubuntu
location
accuracy.h
1
/*
2
* Copyright © 2012-2013 Canonical Ltd.
3
*
4
* This program is free software: you can redistribute it and/or modify it
5
* under the terms of the GNU Lesser General Public License version 3,
6
* as published by the Free Software Foundation.
7
*
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
12
*
13
* You should have received a copy of the GNU Lesser General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
15
*
16
* Authored by: Thomas Voß <thomas.voss@canonical.com>
17
*/
18
#ifndef LOCATION_SERVICE_COM_UBUNTU_LOCATION_ACCURACY_H_
19
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_ACCURACY_H_
20
21
#include <ostream>
22
23
namespace
com
24
{
25
namespace
ubuntu
26
{
27
namespace
location
28
{
29
enum class
AccuracyLevel
30
{
31
country,
32
region,
33
locality,
34
postalcode,
35
street,
36
detailed,
37
38
best = detailed,
39
worst = country
40
};
41
42
template
<
typename
T>
43
struct
AccuracyTraits
44
{
45
static
AccuracyLevel classify(
const
T& instance);
46
static
T best();
47
static
T worst();
48
};
49
50
template
<
typename
T>
51
struct
Accuracy
52
{
53
typedef
typename
T::Unit Unit;
54
typedef
typename
T::Quantity Quantity;
55
56
static
Accuracy<T>
best() {
return
AccuracyTraits<T>::best
(); }
57
static
Accuracy<T>
worst() {
return
AccuracyTraits<T>::worst
(); }
58
59
AccuracyLevel classify()
const
60
{
61
return
AccuracyTraits<T>::classify
(value);
62
}
63
64
T value;
65
};
66
67
template
<
typename
T>
68
inline
std::ostream& operator<<(std::ostream& out, const Accuracy<T>& update)
69
{
70
out <<
"Accuracy("
<< update.value <<
")"
;
71
return
out;
72
}
73
74
}
75
}
76
}
77
78
#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_ACCURACY_H_
Generated on Mon Oct 21 2013 17:37:07 for ubuntu-location-service by
1.8.4