Line data Source code
1 : #pragma once 2 : 3 : #include <functional> 4 : #include <list> 5 : #include <map> 6 : #include <set> 7 : 8 : #include "Dynamic/Dynamic.hpp" 9 : #include "Dynamic/Env/Lane.hpp" 10 : #include "Dynamic/Env/Node.hpp" 11 : 12 : namespace Dynamic::Env { 13 : 14 : class Env; 15 : 16 : class Lane; 17 : 18 : class Connection; 19 : 20 : class Vehicle; 21 : 22 0 : class Edge { 23 : friend Env; 24 : 25 : public: 26 : typedef long ID; 27 : typedef long Priority; 28 : 29 : ID id; 30 : Node u, v; 31 : Length length; 32 : Speed maxSpeed; 33 : Priority priority; 34 : 35 : std::vector<Lane> lanes; 36 : 37 : private: 38 : Edge( 39 : ID id, 40 : Node u, 41 : Node v, 42 : Length length, 43 : Speed maxSpeed, 44 : Priority priority, 45 : size_t nLanes 46 : ); 47 : Edge(const Edge &e); 48 : 49 : Edge &operator=(const Edge &e); 50 : 51 : public: 52 : Edge(); 53 : 54 : virtual Speed calculateSpeed() const; 55 : 56 : std::list<std::reference_wrapper<Connection>> getOutgoingConnections(); 57 : std::list<std::reference_wrapper<const Connection>> getOutgoingConnections() const; 58 : 59 : std::list<std::reference_wrapper<Connection>> getOutgoingConnections(const Edge &destinationEdge); 60 : std::list<std::reference_wrapper<const Connection>> getOutgoingConnections(const Edge &destinationEdge) const; 61 : 62 : std::list<std::reference_wrapper<Connection>> getIncomingConnections(); 63 : std::list<std::reference_wrapper<const Connection>> getIncomingConnections() const; 64 : 65 : bool operator==(const Edge &e) const; 66 : bool operator!=(const Edge &e) const; 67 : bool operator<(const Edge &e) const; 68 : 69 : static Edge INVALID; 70 : }; 71 : } // namespace Dynamic::Env 72 : 73 : namespace std { 74 : template<> 75 : struct hash<Dynamic::Env::Edge> { 76 : size_t operator()(const Dynamic::Env::Edge &e) const; 77 : }; 78 : } // namespace std