41 std::vector<std::string>
42 ParkingArea::getIDList() {
43 std::vector<std::string> ids;
45 ids.push_back(item.first);
47 std::sort(ids.begin(), ids.end());
52 ParkingArea::getIDCount() {
53 return (
int)getIDList().size();
58 ParkingArea::getLaneID(
const std::string& stopID) {
59 return getParkingArea(stopID)->getLane().getID();
63 ParkingArea::getStartPos(
const std::string& stopID) {
64 return getParkingArea(stopID)->getBeginLanePosition();
68 ParkingArea::getEndPos(
const std::string& stopID) {
69 return getParkingArea(stopID)->getEndLanePosition();
73 ParkingArea::getName(
const std::string& stopID) {
74 return getParkingArea(stopID)->getMyName();
78 ParkingArea::getVehicleCount(
const std::string& stopID) {
79 return (
int)getParkingArea(stopID)->getStoppedVehicles().size();
82 std::vector<std::string>
83 ParkingArea::getVehicleIDs(
const std::string& stopID) {
84 std::vector<std::string> result;
85 for (
const SUMOVehicle* veh : getParkingArea(stopID)->getStoppedVehicles()) {
86 result.push_back(veh->getID());
93 ParkingArea::getParameter(
const std::string& stopID,
const std::string& param) {
94 return getParkingArea(stopID)->getParameter(param,
"");
102 ParkingArea::setParameter(
const std::string& stopID,
const std::string& key,
const std::string& value) {
103 getParkingArea(stopID)->setParameter(key, value);
111 ParkingArea::getParkingArea(
const std::string&
id) {
116 std::shared_ptr<VariableWrapper>
117 ParkingArea::makeWrapper() {
118 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
123 ParkingArea::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
126 return wrapper->wrapStringList(objID, variable, getIDList());
128 return wrapper->wrapInt(objID, variable, getIDCount());
130 return wrapper->wrapString(objID, variable, getLaneID(objID));
132 return wrapper->wrapDouble(objID, variable, getStartPos(objID));
134 return wrapper->wrapDouble(objID, variable, getEndPos(objID));
136 return wrapper->wrapString(objID, variable, getName(objID));
138 return wrapper->wrapInt(objID, variable, getVehicleCount(objID));
140 return wrapper->wrapStringList(objID, variable, getVehicleIDs(objID));
143 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
146 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
@ SUMO_TAG_PARKING_AREA
A parking area.
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
A lane area vehicles can halt at.
C++ TraCI client API implementation.
Representation of a vehicle.
static MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag type)
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_NUMBER
TRACI_CONST int TRACI_ID_LIST
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int VAR_POSITION
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_LANEPOSITION
TRACI_CONST int VAR_LANE_ID
TRACI_CONST int VAR_PARAMETER_WITH_KEY
TRACI_CONST int VAR_STOP_STARTING_VEHICLES_IDS