58 #ifdef CHECK_MEMORY_LEAKS
60 #endif // CHECK_MEMORY_LEAKS
72 : myNet(net), myDetectorBuilder(db), myOffset(0), myJunctions(0) {
86 const std::string& key,
90 const std::vector<MSLane*>& incomingLanes,
92 #ifdef HAVE_INTERNAL_LANES
93 myActiveInternalLanes = internalLanes;
97 myActiveIncomingLanes = incomingLanes;
101 myPosition.set(x, y);
109 throw ProcessError(
"Information about the number of nodes was missing.");
125 #ifdef HAVE_INTERNAL_LANES
127 junction = buildInternalJunction();
132 throw InvalidArgument(
"False junction logic type.");
136 throw InvalidArgument(
"Another junction with the id '" +
myActiveID +
"' exists.");
154 , myActiveInternalLanes
166 myActiveInternalLanes,
172 #ifdef HAVE_INTERNAL_LANES
174 NLJunctionControlBuilder::buildInternalJunction() {
177 myActiveInternalLanes);
186 throw InvalidArgument(
"Missing junction logic '" +
myActiveID +
"'.");
194 return getTLLogicControlToUse().get(
id);
202 throw InvalidArgument(
"The off program for TLS '" +
myActiveKey +
"' has phases.");
222 unsigned int step = 0;
224 MSSimpleTrafficLightLogic::Phases::const_iterator i =
myActivePhases.begin();
225 while (offset >= (*i)->duration) {
227 offset -= (*i)->duration;
268 }
catch (InvalidArgument&) {
291 const std::string& response,
292 const std::string& foes,
294 if (myCurrentHasError) {
300 myCurrentHasError =
true;
301 throw InvalidArgument(
"Junction logic '" + myActiveKey +
"' is larger than allowed; recheck the network.");
303 if (myRequestSize == NO_REQUEST_SIZE) {
305 myRequestSize = (
int)response.size();
307 if (static_cast<int>(response.size()) != myRequestSize) {
308 myCurrentHasError =
true;
310 " in Junction logic '" + myActiveKey +
"' (expected " +
toString(myRequestSize) +
")");
312 if (static_cast<int>(foes.size()) != myRequestSize) {
313 myCurrentHasError =
true;
315 " in Junction logic '" + myActiveKey +
"' (expected " +
toString(myRequestSize) +
")");
318 assert(myActiveLogic.size() == (size_t) request);
319 assert(myActiveFoes.size() == (size_t) request);
321 myActiveLogic.push_back(std::bitset<64>(response));
323 myActiveFoes.push_back(std::bitset<64>(foes));
325 myActiveConts.set(request, cont);
327 myRequestItemNumber++;
347 int minDuration,
int maxDuration) {
366 throw InvalidArgument(
"The description for the junction logic '" +
myActiveKey +
"' is malicious.");
369 throw InvalidArgument(
"Junction logic '" +
myActiveKey +
"' was defined twice.");
382 throw ProcessError(
"Traffic lights could not be built.");
392 const std::string& value) {