LCOV - code coverage report
Current view: top level - app/include/Dynamic/Env - TrafficLight.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 <list>
       5             : #include <map>
       6             : #include <vector>
       7             : 
       8             : #include "Dynamic/Dynamic.hpp"
       9             : 
      10             : namespace Dynamic::Env {
      11             : 
      12             : class Connection;
      13             : 
      14             : struct TrafficLight {
      15             :    public:
      16             :     typedef long ID;
      17             : 
      18             :     ID id;
      19             : 
      20             :     Time offset;
      21             : 
      22           0 :     struct Phase {
      23             :         enum class State {
      24             :             RED,
      25             :             YELLOW,
      26             :             GREEN,
      27             :         };
      28             : 
      29             :        private:
      30             :         TrafficLight &tl;
      31             : 
      32             :        public:
      33             :         Time t;
      34             :         Time duration;
      35             : 
      36             :         std::vector<State> state;
      37             : 
      38             :         Phase(TrafficLight &tl, Time t, Time duration, std::vector<State> state);
      39             : 
      40             :         Phase       &next();
      41             :         const Phase &next() const;
      42             :     };
      43             : 
      44             :     std::map<Time, Phase> phases;
      45             : 
      46             :     const Phase *currentPhase;
      47             : 
      48             :     Phase &addPhase(Time time, Time duration, std::vector<Phase::State> state);
      49             : 
      50             :     /// @brief Controlled connections
      51             :     std::list<std::reference_wrapper<Connection>> connections;
      52             : 
      53             :     TrafficLight(ID id, Time offset);
      54             : 
      55             :     std::pair<const Phase &, Time> getPhase(Time t) const;
      56             : 
      57             :     Time duration() const;
      58             : };
      59             : }  // namespace Dynamic::Env

Generated by: LCOV version 1.14