#include <TraCIServer.h>
Definition at line 345 of file TraCIServer.h.
Public Member Functions | |
| DataTypeContainer () | |
| void | get2DPosition (float &inX, float &inY) throw (TraCIException) |
| void | get3DPosition (float &inX, float &inY, float &inZ) throw (TraCIException) |
| Position2D | getAnyPosition () throw (TraCIException) |
| char | getByte () throw (TraCIException) |
| double | getDouble () throw (TraCIException) |
| float | getFloat () throw (TraCIException) |
| int | getInteger () throw (TraCIException) |
| int | getLastValueRead () |
| TraCIServer::RoadMapPos | getRoadMapPosition () throw (TraCIException) |
| std::string | getString () throw (TraCIException) |
| unsigned char | getUByte () throw (TraCIException) |
| void | readValue (unsigned char dataType, tcpip::Storage &msg) throw (TraCIException) |
Private Attributes | |
| int | intValue |
| int | lastValueRead |
| float | posXValue |
| float | posYValue |
| float | posZValue |
| double | realValue |
| TraCIServer::RoadMapPos | roadPosValue |
| std::string | stringValue |
| traci::DataTypeContainer::DataTypeContainer | ( | ) | [inline] |
| void traci::DataTypeContainer::get2DPosition | ( | float & | inX, | |
| float & | inY | |||
| ) | throw (TraCIException) [inline] |
Definition at line 464 of file TraCIServer.h.
References lastValueRead, POSITION_2D, posXValue, and posYValue.
00464 { 00465 if (lastValueRead == POSITION_2D) { 00466 inX = posXValue; 00467 inY = posYValue; 00468 } else { 00469 throw TraCIException("A 2d position has not been read"); 00470 } 00471 };
| void traci::DataTypeContainer::get3DPosition | ( | float & | inX, | |
| float & | inY, | |||
| float & | inZ | |||
| ) | throw (TraCIException) [inline] |
Definition at line 454 of file TraCIServer.h.
References lastValueRead, POSITION_2_5D, POSITION_3D, posXValue, posYValue, and posZValue.
00454 { 00455 if (lastValueRead == POSITION_3D || lastValueRead == POSITION_2_5D) { 00456 inX = posXValue; 00457 inY = posYValue; 00458 inZ = posZValue; 00459 } else { 00460 throw TraCIException("A 3d position has not been read"); 00461 } 00462 };
| Position2D traci::DataTypeContainer::getAnyPosition | ( | ) | throw (TraCIException) [inline] |
Definition at line 473 of file TraCIServer.h.
References lastValueRead, POSITION_2_5D, POSITION_2D, POSITION_3D, posXValue, and posYValue.
Referenced by traci::TraCIServer::handleVehicleDomain().
00473 { 00474 if (lastValueRead == POSITION_2D 00475 || lastValueRead == POSITION_3D 00476 || lastValueRead == POSITION_2_5D) { 00477 Position2D pos(static_cast<SUMOReal>(posXValue), 00478 static_cast<SUMOReal>(posYValue)); 00479 return pos; 00480 } else { 00481 throw TraCIException("No position has been read"); 00482 } 00483 };
| char traci::DataTypeContainer::getByte | ( | ) | throw (TraCIException) [inline] |
Definition at line 414 of file TraCIServer.h.
References intValue, lastValueRead, and TYPE_BYTE.
00414 { 00415 if (lastValueRead == TYPE_BYTE) { 00416 return static_cast<char>(intValue); 00417 } else { 00418 throw TraCIException("A byte value has not been read"); 00419 } 00420 };
| double traci::DataTypeContainer::getDouble | ( | ) | throw (TraCIException) [inline] |
Definition at line 438 of file TraCIServer.h.
References intValue, lastValueRead, and TYPE_DOUBLE.
00438 { 00439 if (lastValueRead == TYPE_DOUBLE) { 00440 return intValue; 00441 } else { 00442 throw TraCIException("A double value has not been read"); 00443 } 00444 };
| float traci::DataTypeContainer::getFloat | ( | ) | throw (TraCIException) [inline] |
Definition at line 430 of file TraCIServer.h.
References lastValueRead, realValue, and TYPE_FLOAT.
00430 { 00431 if (lastValueRead == TYPE_FLOAT) { 00432 return static_cast<float>(realValue); 00433 } else { 00434 throw TraCIException("A float value has not been read"); 00435 } 00436 };
| int traci::DataTypeContainer::getInteger | ( | ) | throw (TraCIException) [inline] |
Definition at line 422 of file TraCIServer.h.
References intValue, lastValueRead, and TYPE_INTEGER.
00422 { 00423 if (lastValueRead == TYPE_INTEGER) { 00424 return intValue; 00425 } else { 00426 throw TraCIException("An integer value has not been read"); 00427 } 00428 };
| int traci::DataTypeContainer::getLastValueRead | ( | ) | [inline] |
Definition at line 402 of file TraCIServer.h.
References lastValueRead.
Referenced by traci::TraCIServer::handlePoiDomain(), traci::TraCIServer::handlePolygonDomain(), traci::TraCIServer::handleRoadMapDomain(), traci::TraCIServer::handleTrafficLightDomain(), and traci::TraCIServer::handleVehicleDomain().
00402 { 00403 return lastValueRead; 00404 }
| TraCIServer::RoadMapPos traci::DataTypeContainer::getRoadMapPosition | ( | ) | throw (TraCIException) [inline] |
Definition at line 446 of file TraCIServer.h.
References lastValueRead, POSITION_ROADMAP, and roadPosValue.
Referenced by traci::TraCIServer::handleVehicleDomain().
00446 { 00447 if (lastValueRead == POSITION_ROADMAP) { 00448 return roadPosValue; 00449 } else { 00450 throw TraCIException("A road map position has not been read"); 00451 } 00452 };
| std::string traci::DataTypeContainer::getString | ( | ) | throw (TraCIException) [inline] |
Definition at line 485 of file TraCIServer.h.
References lastValueRead, stringValue, and TYPE_STRING.
Referenced by traci::TraCIServer::handlePoiDomain(), traci::TraCIServer::handlePolygonDomain(), traci::TraCIServer::handleRoadMapDomain(), traci::TraCIServer::handleTrafficLightDomain(), and traci::TraCIServer::handleVehicleDomain().
00485 { 00486 if (lastValueRead == TYPE_STRING) { 00487 return stringValue; 00488 } else { 00489 throw TraCIException("A string value has not been read"); 00490 } 00491 };
| unsigned char traci::DataTypeContainer::getUByte | ( | ) | throw (TraCIException) [inline] |
Definition at line 406 of file TraCIServer.h.
References intValue, lastValueRead, and TYPE_UBYTE.
00406 { 00407 if (lastValueRead == TYPE_UBYTE) { 00408 return static_cast<unsigned char>(intValue); 00409 } else { 00410 throw TraCIException("An unsigned byte value has not been read"); 00411 } 00412 };
| void traci::DataTypeContainer::readValue | ( | unsigned char | dataType, | |
| tcpip::Storage & | msg | |||
| ) | throw (TraCIException) [inline] |
Definition at line 360 of file TraCIServer.h.
References intValue, traci::TraCIServer::RoadMapPos::laneId, lastValueRead, traci::TraCIServer::RoadMapPos::pos, POSITION_2_5D, POSITION_2D, POSITION_3D, POSITION_ROADMAP, posXValue, posYValue, posZValue, realValue, traci::TraCIServer::RoadMapPos::roadId, roadPosValue, stringValue, TYPE_BYTE, TYPE_DOUBLE, TYPE_FLOAT, TYPE_INTEGER, TYPE_STRING, and TYPE_UBYTE.
Referenced by traci::TraCIServer::handlePoiDomain(), traci::TraCIServer::handlePolygonDomain(), traci::TraCIServer::handleRoadMapDomain(), traci::TraCIServer::handleTrafficLightDomain(), and traci::TraCIServer::handleVehicleDomain().
00360 { 00361 switch (dataType) { 00362 case TYPE_UBYTE: 00363 intValue = msg.readUnsignedByte(); 00364 break; 00365 case TYPE_BYTE: 00366 intValue = msg.readByte(); 00367 break; 00368 case TYPE_INTEGER: 00369 intValue = msg.readInt(); 00370 break; 00371 case TYPE_FLOAT: 00372 realValue = msg.readFloat(); 00373 break; 00374 case TYPE_DOUBLE: 00375 realValue = msg.readDouble(); 00376 break; 00377 case POSITION_ROADMAP: 00378 roadPosValue.roadId = msg.readString(); 00379 roadPosValue.pos = msg.readFloat(); 00380 roadPosValue.laneId = msg.readUnsignedByte(); 00381 break; 00382 case POSITION_2D: 00383 case POSITION_2_5D: 00384 case POSITION_3D: 00385 posXValue = msg.readFloat(); 00386 posYValue = msg.readFloat(); 00387 if (dataType != POSITION_2D) { 00388 posZValue = msg.readFloat(); 00389 } 00390 break; 00391 case TYPE_STRING: 00392 stringValue = msg.readString(); 00393 break; 00394 default: 00395 std::stringstream error; 00396 error << "Can't read value from request message: the data type " << (int)dataType << " is not known"; 00397 throw TraCIException(error.str()); 00398 } 00399 lastValueRead = dataType; 00400 };
int traci::DataTypeContainer::intValue [private] |
Definition at line 347 of file TraCIServer.h.
Referenced by getByte(), getDouble(), getInteger(), getUByte(), and readValue().
int traci::DataTypeContainer::lastValueRead [private] |
Definition at line 355 of file TraCIServer.h.
Referenced by get2DPosition(), get3DPosition(), getAnyPosition(), getByte(), getDouble(), getFloat(), getInteger(), getLastValueRead(), getRoadMapPosition(), getString(), getUByte(), and readValue().
float traci::DataTypeContainer::posXValue [private] |
Definition at line 351 of file TraCIServer.h.
Referenced by get2DPosition(), get3DPosition(), getAnyPosition(), and readValue().
float traci::DataTypeContainer::posYValue [private] |
Definition at line 352 of file TraCIServer.h.
Referenced by get2DPosition(), get3DPosition(), getAnyPosition(), and readValue().
float traci::DataTypeContainer::posZValue [private] |
double traci::DataTypeContainer::realValue [private] |
std::string traci::DataTypeContainer::stringValue [private] |
1.5.6