58 #ifdef CHECK_MEMORY_LEAKS
60 #endif // CHECK_MEMORY_LEAKS
72 : myNet(net), myDetectorBuilder(db), myOffset(0), myJunctions(0) {
86 const std::string& key,
87 const std::string& type,
90 const std::vector<MSLane*> &incomingLanes,
92 #ifdef HAVE_INTERNAL_LANES
93 myActiveInternalLanes = internalLanes;
95 myActiveIncomingLanes = incomingLanes;
99 throw InvalidArgument(
"An unknown or invalid junction type '" + type +
"' occured in junction '" +
id +
"'.");
103 myPosition.set(x, y);
111 throw ProcessError(
"Information about the number of nodes was missing.");
127 #ifdef HAVE_INTERNAL_LANES
129 junction = buildInternalJunction();
134 throw InvalidArgument(
"False junction logic type.");
138 throw InvalidArgument(
"Another junction with the id '" +
myActiveID +
"' exists.");
156 , myActiveInternalLanes
168 myActiveInternalLanes,
174 #ifdef HAVE_INTERNAL_LANES
176 NLJunctionControlBuilder::buildInternalJunction() {
179 myActiveInternalLanes);
188 throw InvalidArgument(
"Missing junction logic '" +
myActiveID +
"'.");
196 return getTLLogicControlToUse().get(
id);
204 throw InvalidArgument(
"The off program for TLS '" +
myActiveKey +
"' has phases.");
224 unsigned int step = 0;
226 MSSimpleTrafficLightLogic::Phases::const_iterator i =
myActivePhases.begin();
227 while (offset >= (*i)->duration) {
229 offset -= (*i)->duration;
270 }
catch (InvalidArgument&) {
293 const std::string& response,
294 const std::string& foes,
296 if (myCurrentHasError) {
302 myCurrentHasError =
true;
303 throw InvalidArgument(
"Junction logic '" + myActiveKey +
"' is larger than allowed; recheck the network.");
305 if (myRequestSize == NO_REQUEST_SIZE) {
307 myRequestSize = (
int)response.size();
309 if (response.size() != myRequestSize) {
310 myCurrentHasError =
true;
312 " in Junction logic '" + myActiveKey +
"' (expected " +
toString(myRequestSize) +
")");
314 if (foes.size() != myRequestSize) {
315 myCurrentHasError =
true;
317 " in Junction logic '" + myActiveKey +
"' (expected " +
toString(myRequestSize) +
")");
320 assert(myActiveLogic.size() == (size_t) request);
321 assert(myActiveFoes.size() == (size_t) request);
323 myActiveLogic.push_back(std::bitset<64>(response));
325 myActiveFoes.push_back(std::bitset<64>(foes));
327 myActiveConts.set(request, cont);
329 myRequestItemNumber++;
349 int minDuration,
int maxDuration) {
368 throw InvalidArgument(
"The description for the junction logic '" +
myActiveKey +
"' is malicious.");
371 throw InvalidArgument(
"Junction logic '" +
myActiveKey +
"' was defined twice.");
384 throw ProcessError(
"Traffic lights could not be built.");
394 const std::string& value) {