33#pragma warning(disable: 4868)
35#include <fmt/format.h>
36#include <fmt/ranges.h>
58 std::ostringstream oss;
59 oss.setf(std::ios::fixed, std::ios::floatfield);
60 oss << std::setprecision(accuracy);
67inline std::string
toString(
const double& val, std::streamsize accuracy) {
70 return fmt::format(fmt::runtime(
"{:.{}f}"), val, accuracy);
72 std::ostringstream oss;
73 oss.setf(std::ios::fixed, std::ios::floatfield);
74 oss << std::setprecision(accuracy);
82inline std::string
toString(
const std::string& val, std::streamsize accuracy) {
89inline std::string
toHex(
const T i, std::streamsize numDigits = 0) {
91 std::stringstream stream;
92 stream <<
"0x" << std::setfill(
'0') << std::setw(numDigits == 0 ?
sizeof(T) * 2 : numDigits) << std::hex << i;
97inline std::string
toString(
const Named* obj, std::streamsize accuracy) {
243 std::ostringstream oss;
244 for (std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); ++it) {
259 return dist.
toStr(accuracy);
264 return toString<V>(v.begin(), v.end(), accuracy);
269inline std::string
toString(
const typename std::vector<V*>::const_iterator& b,
const typename std::vector<V*>::const_iterator& e, std::streamsize accuracy =
gPrecision) {
271 std::ostringstream oss;
272 for (
typename std::vector<V*>::const_iterator it = b; it != e; ++it) {
283 return toString<V>(v.begin(), v.end(), accuracy);
287inline std::string
toString(
const typename std::list<V*>::const_iterator& b,
const typename std::list<V*>::const_iterator& e, std::streamsize accuracy =
gPrecision) {
289 std::ostringstream oss;
290 for (
typename std::list<V*>::const_iterator it = b; it != e; ++it) {
321template <
typename T,
typename T_BETWEEN>
322inline std::string
joinToString(
const std::vector<T>& v,
const T_BETWEEN& between, std::streamsize accuracy =
gPrecision) {
323 std::ostringstream oss;
324 bool connect =
false;
325 for (
typename std::vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
339template <
typename T_BETWEEN>
340inline std::string
joinToString(
const std::vector<std::string>& v,
const T_BETWEEN& between, std::streamsize accuracy =
gPrecision) {
341 return fmt::format(
"{}", fmt::join(v,
toString(between, accuracy)));
346template <
typename T,
typename T_BETWEEN>
348 std::vector<T> sorted(v);
349 std::sort(sorted.begin(), sorted.end());
354template <
typename T,
typename T_BETWEEN>
356 std::vector<std::string> ids;
363template <
typename T,
typename T_BETWEEN>
365 std::vector<std::string> ids;
373template <
typename T,
typename C,
typename T_BETWEEN>
375 std::vector<std::string> ids;
383template <
typename KEY,
typename VAL,
typename T_BETWEEN,
typename T_BETWEEN_KEYVAL>
384inline std::string
joinNamedToString(
const std::map<KEY, VAL, ComparatorIdLess>& s,
const T_BETWEEN& between,
const T_BETWEEN_KEYVAL& between_keyval, std::streamsize accuracy =
gPrecision) {
385 std::ostringstream oss;
386 bool connect =
false;
387 for (
typename std::map<KEY, VAL>::const_iterator it = s.begin(); it != s.end(); ++it) {
402 std::vector<std::string> ids;
403 for (
typename std::set<V*>::const_iterator it = v.begin(); it != v.end(); ++it) {
404 ids.push_back((*it)->getID());
411inline std::string
toString(
const std::set<V*, ComparatorNumericalIdLess>& v, std::streamsize accuracy =
gPrecision) {
413 std::vector<std::string> ids;
414 for (
typename std::set<V*, ComparatorNumericalIdLess>::const_iterator it = v.begin(); it != v.end(); ++it) {
415 ids.push_back((*it)->getID());
422inline std::string
toString(
const std::vector<int>& v, std::streamsize accuracy) {
428inline std::string
toString(
const std::vector<long long int>& v, std::streamsize accuracy) {
434inline std::string
toString(
const std::vector<double>& v, std::streamsize accuracy) {
439template <
typename V,
typename W>
440inline std::string
toString(
const std::vector<std::pair<V, W> >& v, std::streamsize accuracy =
gPrecision,
const std::string& between =
";",
const std::string& between2 =
",") {
441 std::ostringstream oss;
442 oss << std::setprecision(accuracy);
443 bool connect =
false;
456template <
typename T,
typename T_BETWEEN>
458 std::ostringstream oss;
459 bool connect =
false;
460 for (
typename std::set<T>::const_iterator it = s.begin(); it != s.end(); ++it) {
473inline std::string
toString(
const std::vector<std::string>& v, std::streamsize) {
479inline std::string
toString(
const std::set<std::string>& v, std::streamsize) {
484template <
typename KEY,
typename VAL,
typename T_BETWEEN,
typename T_BETWEEN_KEYVAL>
485inline std::string
joinToString(
const std::map<KEY, VAL>& s,
const T_BETWEEN& between,
const T_BETWEEN_KEYVAL& between_keyval, std::streamsize accuracy =
gPrecision) {
486 std::ostringstream oss;
487 bool connect =
false;
488 for (
typename std::map<KEY, VAL>::const_iterator it = s.begin(); it != s.end(); ++it) {
494 oss <<
toString(it->first, accuracy) << between_keyval <<
toString(it->second, accuracy);
LatAlignmentDefinition
Possible ways to choose the lateral alignment, i.e., how vehicles align themselves within their lane.
@ RIGHT
drive on the right side
@ GIVEN
The alignment as offset is given.
@ DEFAULT
No information given; use default.
@ LEFT
drive on the left side
@ ARBITRARY
maintain the current alignment
@ NICE
align with the closest sublane border
@ COMPACT
align with the rightmost sublane that allows keeping the current speed
@ CENTER
drive in the middle
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types.
InsertionCheck
different checking levels for vehicle insertion
SumoXMLTag
Numbers representing SUMO-XML - element names.
PersonMode
travel modes for persons
ParkingType
Numbers representing special SUMO-XML-attribute values Information on whether a car is parking on the...
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
RoundaboutType
classifying roundabout type for nodes
FringeType
classifying boundary nodes
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)....
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic,...
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
LaneChangeAction
The state of a vehicle's lane-change behavior.
RightOfWay
algorithms for computing right of way
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
int gPrecision
the precision for floating point outputs
std::pair< int, double > MMVersion
(M)ajor/(M)inor version for written networks and default version for loading
std::string toHex(const T i, std::streamsize numDigits=0)
std::string joinNamedToString(const std::set< T *, C > &ns, const T_BETWEEN &between)
std::string toString< ParkingType >(const ParkingType &pt, std::streamsize accuracy)
std::string joinToStringSorting(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString< TrafficLightType >(const TrafficLightType &type, std::streamsize accuracy)
std::string toString< SumoXMLNodeType >(const SumoXMLNodeType &nodeType, std::streamsize accuracy)
std::string toString< Distribution_Parameterized >(const Distribution_Parameterized &dist, std::streamsize accuracy)
std::string toString< SumoXMLEdgeFunc >(const SumoXMLEdgeFunc &edgeFunc, std::streamsize accuracy)
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString< LaneChangeModel >(const LaneChangeModel &model, std::streamsize accuracy)
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::string toString< InsertionCheck >(const InsertionCheck &check, std::streamsize accuracy)
std::string toString< RoundaboutType >(const RoundaboutType &roundaboutType, std::streamsize accuracy)
std::string toString< FringeType >(const FringeType &fringeType, std::streamsize accuracy)
std::string joinNamedToStringSorting(const std::set< T * > &ns, const T_BETWEEN &between)
std::string toString< SUMOVehicleClass >(const SUMOVehicleClass &vClass, std::streamsize accuracy)
std::string toString< LatAlignmentDefinition >(const LatAlignmentDefinition &lad, std::streamsize accuracy)
std::string toString< LaneSpreadFunction >(const LaneSpreadFunction &lsf, std::streamsize accuracy)
std::string toString< LinkState >(const LinkState &linkState, std::streamsize accuracy)
std::string toString< TrafficLightLayout >(const TrafficLightLayout &layout, std::streamsize accuracy)
std::string toString< SumoXMLAttr >(const SumoXMLAttr &attr, std::streamsize accuracy)
std::string toString< PersonMode >(const PersonMode &personMode, std::streamsize accuracy)
std::string toString< LaneChangeAction >(const LaneChangeAction &action, std::streamsize accuracy)
std::string toString< SumoXMLTag >(const SumoXMLTag &tag, std::streamsize accuracy)
std::string toString< LinkDirection >(const LinkDirection &linkDir, std::streamsize accuracy)
std::string toString< RightOfWay >(const RightOfWay &row, std::streamsize accuracy)
std::string toStr(std::streamsize accuracy) const
Returns the string representation of this distribution.
Base class for objects which have an id.
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
std::map< std::string, std::string > Map
parameters map
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
static StringBijection< LaneChangeAction > LaneChangeActions
lane change actions
static StringBijection< SumoXMLNodeType > NodeTypes
node types
static StringBijection< InsertionCheck > InsertionChecks
traffic light layouts
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
static StringBijection< PersonMode > PersonModeValues
person modes
static StringBijection< LinkState > LinkStates
link states
static SequentialStringBijection Attrs
The names of SUMO-XML attributes for use in netbuild.
static StringBijection< SumoXMLEdgeFunc > EdgeFunctions
edge functions
static StringBijection< TrafficLightLayout > TrafficLightLayouts
traffic light layouts
static SequentialStringBijection Tags
The names of SUMO-XML elements for use in netbuild.
static StringBijection< ParkingType > ParkingTypes
parking types
static StringBijection< LaneChangeModel > LaneChangeModels
lane change models
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
static StringBijection< LinkDirection > LinkDirections
link directions
static StringBijection< RoundaboutType > RoundaboutTypeValues
fringe types
static StringBijection< FringeType > FringeTypeValues
fringe types
const std::string & getString(int key) const
const std::string & getString(const T key) const
get string
std::vector< std::string > getStrings() const
get all strings
#define UNUSED_PARAMETER(x)