 |
Eclipse SUMO - Simulation of Urban MObility
|
Go to the documentation of this file.
41 #define LIBSUMO_SUBSCRIPTION_API \
42 static void subscribe(const std::string& objectID, const std::vector<int>& varIDs = std::vector<int>(), double begin = libsumo::INVALID_DOUBLE_VALUE, double end = libsumo::INVALID_DOUBLE_VALUE); \
43 static void subscribeContext(const std::string& objectID, int domain, double range, const std::vector<int>& varIDs = std::vector<int>(), double begin = libsumo::INVALID_DOUBLE_VALUE, double end = libsumo::INVALID_DOUBLE_VALUE); \
44 static void unsubscribeContext(const std::string& objectID, int domain, double range); \
45 static const SubscriptionResults getAllSubscriptionResults(); \
46 static const TraCIResults getSubscriptionResults(const std::string& objectID); \
47 static const ContextSubscriptionResults getAllContextSubscriptionResults(); \
48 static const SubscriptionResults getContextSubscriptionResults(const std::string& objectID);
50 #define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN) \
52 CLASS::subscribe(const std::string& objectID, const std::vector<int>& varIDs, double begin, double end) { \
53 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_VARIABLE, objectID, varIDs, begin, end); \
56 CLASS::subscribeContext(const std::string& objectID, int domain, double range, const std::vector<int>& varIDs, double begin, double end) { \
57 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_CONTEXT, objectID, varIDs, begin, end, domain, range); \
60 CLASS::unsubscribeContext(const std::string& objectID, int domain, double range) { \
61 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_CONTEXT, objectID, std::vector<int>(), libsumo::INVALID_DOUBLE_VALUE, libsumo::INVALID_DOUBLE_VALUE, domain, range); \
63 const SubscriptionResults \
64 CLASS::getAllSubscriptionResults() { \
65 return mySubscriptionResults; \
68 CLASS::getSubscriptionResults(const std::string& objectID) { \
69 return mySubscriptionResults[objectID]; \
71 const ContextSubscriptionResults \
72 CLASS::getAllContextSubscriptionResults() { \
73 return myContextSubscriptionResults; \
75 const SubscriptionResults \
76 CLASS::getContextSubscriptionResults(const std::string& objectID) { \
77 return myContextSubscriptionResults[objectID]; \
93 : std::runtime_error(what) {}
111 std::ostringstream os;
112 os <<
"TraCIPosition(" <<
x <<
"," <<
y <<
"," <<
z <<
")";
123 std::ostringstream os;
139 std::ostringstream os;
140 os <<
"TraCIColor(" <<
r <<
"," <<
g <<
"," <<
b <<
"," <<
a <<
")";
156 std::ostringstream os;
168 std::ostringstream os;
188 std::ostringstream os;
190 for (std::string v :
value) {
212 const std::vector<int>& _next = std::vector<int>(),
213 const std::string& _name =
"") :
227 %
template(TraCIPhaseVector) std::vector<libsumo::TraCIPhase>;
235 TraCILogic(
const std::string& _programID,
const int _type,
const int _currentPhaseIndex,
236 const std::vector<libsumo::TraCIPhase>& _phases = std::vector<libsumo::TraCIPhase>())
237 : programID(_programID), type(_type), currentPhaseIndex(_currentPhaseIndex), phases(_phases) {}
255 TraCILink(
const std::string& _from,
const std::string& _via,
const std::string& _to)
256 : fromLane(_from), viaLane(_via), toLane(_to) {}
268 TraCIConnection(
const std::string& _approachedLane,
const bool _hasPrio,
const bool _isOpen,
const bool _hasFoe,
269 const std::string _approachedInternal,
const std::string _state,
const std::string _direction,
const double _length)
270 : approachedLane(_approachedLane), hasPrio(_hasPrio), isOpen(_isOpen), hasFoe(_hasFoe),
271 approachedInternal(_approachedInternal), state(_state), direction(_direction), length(_length) {}
365 std::string intended =
"";
373 std::string description =
"";
std::vector< TraCIPhase > getPhases()
TraCIString(std::string v)
double duration
The stopping duration.
TRACI_CONST double INVALID_DOUBLE_VALUE
std::string lane
The lane to stop at.
double until
The time at which the vehicle may continue its journey.
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
std::string approachedInternal
int bestLaneOffset
The offset of this lane from the best lane.
double leaveTime
Leave-time of the vehicle in [s].
std::map< std::string, SubscriptionResults > ContextSubscriptionResults
int tlIndex
The tls index of the controlled link.
TRACI_CONST int INVALID_INT_VALUE
mirrors MSInductLoop::VehicleData
double dist
The distance to the tls.
std::string stoppingPlaceID
Id assigned to the stop.
TraCILink(const std::string &_from, const std::string &_via, const std::string &_to)
bool allowsContinuation
Whether this lane allows continuing the route.
char state
The current state of the tls.
double travelTime
duration of the stage in seconds
double occupation
The traffic density along length.
double endPos
The stopping position end.
std::string typeID
Type of the vehicle in.
double length
The length than can be driven from that lane without lane change.
TraCILogic(const std::string &_programID, const int _type, const int _currentPhaseIndex, const std::vector< libsumo::TraCIPhase > &_phases=std::vector< libsumo::TraCIPhase >())
std::string line
The line or the id of the vehicle type.
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::string id
The id of the vehicle.
std::string laneID
The id of the lane.
std::string approachedLane
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="")
double length
Length of the vehicle.
TraCIColor(int r, int g, int b, int a=255)
std::string id
The id of the next tls.
std::vector< TraCIPhase > phases
int type
The type of stage (walking, driving, ...)
std::vector< std::string > value
std::vector< std::string > edges
The sequence of edges to travel.
std::map< std::string, std::string > subParameter
An edgeId, position and laneIndex.
TraCIException(std::string what)
std::vector< TraCIPosition > TraCIPositionVector
std::vector< std::string > continuationLanes
The sequence of lanes that best allows continuing the route without lane change.
std::string vType
The vehicle type when using a private car or bike.
std::string destStop
The id of the destination stop.
virtual std::string getString()
std::map< std::string, TraCIResults > SubscriptionResults
{object->{variable->value}}
double entryTime
Entry-time of the vehicle in [s].