10 #ifndef OPENLIBRARY_A_START_ROUTER_STD_TYPES_HPP
11 #define OPENLIBRARY_A_START_ROUTER_STD_TYPES_HPP
24 template<
class CoordT>
50 return x == other.x && y == other.y;
53 friend std::ostream& operator<<(std::ostream &stream,
const Coordinates &c)
55 stream << c.x <<
", " << c.y;
61 template<
class CoordT,
class ScoreT>
64 ScoreT f_score, g_score;
70 #if __cplusplus == 201103L
79 friend std::ostream& operator<<(std::ostream &stream,
const Point &p)
81 stream << static_cast<const Coordinates<CoordT> &>(p);
83 stream <<
"; q_score = " << p.g_score <<
", f_score = " << p.f_score;
90 template<
class Po
intT>
94 bool operator() (
const PointT *
const p1,
const PointT *
const p2)
const
109 template<
class Po
intT,
class SortedPo
intT>
113 OpenSet(): m_points(), m_value() {}
121 PointT *result = m_value.first();
123 m_points.erase(result);
125 assert(m_points.size() == m_value.size());
130 bool exists(
const PointT *p, PointT* &ret)
const
132 typename std::set<PointT *>::const_iterator it = m_points.find(const_cast<PointT *>(p));
133 const bool successed = it != m_points.end();
144 for(
auto item: m_points)
152 void insert(PointT *p)
157 assert(m_points.size() == m_value.size());
162 assert(m_points.size() == m_value.size());
164 return m_points.empty();
168 friend std::ostream& operator<<(std::ostream &stream,
const OpenSet &openSet)
170 stream <<
"[" << openSet.m_points.size() <<
"] [";
172 for (
auto item: openSet.m_points)
173 stream <<
" (" << (*item) <<
")";
181 std::set<PointT *, CompareCoordinates<PointT>> m_points;
182 SortedPointT m_value;
187 template<
class Po
intT>
197 bool exists(
const PointT *p)
const
199 typename std::set<PointT *>::const_iterator it = this->find(const_cast<PointT *>(p));
200 const bool status = it != this->end();
208 for(
auto item: *
this)
212 std::set<PointT *>::clear();
215 friend std::ostream& operator<<(std::ostream &stream,
const ClosedSet &closedSet)
217 stream <<
"[" << closedSet.size() <<
"] [";
219 for (
auto item: closedSet)
220 stream <<
" (" << (*item) <<
")";
Definition: std_types.hpp:62
Definition: std_types.hpp:110
Definition: std_types.hpp:91
Definition: std_types.hpp:188
Definition: std_types.hpp:25