42 std::vector<std::string>
43 BusStop::getIDList() {
44 std::vector<std::string> ids;
46 ids.push_back(item.first);
48 std::sort(ids.begin(), ids.end());
53 BusStop::getIDCount() {
54 return (
int)getIDList().size();
59 BusStop::getLaneID(
const std::string& stopID) {
60 return getBusStop(stopID)->getLane().getID();
64 BusStop::getStartPos(
const std::string& stopID) {
65 return getBusStop(stopID)->getBeginLanePosition();
69 BusStop::getEndPos(
const std::string& stopID) {
70 return getBusStop(stopID)->getEndLanePosition();
74 BusStop::getName(
const std::string& stopID) {
75 return getBusStop(stopID)->getMyName();
79 BusStop::getVehicleCount(
const std::string& stopID) {
80 return (
int)getBusStop(stopID)->getStoppedVehicles().size();
83 std::vector<std::string>
84 BusStop::getVehicleIDs(
const std::string& stopID) {
85 std::vector<std::string> result;
86 for (
const SUMOVehicle* veh : getBusStop(stopID)->getStoppedVehicles()) {
87 result.push_back(veh->getID());
93 BusStop::getPersonCount(
const std::string& stopID) {
94 return (
int)getBusStop(stopID)->getNumWaitingPersons();
97 std::vector<std::string>
98 BusStop::getPersonIDs(
const std::string& stopID) {
99 std::vector<std::string> result;
100 getBusStop(stopID)->getWaitingPersonIDs(result);
106 BusStop::getParameter(
const std::string& stopID,
const std::string& param) {
107 return getBusStop(stopID)->getParameter(param,
"");
113 BusStop::setParameter(
const std::string& stopID,
const std::string& key,
const std::string& value) {
114 getBusStop(stopID)->setParameter(key, value);
122 BusStop::getBusStop(
const std::string&
id) {
127 std::shared_ptr<VariableWrapper>
128 BusStop::makeWrapper() {
129 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
134 BusStop::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
137 return wrapper->wrapStringList(objID, variable, getIDList());
139 return wrapper->wrapInt(objID, variable, getIDCount());
141 return wrapper->wrapString(objID, variable, getLaneID(objID));
143 return wrapper->wrapDouble(objID, variable, getStartPos(objID));
145 return wrapper->wrapDouble(objID, variable, getEndPos(objID));
147 return wrapper->wrapString(objID, variable, getName(objID));
149 return wrapper->wrapInt(objID, variable, getVehicleCount(objID));
151 return wrapper->wrapStringList(objID, variable, getVehicleIDs(objID));
153 return wrapper->wrapInt(objID, variable, getPersonCount(objID));
155 return wrapper->wrapStringList(objID, variable, getPersonIDs(objID));
158 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
161 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
@ SUMO_TAG_BUS_STOP
A bus stop.
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
C++ TraCI client API implementation.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
A lane area vehicles can halt at.
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_BUS_STOP_WAITING_IDS
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
TRACI_CONST int VAR_BUS_STOP_WAITING