42 #define INVALID_DOUBLE_VALUE -1073741824 44 #define LIBSUMO_SUBSCRIPTION_API \ 45 static void subscribe(const std::string& objID, const std::vector<int>& vars = std::vector<int>(), double beginTime = INVALID_DOUBLE_VALUE, double endTime = INVALID_DOUBLE_VALUE); \ 46 static void subscribeContext(const std::string& objID, int domain, double range, const std::vector<int>& vars = std::vector<int>(), double beginTime = INVALID_DOUBLE_VALUE, double endTime = INVALID_DOUBLE_VALUE); \ 47 static const SubscriptionResults getAllSubscriptionResults(); \ 48 static const TraCIResults getSubscriptionResults(const std::string& objID); \ 49 static const ContextSubscriptionResults getAllContextSubscriptionResults(); \ 50 static const SubscriptionResults getContextSubscriptionResults(const std::string& objID); 52 #define LIBSUMO_SUBSCRIPTION_IMPLEMENTATION(CLASS, DOMAIN) \ 54 CLASS::subscribe(const std::string& objID, const std::vector<int>& vars, double beginTime, double endTime) { \ 55 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_VARIABLE, objID, vars, beginTime, endTime); \ 58 CLASS::subscribeContext(const std::string& objID, int domain, double range, const std::vector<int>& vars, double beginTime, double endTime) { \ 59 libsumo::Helper::subscribe(CMD_SUBSCRIBE_##DOMAIN##_CONTEXT, objID, vars, beginTime, endTime, domain, range); \ 61 const SubscriptionResults \ 62 CLASS::getAllSubscriptionResults() { \ 63 return mySubscriptionResults; \ 66 CLASS::getSubscriptionResults(const std::string& objID) { \ 67 return mySubscriptionResults[objID]; \ 69 const ContextSubscriptionResults \ 70 CLASS::getAllContextSubscriptionResults() { \ 71 return myContextSubscriptionResults; \ 73 const SubscriptionResults \ 74 CLASS::getContextSubscriptionResults(const std::string& objID) { \ 75 return myContextSubscriptionResults[objID]; \ 91 : std::runtime_error(what) {}
109 std::ostringstream os;
110 os <<
"TraCIPosition(" << x <<
"," << y <<
"," << z <<
")";
121 std::ostringstream os;
122 os <<
"TraCIRoadPosition(" << edgeID <<
"_" << laneIndex <<
"," << pos <<
")";
135 std::ostringstream os;
136 os <<
"TraCIColor(" << (int)r <<
"," << (
int)g <<
"," << (int)b <<
"," << (
int)a <<
")";
139 unsigned char r, g, b, a;
152 std::ostringstream os;
164 std::ostringstream os;
184 std::ostringstream os;
186 for (std::string v : value) {
207 : duration(_duration), state(_state), minDur(_minDur), maxDur(_maxDur), next(_next) {}
219 %
template(TraCIPhaseVector) std::vector<libsumo::TraCIPhase>;
227 TraCILogic(
const std::string& _programID,
const int _type,
const int _currentPhaseIndex)
228 : programID(_programID), type(_type), currentPhaseIndex(_currentPhaseIndex) {}
241 TraCILink(
const std::string& _from,
const std::string& _via,
const std::string& _to)
242 : fromLane(_from), viaLane(_via), toLane(_to) {}
254 TraCIConnection(
const std::string& _approachedLane,
const bool _hasPrio,
const bool _isOpen,
const bool _hasFoe,
255 const std::string _approachedInternal,
const std::string _state,
const std::string _direction,
const double _length)
256 : approachedLane(_approachedLane), hasPrio(_hasPrio), isOpen(_isOpen), hasFoe(_hasFoe),
257 approachedInternal(_approachedInternal), state(_state), direction(_direction), length(_length) {}
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, ...)
TraCILogic(const std::string &_programID, const int _type, const int _currentPhaseIndex)
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
double arrivalPos
position on the lane when ending the stage
TraCILink(const std::string &_from, const std::string &_via, const std::string &_to)
std::string destStop
The id of the destination stop.
std::map< int, std::shared_ptr< TraCIResult > > TraCIResults
{variable->value}
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)
double depart
intended depart time for public transport ride or -1
std::vector< TraCIPhase > phases
double departPos
position on the lane when starting the stage
std::string description
arbitrary description string
int bestLaneOffset
The offset of this lane from the best lane.
#define INVALID_DOUBLE_VALUE
virtual std::string getString()
std::string approachedInternal
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.
TraCIPhase(const double _duration, const std::string &_state, const double _minDur=INVALID_DOUBLE_VALUE, const double _maxDur=INVALID_DOUBLE_VALUE, const int _next=-1)
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.
std::string intended
id of the intended vehicle for public transport ride
double entryTime
Entry-time of the vehicle in [s].
TraCIString(std::string v)
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.