* better and faster trip clustering: trip tries * add --write-colors to extract line colors from OSM data * refactor config parameter names, update default pfaedle.cfg * add --stats for writing a stats.json file * add --no-fast-hops, --no-a-star, --no-trie for debugging * general refactoring
40 lines
1.3 KiB
C++
40 lines
1.3 KiB
C++
// Copyright 2020, University of Freiburg,
|
|
// Chair of Algorithms and Data Structures.
|
|
// Authors: Patrick Brosi <brosi@informatik.uni-freiburg.de>
|
|
|
|
#include <utility>
|
|
#include <set>
|
|
#include "pfaedle/router/HopCache.h"
|
|
#include "pfaedle/trgraph/Graph.h"
|
|
#include "util/Misc.h"
|
|
|
|
using pfaedle::router::HopCache;
|
|
using pfaedle::trgraph::Edge;
|
|
|
|
// _____________________________________________________________________________
|
|
void HopCache::setMin(const Edge* a, const Edge* b, uint32_t val) {
|
|
_cache.set(a, b, val);
|
|
}
|
|
|
|
// _____________________________________________________________________________
|
|
void HopCache::setEx(const Edge* a, const Edge* b, uint32_t val) {
|
|
int64_t v = val;
|
|
_cache.set(a, b, -(v + 1));
|
|
}
|
|
|
|
// _____________________________________________________________________________
|
|
void HopCache::setMin(const Edge* a, const std::set<Edge*>& b, uint32_t val) {
|
|
for (auto eb : b) _cache.set(a, eb, val);
|
|
}
|
|
|
|
// _____________________________________________________________________________
|
|
void HopCache::setMin(const std::set<Edge*>& a, const Edge* b, uint32_t val) {
|
|
for (auto ea : a) _cache.set(ea, b, val);
|
|
}
|
|
|
|
// _____________________________________________________________________________
|
|
std::pair<uint32_t, bool> HopCache::get(const Edge* a, const Edge* b) const {
|
|
int64_t v = _cache.get(a, b);
|
|
if (v < 0) return {(-v) - 1, 1};
|
|
return {v, 0};
|
|
}
|