1 #ifndef OSMIUM_OSM_CRC_HPP 2 #define OSMIUM_OSM_CRC_HPP 52 # if defined(__GNUC__) || defined(__clang__) 53 return __builtin_bswap16(value);
55 return (value >> 8) | (value << 8);
60 # if defined(__GNUC__) || defined(__clang__) 61 return __builtin_bswap32(value);
63 return (value >> 24) |
64 ((value >> 8) & 0x0000FF00) |
65 ((value << 8) & 0x00FF0000) |
71 # if defined(__GNUC__) || defined(__clang__) 72 return __builtin_bswap64(value);
76 return (val1 << 32) | val2;
82 template <
typename TCRC>
98 m_crc.process_byte(value);
102 m_crc.process_byte(value);
106 #if __BYTE_ORDER == __LITTLE_ENDIAN 107 m_crc.process_bytes(&value,
sizeof(uint16_t));
110 m_crc.process_bytes(&v,
sizeof(uint16_t));
115 #if __BYTE_ORDER == __LITTLE_ENDIAN 116 m_crc.process_bytes(&value,
sizeof(uint32_t));
119 m_crc.process_bytes(&v,
sizeof(uint32_t));
124 #if __BYTE_ORDER == __LITTLE_ENDIAN 125 m_crc.process_bytes(&value,
sizeof(uint64_t));
128 m_crc.process_bytes(&v,
sizeof(uint64_t));
134 m_crc.process_byte(*str++);
139 update_int32(uint32_t(timestamp));
143 update_int32(location.
x());
144 update_int32(location.
y());
153 update_int64(node_ref.
ref());
158 for (
const NodeRef& node_ref : node_refs) {
164 for (
const Tag& tag : tags) {
165 update_string(tag.key());
166 update_string(tag.value());
171 update_int64(member.
ref());
172 update_int16(uint16_t(member.
type()));
173 update_string(member.
role());
183 update_int64(
object.
id());
184 update_bool(
object.visible());
185 update_int32(
object.version());
186 update(
object.timestamp());
187 update_int32(
object.uid());
188 update_string(
object.user());
189 update(
object.tags());
193 update(static_cast<const osmium::OSMObject&>(node));
198 update(static_cast<const osmium::OSMObject&>(way));
203 update(static_cast<const osmium::OSMObject&>(relation));
208 update(static_cast<const osmium::OSMObject&>(area));
209 for (
auto it = area.
cbegin(); it != area.
cend(); ++it) {
212 update(static_cast<const osmium::NodeRefList&>(*it));
218 for (
const auto& comment : discussion) {
219 update(comment.date());
220 update_int32(comment.uid());
221 update_string(comment.user());
222 update_string(comment.text());
227 update_int64(changeset.
id());
230 update(changeset.
bounds());
233 update_int32(changeset.
uid());
234 update_string(changeset.
user());
235 update(changeset.
tags());
243 #endif // OSMIUM_OSM_CRC WayNodeList & nodes()
Definition: way.hpp:75
void update(const osmium::Relation &relation)
Definition: crc.hpp:202
void update_int8(const uint8_t value)
Definition: crc.hpp:101
Definition: changeset.hpp:128
void update_int16(const uint16_t value)
Definition: crc.hpp:105
void update(const osmium::Way &way)
Definition: crc.hpp:197
num_comments_type num_comments() const noexcept
Get the number of comments in this changeset.
Definition: changeset.hpp:320
osmium::Box & bounds() noexcept
Definition: changeset.hpp:340
RelationMemberList & members()
Definition: relation.hpp:177
void update(const osmium::Changeset &changeset)
Definition: crc.hpp:226
void update_int64(const uint64_t value)
Definition: crc.hpp:123
user_id_type uid() const noexcept
Get user id.
Definition: changeset.hpp:214
const TagList & tags() const
Get the list of tags.
Definition: changeset.hpp:359
constexpr Location top_right() const noexcept
Definition: box.hpp:178
Definition: relation.hpp:165
const_iterator cend() const
Definition: object.hpp:348
void update(const Timestamp ×tamp)
Definition: crc.hpp:138
const char * user() const
Get user name.
Definition: changeset.hpp:354
changeset_id_type id() const noexcept
Get ID of this changeset.
Definition: changeset.hpp:188
Definition: relation.hpp:148
void update(const osmium::OSMObject &object)
Definition: crc.hpp:182
void update(const TagList &tags)
Definition: crc.hpp:163
const_iterator cbegin() const
Definition: object.hpp:344
TCRC m_crc
Definition: crc.hpp:85
void update(const osmium::RelationMember &member)
Definition: crc.hpp:170
osmium::Timestamp closed_at() const noexcept
Definition: changeset.hpp:267
constexpr osmium::object_id_type ref() const noexcept
Definition: node_ref.hpp:65
Definition: relation.hpp:54
Namespace for everything in the Osmium library.
Definition: assembler.hpp:66
num_changes_type num_changes() const noexcept
Get the number of changes in this changeset.
Definition: changeset.hpp:304
void update(const osmium::Area &area)
Definition: crc.hpp:207
void update(const osmium::Box &box)
Definition: crc.hpp:147
void update(const osmium::Location &location)
Definition: crc.hpp:142
Definition: timestamp.hpp:56
constexpr int32_t y() const noexcept
Definition: location.hpp:332
void update(const NodeRef &node_ref)
Definition: crc.hpp:152
const TCRC & operator()() const
Definition: crc.hpp:93
item_type type() const noexcept
Definition: relation.hpp:126
uint32_t byte_swap_32(uint32_t value) noexcept
Definition: crc.hpp:59
void update_bool(const bool value)
Definition: crc.hpp:97
osmium::Timestamp created_at() const noexcept
Get timestamp when this changeset was created.
Definition: changeset.hpp:257
Definition: location.hpp:246
osmium::Location & location() noexcept
Definition: node_ref.hpp:79
object_id_type ref() const noexcept
Definition: relation.hpp:108
osmium::Location location() const noexcept
Definition: node.hpp:61
const char * role() const noexcept
Definition: relation.hpp:134
uint64_t byte_swap_64(uint64_t value) noexcept
Definition: crc.hpp:70
constexpr Location bottom_left() const noexcept
Definition: box.hpp:164
ChangesetDiscussion & discussion()
Definition: changeset.hpp:413
Definition: node_ref_list.hpp:50
An OSM Changeset, a group of changes made by a single user over a short period of time...
Definition: changeset.hpp:154
void update(const osmium::Node &node)
Definition: crc.hpp:192
void update_int32(const uint32_t value)
Definition: crc.hpp:114
constexpr int32_t x() const noexcept
Definition: location.hpp:328
void update(const osmium::ChangesetDiscussion &discussion)
Definition: crc.hpp:217
void update(const osmium::RelationMemberList &members)
Definition: crc.hpp:176
Definition: node_ref.hpp:50
void update_string(const char *str)
Definition: crc.hpp:132
uint16_t byte_swap_16(uint16_t value) noexcept
Definition: crc.hpp:51
TCRC & operator()()
Definition: crc.hpp:89
void update(const NodeRefList &node_refs)
Definition: crc.hpp:157
Definition: object.hpp:60