OpenLibrary
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ol::Router::AStar< PointT, OpenSetT, ClosedSetT, flags > Class Template Referenceabstract

#include <base.hpp>

Public Member Functions

template<class PathT , class CoordinateT >
PathT route (CoordinateT startPoint, CoordinateT endPoint)
 function for finding path More...
 

Protected Member Functions

virtual void init (PointT *startPoint, PointT *endPoint)
 
virtual bool findPath (PointT *endPoint)
 
virtual FScoreT heuristic_cost_estimate (const PointT *p1, const PointT *p2) const =0
 
virtual std::vector< PointT * > get_neighbours (PointT *p)=0
 
template<class PathT >
PathT reconstruct_path (PointT *last)
 
long double distance (const PointT *p1, const PointT *p2) const
 

Protected Attributes

decltype(PointT::f_score) typedef FScoreT
 
decltype(PointT::g_score) typedef GScoreT
 
OpenSetT m_openSet
 
ClosedSetT m_closedSet
 

Detailed Description

template<class PointT, class OpenSetT, class ClosedSetT, FlagsT flags = 0>
class ol::Router::AStar< PointT, OpenSetT, ClosedSetT, flags >

Template Parameters
PointTtype for points (kept in open and closed sets). Must implement: public access to variables x, and y public access to variables g_score and f_score public access to variable origin of type PointT* PointT(T x, T y, PointT *p = nullptr) - constructor with 'x' and 'y' coordinates (where T is any type you wish ;) ), and 'origin' == 'p' probably some operators to allow keeping points in sets/maps operator == which compares coordinates only friend std::ostream& operator<<(std::ostream &, const PointT &) - for debbuging reasons
OpenSetTtype for open points container. Must implement functions: PointT* getBest() - which returns point with lowest f_score. Function must remove point from container bool exists(const PointT *, PointT* &) - which checks if point exists in open set, and returns it if it does (second parameter) void clear() - clear container and delete point's! void insert(T *) - function for adding points. Set must take care of deletion of it's points bool isEmpty() const - function for checking if container is empty
  • friend std::ostream& operator<<(std::ostream &, const OpenSetT &) - for debbuging reasons
ClosedSetTtype for closed points container. Must implement functions: void clear() - clear container and delete point's! bool exists(const Point *) - which checks if point exists in open set void insert(T *) - function for adding points. Set must take care of deletion of it's points friend std::ostream& operator<<(std::ostream &, const ClosedSetT &) - for debbuging reasons
flagsoptions

Member Function Documentation

template<class PointT, class OpenSetT, class ClosedSetT, FlagsT flags = 0>
template<class PathT , class CoordinateT >
PathT ol::Router::AStar< PointT, OpenSetT, ClosedSetT, flags >::route ( CoordinateT  startPoint,
CoordinateT  endPoint 
)
inline

function for finding path

Template Parameters
PathT- container for points (coordinates) which supports push_front operator like std::list<CoordinateT>. There must exists assigment operator for CoordinateT which takes PointT. Easiest way is to inherite PointT from CoordinateT
CoordinateT- coordinate type (must provide two public variables: 'x' and 'y')
Parameters
startPoint- first point
endPoint- last point

The documentation for this class was generated from the following file: