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) {
114 BusStop::setParameter(
const std::string& stopID,
const std::string& key,
const std::string& value) {
124 BusStop::getBusStop(
const std::string&
id) {
127 throw TraCIException(
"BusStop '" +
id +
"' is not known");
133 std::shared_ptr<VariableWrapper>
134 BusStop::makeWrapper() {
135 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
140 BusStop::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
143 return wrapper->wrapStringList(objID, variable, getIDList());
145 return wrapper->wrapInt(objID, variable, getIDCount());
147 return wrapper->wrapString(objID, variable, getLaneID(objID));
149 return wrapper->wrapDouble(objID, variable, getStartPos(objID));
151 return wrapper->wrapDouble(objID, variable, getEndPos(objID));
153 return wrapper->wrapString(objID, variable, getName(objID));
155 return wrapper->wrapInt(objID, variable, getVehicleCount(objID));
157 return wrapper->wrapStringList(objID, variable, getVehicleIDs(objID));
159 return wrapper->wrapInt(objID, variable, getPersonCount(objID));
161 return wrapper->wrapStringList(objID, variable, getPersonIDs(objID));
164 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
167 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
@ SUMO_TAG_BUS_STOP
A bus stop.
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN)
#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).
MSStoppingPlace * getStoppingPlace(const std::string &id, const SumoXMLTag category) const
Returns the named stopping place of the given category.
A lane area vehicles can halt at.
virtual const std::string getParameter(const std::string &key, const std::string defaultValue="") const
Returns the value for a given key.
virtual void setParameter(const std::string &key, const std::string &value)
Sets a parameter.
Representation of a vehicle.
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