43std::vector<std::string>
44RouteProbe::getIDList() {
45 std::vector<std::string> ids;
52RouteProbe::getIDCount() {
53 return (
int)getIDList().size();
57RouteProbe::getEdgeID(
const std::string& probeID) {
63RouteProbe::sampleLastRouteID(
const std::string& probeID) {
66 if (route ==
nullptr) {
67 throw TraCIException(
"RouteProbe '" + probeID +
"' did not collect any routes yet");
69 return route->getID();
73RouteProbe::sampleCurrentRouteID(
const std::string& probeID) {
76 if (route ==
nullptr) {
77 throw TraCIException(
"RouteProbe '" + probeID +
"' did not collect any routes yet");
79 return route->getID();
83RouteProbe::getParameter(
const std::string& ,
const std::string& ) {
90RouteProbe::setParameter(
const std::string& ,
const std::string& ,
const std::string& ) {
100RouteProbe::getRouteProbe(
const std::string&
id) {
103 throw TraCIException(
"Lane area detector '" +
id +
"' is not known");
109std::shared_ptr<VariableWrapper>
110RouteProbe::makeWrapper() {
111 return std::make_shared<Helper::SubscriptionWrapper>(handleVariable, mySubscriptionResults, myContextSubscriptionResults);
116RouteProbe::handleVariable(
const std::string& objID,
const int variable, VariableWrapper* wrapper,
tcpip::Storage* paramData) {
119 return wrapper->wrapStringList(objID, variable, getIDList());
121 return wrapper->wrapInt(objID, variable, getIDCount());
123 return wrapper->wrapString(objID, variable, getEdgeID(objID));
125 return wrapper->wrapString(objID, variable, sampleLastRouteID(objID));
127 return wrapper->wrapString(objID, variable, sampleCurrentRouteID(objID));
130 return wrapper->wrapString(objID, variable, getParameter(objID, paramData->
readString()));
133 return wrapper->wrapStringPair(objID, variable, getParameterWithKey(objID, paramData->
readString()));
std::shared_ptr< const MSRoute > ConstMSRoutePtr
@ SUMO_TAG_ROUTEPROBE
a routeprobe detector
#define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOM)
#define LIBSUMO_GET_PARAMETER_WITH_KEY_IMPLEMENTATION(CLASS)
const NamedObjectCont< MSDetectorFileOutput * > & getTypedDetectors(SumoXMLTag type) const
Returns the list of detectors of the given type.
MSDetectorControl & getDetectorControl()
Returns the detector control.
static MSNet * getInstance()
Returns the pointer to the unique instance of MSNet (singleton).
Writes routes of vehicles passing a certain edge.
ConstMSRoutePtr sampleRoute(bool last=true) const
const std::string & getID() const
Returns the id.
T get(const std::string &id) const
Retrieves an item.
void insertIDs(std::vector< std::string > &into) const
C++ TraCI client API implementation.
virtual std::string readString()
virtual int readUnsignedByte()
TRACI_CONST int VAR_SAMPLE_LAST
TRACI_CONST int TRACI_ID_LIST
std::map< std::string, libsumo::SubscriptionResults > ContextSubscriptionResults
TRACI_CONST int VAR_SAMPLE_CURRENT
TRACI_CONST int VAR_ROAD_ID
std::map< std::string, libsumo::TraCIResults > SubscriptionResults
{object->{variable->value}}
TRACI_CONST int VAR_PARAMETER
TRACI_CONST int VAR_PARAMETER_WITH_KEY