tileHelper.h 1.36 KB
Newer Older
Valentin Platzgummer's avatar
Valentin Platzgummer committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
#ifndef TILEHELPER_H
#define TILEHELPER_H

#include <iostream>

namespace nemo_interface {

namespace coordinate {
template <class Coordinate> inline std::int64_t getHash(const Coordinate &t) {
  return double(t.latitude()) ^ double(t.longitude()) ^ double(t.altitude());
}
} // namespace coordinate

namespace coordinate_array {
template <class Container> inline std::int64_t getHash(const Container &c) {
  std::int64_t hash = 0;
  for (const auto &entry : c) {
    hash ^= coordinate::getHash(entry);
  }
}
} // namespace coordinate_array

namespace tile {
template <class Tile> inline std::int64_t getHash(const Tile &t) {
  return coordinate_array::getHash(t.tile());
}
} // namespace tile

namespace tile_array {
template <class Container> inline getHash(const Container &c) {
  std::int64_t hash = 0;
  for (const auto &entry : c) {
    hash ^= tile::getHash(entry);
  }
}
} // namespace tile_array

namespace labeled_progress {
template <class LabeledProgress> inline getHash(const LabeledProgress &lp) {
  return std::int64_t(lp.id()) ^ double(lp.progress());
}

namespace progress_array {
template <class Container> inline getHash(const Container &c) {
  std::int64_t hash = 0;
  for (const auto &entry : c) {
    hash ^= labeled_progress::getHash(entry);
  }
}

} // namespace progress_array

} // namespace labeled_progress

} // namespace nemo_interface

#endif // TILEHELPER_H