Libosmium
2.2.0
Fast and flexible C++ library for working with OpenStreetMap data
Main Page
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
osmium
util
delta.hpp
Go to the documentation of this file.
1
#ifndef OSMIUM_UTIL_DELTA_HPP
2
#define OSMIUM_UTIL_DELTA_HPP
3
4
/*
5
6
This file is part of Osmium (http://osmcode.org/libosmium).
7
8
Copyright 2013-2015 Jochen Topf <jochen@topf.org> and others (see README).
9
10
Boost Software License - Version 1.0 - August 17th, 2003
11
12
Permission is hereby granted, free of charge, to any person or organization
13
obtaining a copy of the software and accompanying documentation covered by
14
this license (the "Software") to use, reproduce, display, distribute,
15
execute, and transmit the Software, and to prepare derivative works of the
16
Software, and to permit third-parties to whom the Software is furnished to
17
do so, all subject to the following:
18
19
The copyright notices in the Software and this entire statement, including
20
the above license grant, this restriction and the following disclaimer,
21
must be included in all copies of the Software, in whole or in part, and
22
all derivative works of the Software, unless such copies or derivative
23
works are solely in the form of machine-executable object code generated by
24
a source language processor.
25
26
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
29
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
30
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
31
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
32
DEALINGS IN THE SOFTWARE.
33
34
*/
35
36
#include <utility>
37
38
namespace
osmium
{
39
40
namespace
util {
41
45
template
<
typename
T>
46
class
DeltaEncode
{
47
48
T
m_value
;
49
50
public
:
51
52
DeltaEncode
() :
53
m_value(0) {
54
}
55
56
void
clear
() {
57
m_value = 0;
58
}
59
60
T
update
(T new_value) {
61
using
std::swap;
62
swap(m_value, new_value);
63
return
m_value - new_value;
64
}
65
66
};
// class DeltaEncode
67
71
template
<
typename
T>
72
class
DeltaDecode
{
73
74
T
m_value
;
75
76
public
:
77
78
DeltaDecode
() :
79
m_value(0) {
80
}
81
82
void
clear
() {
83
m_value = 0;
84
}
85
86
T
update
(T delta) {
87
m_value += delta;
88
return
m_value
;
89
}
90
91
};
// class DeltaDecode
92
93
}
// namespace util
94
95
}
// namespace osmium
96
97
#endif // OSMIUM_UTIL_DELTA_HPP
osmium::util::DeltaEncode::update
T update(T new_value)
Definition:
delta.hpp:60
osmium::util::DeltaDecode::clear
void clear()
Definition:
delta.hpp:82
osmium::util::DeltaDecode::m_value
T m_value
Definition:
delta.hpp:74
osmium::util::DeltaDecode
Definition:
delta.hpp:72
osmium::util::DeltaEncode::DeltaEncode
DeltaEncode()
Definition:
delta.hpp:52
osmium::util::DeltaEncode::m_value
T m_value
Definition:
delta.hpp:48
osmium
Namespace for everything in the Osmium library.
Definition:
assembler.hpp:55
osmium::util::DeltaEncode
Definition:
delta.hpp:46
osmium::util::DeltaDecode::DeltaDecode
DeltaDecode()
Definition:
delta.hpp:78
osmium::util::DeltaDecode::update
T update(T delta)
Definition:
delta.hpp:86
osmium::util::DeltaEncode::clear
void clear()
Definition:
delta.hpp:56
Generated by
1.8.8