ADORe
ADORe is a modular open source software library and toolkit for decision making, planning, control and simulation of automated vehicles
tcdtrafficlightset.h
Go to the documentation of this file.
1 /********************************************************************************
2  * Copyright (C) 2017-2020 German Aerospace Center (DLR).
3  * Eclipse ADORe, Automated Driving Open Research https://eclipse.org/adore
4  *
5  * This program and the accompanying materials are made available under the
6  * terms of the Eclipse Public License 2.0 which is available at
7  * http://www.eclipse.org/legal/epl-2.0.
8  *
9  * SPDX-License-Identifier: EPL-2.0
10  *
11  * Contributors:
12  * Stephan Lapoehn - initial implementation and API
13  ********************************************************************************/
14 
15 #pragma once
16 
17 #include <map>
18 #include <tuple>
20 
21 namespace adore
22 {
23  namespace env
24  {
25  typedef std::tuple<TrafficControlDevice*, int , int> TTCDTrafficLightTuple;
26  // std::tuple<trafficControlDevice, movementId, intersectionId>>
30  class TCDTrafficLightSet : public std::map<int,TTCDTrafficLightTuple>
31  {
46  public:
48  {
49  this->insert(std::make_pair(tcd->getID(), TTCDTrafficLightTuple(tcd, -1, -1)));
50  }
51 
52  void setMovementId(int tcdId, int movementId)
53  {
54  if(this->count(tcdId)>0)
55  {
56  std::get<1>(this->at(tcdId)) = movementId;
57  }
58  }
59 
60  void setJunctionId(int movementId, int junctionId)
61  {
62  for(auto it = this->begin(); it!=this->end(); it++)
63  {
64  if(std::get<1>(it->second)==movementId)
65  {
66  std::get<2>(it->second)=junctionId;
67  }
68  }
69  }
70 
72  {
73  return std::get<0>(this->at(tcdId));
74  }
75 
76  int getMovementId(int tcdId)
77  {
78  return std::get<1>(this->at(tcdId));
79  }
80 
81  int getIntersectionId(int tcdId)
82  {
83  return std::get<2>(this->at(tcdId));
84  }
85  };
86  }
87 }
Definition: tcdtrafficlightset.h:31
void setJunctionId(int movementId, int junctionId)
Definition: tcdtrafficlightset.h:60
void setMovementId(int tcdId, int movementId)
Definition: tcdtrafficlightset.h:52
void addTcd(TrafficControlDevice *tcd)
Definition: tcdtrafficlightset.h:47
int getIntersectionId(int tcdId)
Definition: tcdtrafficlightset.h:81
TrafficControlDevice * getTcdObj(int tcdId)
Definition: tcdtrafficlightset.h:71
int getMovementId(int tcdId)
Definition: tcdtrafficlightset.h:76
Definition: trafficcontroldevice.h:24
int getID() const
Definition: trafficcontroldevice.h:146
std::tuple< TrafficControlDevice *, int, int > TTCDTrafficLightTuple
Definition: tcdtrafficlightset.h:25
Definition: areaofeffectconverter.h:20
pwc insert(-1.0, 1.0)