42 #define LIBSUMO_SUBSCRIPTION_API \ 43 static void subscribe(const std::string& objID, const std::vector<int>& vars = std::vector<int>(), double beginTime = libsumo::INVALID_DOUBLE_VALUE, double endTime = libsumo::INVALID_DOUBLE_VALUE); \ 44 static void subscribeContext(const std::string& objID, int domain, double range, const std::vector<int>& vars = std::vector<int>(), double beginTime = libsumo::INVALID_DOUBLE_VALUE, double endTime = libsumo::INVALID_DOUBLE_VALUE); \ 45 static void unsubscribeContext(const std::string& objID, int domain, double range); \ 46 static const SubscriptionResults getAllSubscriptionResults(); \ 47 static const TraCIResults getSubscriptionResults(const std::string& objID); \ 48 static const ContextSubscriptionResults getAllContextSubscriptionResults(); \ 49 static const SubscriptionResults getContextSubscriptionResults(const std::string& objID); 51 #define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN) \ 53 CLASS::subscribe(const std::string& objID, const std::vector<int>& vars, double beginTime, double endTime) { \ 54 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_VARIABLE, objID, vars, beginTime, endTime); \ 57 CLASS::subscribeContext(const std::string& objID, int domain, double range, const std::vector<int>& vars, double beginTime, double endTime) { \ 58 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_CONTEXT, objID, vars, beginTime, endTime, domain, range); \ 61 CLASS::unsubscribeContext(const std::string& objID, int domain, double range) { \ 62 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_CONTEXT, objID, std::vector<int>(), libsumo::INVALID_DOUBLE_VALUE, libsumo::INVALID_DOUBLE_VALUE, domain, range); \ 64 const SubscriptionResults \ 65 CLASS::getAllSubscriptionResults() { \ 66 return mySubscriptionResults; \ 69 CLASS::getSubscriptionResults(const std::string& objID) { \ 70 return mySubscriptionResults[objID]; \ 72 const ContextSubscriptionResults \ 73 CLASS::getAllContextSubscriptionResults() { \ 74 return myContextSubscriptionResults; \ 76 const SubscriptionResults \ 77 CLASS::getContextSubscriptionResults(const std::string& objID) { \ 78 return myContextSubscriptionResults[objID]; \ 94 : std::runtime_error(what) {}
112 std::ostringstream os;
113 os <<
"TraCIPosition(" << x <<
"," << y <<
"," << z <<
")";
124 std::ostringstream os;
125 os <<
"TraCIRoadPosition(" << edgeID <<
"_" << laneIndex <<
"," << pos <<
")";
138 TraCIColor(
int r,
int g,
int b,
int a = 255) : r(r), g(g), b(b), a(a) {}
140 std::ostringstream os;
141 os <<
"TraCIColor(" << r <<
"," << g <<
"," << b <<
"," << a <<
")";
157 std::ostringstream os;
169 std::ostringstream os;
189 std::ostringstream os;
191 for (std::string v : value) {
213 const std::vector<int>& _next = std::vector<int>(),
214 const std::string& _name =
"") :
215 duration(_duration), state(_state), minDur(_minDur), maxDur(_maxDur), next(_next), name(_name) {}
228 %
template(TraCIPhaseVector) std::vector<libsumo::TraCIPhase>;
236 TraCILogic(
const std::string& _programID,
const int _type,
const int _currentPhaseIndex,
237 const std::vector<libsumo::TraCIPhase>& _phases = std::vector<libsumo::TraCIPhase>())
238 : programID(_programID), type(_type), currentPhaseIndex(_currentPhaseIndex), phases(_phases) {}
256 TraCILink(
const std::string& _from,
const std::string& _via,
const std::string& _to)
257 : fromLane(_from), viaLane(_via), toLane(_to) {}
269 TraCIConnection(
const std::string& _approachedLane,
const bool _hasPrio,
const bool _isOpen,
const bool _hasFoe,
270 const std::string _approachedInternal,
const std::string _state,
const std::string _direction,
const double _length)
271 : approachedLane(_approachedLane), hasPrio(_hasPrio), isOpen(_isOpen), hasFoe(_hasFoe),
272 approachedInternal(_approachedInternal), state(_state), direction(_direction), length(_length) {}
366 std::string intended =
"";
374 std::string description =
"";
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
std::string id
The id of the next tls.
int type
The type of stage (walking, driving, ...)
double leaveTime
Leave-time of the vehicle in [s].
double dist
The distance to the tls.
bool allowsContinuation
Whether this lane allows continuing the route.
std::string line
The line or the id of the vehicle type.
std::string typeID
Type of the vehicle in.
double until
The time at which the vehicle may continue its journey.
An edgeId, position and laneIndex.
mirrors MSInductLoop::VehicleData
TraCILink(const std::string &_from, const std::string &_via, const std::string &_to)
std::string destStop
The id of the destination stop.
TraCILogic(const std::string &_programID, const int _type, const int _currentPhaseIndex, const std::vector< libsumo::TraCIPhase > &_phases=std::vector< libsumo::TraCIPhase >())
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
TraCIColor(int r, int g, int b, int a=255)
double occupation
The traffic density along length.
std::string laneID
The id of the lane.
std::map< std::string, std::string > subParameter
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
TraCIConnection(const std::string &_approachedLane, const bool _hasPrio, const bool _isOpen, const bool _hasFoe, const std::string _approachedInternal, const std::string _state, const std::string _direction, const double _length)
std::vector< TraCIPhase > phases
int bestLaneOffset
The offset of this lane from the best lane.
virtual std::string getString()
TRACI_CONST int INVALID_INT_VALUE
std::string approachedInternal
std::vector< TraCIPhase > getPhases()
std::string stoppingPlaceID
Id assigned to the stop.
std::vector< std::string > edges
The sequence of edges to travel.
double length
Length of the vehicle.
std::string id
The id of the vehicle.
double endPos
The stopping position end.
std::string approachedLane
std::string vType
The vehicle type when using a private car or bike.
std::vector< std::string > value
std::vector< TraCIPosition > TraCIPositionVector
char state
The current state of the tls.
double travelTime
duration of the stage in seconds
TraCIException(std::string what)
double length
The length than can be driven from that lane without lane change.
double entryTime
Entry-time of the vehicle in [s].
TraCIPhase(const double _duration, const std::string &_state, const double _minDur=libsumo::INVALID_DOUBLE_VALUE, const double _maxDur=libsumo::INVALID_DOUBLE_VALUE, const std::vector< int > &_next=std::vector< int >(), const std::string &_name="")
TraCIString(std::string v)
TRACI_CONST double INVALID_DOUBLE_VALUE
int tlIndex
The tls index of the controlled link.
double duration
The stopping duration.
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
std::string lane
The lane to stop at.