#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
