LCOV - code coverage report
Current view: top level - app/include/Dynamic/Env - Connection.hpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 0 1 0.0 %
Date: 2023-08-17 16:45:52 Functions: 0 0 -

          Line data    Source code
       1             : #pragma once
       2             : 
       3             : #include <functional>
       4             : #include <limits>
       5             : #include <unordered_set>
       6             : 
       7             : #include "Dynamic/Dynamic.hpp"
       8             : 
       9             : namespace Dynamic::Env {
      10             : 
      11             : class Env;
      12             : class Lane;
      13             : class TrafficLight;
      14             : class Connection;
      15             : 
      16             : }  // namespace Dynamic::Env
      17             : 
      18             : namespace std {
      19             : template<>
      20             : struct hash<Dynamic::Env::Connection> {
      21             :     size_t operator()(const Dynamic::Env::Connection &connection) const;
      22             : };
      23             : }  // namespace std
      24             : 
      25             : namespace Dynamic::Env {
      26             : 
      27           0 : class Connection {
      28             :     friend Env;
      29             : 
      30             :    public:
      31             :     typedef long ID;
      32             : 
      33             :     static const Time CRITICAL_GAP;
      34             : 
      35             :     ID id;
      36             : 
      37             :     Lane &fromLane, &toLane;
      38             : 
      39             :     std::optional<std::reference_wrapper<TrafficLight>> trafficLight;
      40             :     std::optional<size_t>                               tlLinkIndex;
      41             : 
      42             :     Time lastUsed = -std::numeric_limits<Time>::infinity();
      43             : 
      44             :    private:
      45             :     Connection(ID id, Lane &fromLane, Lane &toLane);
      46             : 
      47             :     typedef std::unordered_set<std::reference_wrapper<Connection>, std::hash<Connection>, std::equal_to<Connection>> SetConnections;
      48             : 
      49             :     SetConnections lessImportant;  /// @brief Connections that are less important than this one; this one causes lessImportant to block
      50             :     SetConnections moreImportant;  /// @brief Connections that are more important than this one; this one is blocked by moreImportant
      51             : 
      52             :    public:
      53             :     void addMoreImportant(Connection &otherConnection);
      54             : 
      55             :     bool operator==(const Connection &connection) const;
      56             :     bool operator!=(const Connection &connection) const;
      57             : 
      58             :     bool isRed() const;
      59             : 
      60             :     bool operator<(const Connection &other) const;
      61             : 
      62             :     Time getMinExpectedStopTimeTL() const;
      63             : 
      64             :     bool yieldsTo(const Connection &other) const;
      65             :     Time mustYieldUntil() const;
      66             : 
      67             :     static Connection STOP;
      68             :     static Connection LEAVE;
      69             :     static Connection INVALID;
      70             : };
      71             : 
      72             : }  // namespace Dynamic::Env

Generated by: LCOV version 1.14