~ci-train-bot/location-service/location-service-ubuntu-yakkety-landing-006

« back to all changes in this revision

Viewing changes to include/location_service/com/ubuntu/location/update.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_UPDATE_H_
 
2
#define LOCATION_SERVICE_COM_UBUNTU_LOCATION_UPDATE_H_
 
3
 
 
4
#include "com/ubuntu/location/clock.h"
 
5
 
 
6
#include <ostream>
 
7
 
 
8
namespace com
 
9
{
 
10
namespace ubuntu
 
11
{
 
12
namespace location
 
13
{
 
14
template<typename T>
 
15
struct Update
 
16
{
 
17
    bool operator==(const Update<T>& rhs) const
 
18
    {
 
19
        return value == rhs.value && when == rhs.when;
 
20
    }
 
21
 
 
22
    bool operator!=(const Update<T>& rhs) const
 
23
    {
 
24
        return !(value == rhs.value && when == rhs.when);
 
25
    }
 
26
 
 
27
    T value;
 
28
    Clock::Timestamp when;
 
29
};
 
30
 
 
31
template<typename T>
 
32
inline std::ostream& operator<<(std::ostream& out, const Update<T>& update)
 
33
{
 
34
    out << "Update(" << update.value << ", " << update.when.time_since_epoch().count() << ")";
 
35
    return out;
 
36
}
 
37
 
 
38
}
 
39
}
 
40
}
 
41
 
 
42
#endif // LOCATION_SERVICE_COM_UBUNTU_LOCATION_UPDATE_H_