49 std::ostringstream oss;
50 oss.setf(std::ios::fixed, std::ios::floatfield);
51 oss << std::setprecision(accuracy);
58 inline std::string
toHex(
const T i, std::streamsize numDigits = 0) {
60 std::stringstream stream;
61 stream <<
"0x" << std::setfill(
'0') << std::setw(numDigits == 0 ?
sizeof(T) * 2 : numDigits) << std::hex << i;
66 inline std::string
toString(
const Named* obj, std::streamsize accuracy) {
169 std::ostringstream oss;
170 for (std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); ++it) {
185 return dist.toStr(accuracy);
188 template <
typename V>
190 return toString<V>(v.begin(), v.end(), accuracy);
193 template <
typename V>
194 inline std::string
toString(
const typename std::vector<V*>::const_iterator& b,
const typename std::vector<V*>::const_iterator& e, std::streamsize accuracy =
gPrecision) {
196 std::ostringstream oss;
197 for (
typename std::vector<V*>::const_iterator it = b; it != e; ++it) {
206 template <
typename V>
208 return toString<V>(v.begin(), v.end(), accuracy);
211 template <
typename V>
212 inline std::string
toString(
const typename std::list<V*>::const_iterator& b,
const typename std::list<V*>::const_iterator& e, std::streamsize accuracy =
gPrecision) {
214 std::ostringstream oss;
215 for (
typename std::list<V*>::const_iterator it = b; it != e; ++it) {
246 template <
typename T,
typename T_BETWEEN>
247 inline std::string
joinToString(
const std::vector<T>& v,
const T_BETWEEN& between, std::streamsize accuracy =
gPrecision) {
248 std::ostringstream oss;
249 bool connect =
false;
250 for (
typename std::vector<T>::const_iterator it = v.begin(); it != v.end(); ++it) {
262 template <
typename T,
typename T_BETWEEN>
264 std::vector<T> sorted(v);
265 std::sort(sorted.begin(), sorted.end());
270 template <
typename T,
typename T_BETWEEN>
272 std::vector<std::string> ids;
280 template <
typename T,
typename C,
typename T_BETWEEN>
282 std::vector<std::string> ids;
290 template <
typename V>
293 std::vector<std::string> ids;
294 for (
typename std::set<V*>::const_iterator it = v.begin(); it != v.end(); ++it) {
295 ids.push_back((*it)->getID());
302 inline std::string
toString(
const std::vector<int>& v, std::streamsize accuracy) {
308 inline std::string
toString(
const std::vector<long long int>& v, std::streamsize accuracy) {
314 inline std::string
toString(
const std::vector<double>& v, std::streamsize accuracy) {
319 template <
typename T,
typename T_BETWEEN>
321 std::ostringstream oss;
322 bool connect =
false;
323 for (
typename std::set<T>::const_iterator it = s.begin(); it != s.end(); ++it) {
336 inline std::string
toString(
const std::vector<std::string>& v, std::streamsize) {
342 inline std::string
toString(
const std::set<std::string>& v, std::streamsize) {
347 template <
typename KEY,
typename VAL,
typename T_BETWEEN,
typename T_BETWEEN_KEYVAL>
348 inline std::string
joinToString(
const std::map<KEY, VAL>& s,
const T_BETWEEN& between,
const T_BETWEEN_KEYVAL& between_keyval, std::streamsize accuracy =
gPrecision) {
349 std::ostringstream oss;
350 bool connect =
false;
351 for (
typename std::map<KEY, VAL>::const_iterator it = s.begin(); it != s.end(); ++it) {
357 oss <<
toString(it->first, accuracy) << between_keyval <<
toString(it->second, accuracy);
364 inline std::string
toString(
const std::map<std::string, std::string>& v, std::streamsize) {
static StringBijection< RightOfWay > RightOfWayValues
righ of way algorithms
SumoXMLTag
Numbers representing SUMO-XML - element names.
std::string toString< LinkDirection >(const LinkDirection &linkDir, std::streamsize accuracy)
static StringBijection< SumoXMLNodeType > NodeTypes
node types
std::string joinNamedToString(const std::set< T *, C > &ns, const T_BETWEEN &between)
SUMOVehicleClass
Definition of vehicle classes to differ between different lane usage and authority types...
static StringBijection< LaneSpreadFunction > LaneSpreadFunctions
lane spread functions
int gPrecision
the precision for floating point outputs
const std::string & getString(const T key) const
std::string toString< LaneChangeAction >(const LaneChangeAction &action, std::streamsize accuracy)
static std::string getIDSecure(const T *obj, const std::string &fallBack="NULL")
get an identifier for Named-like object which may be Null
SumoXMLAttr
Numbers representing SUMO-XML - attributes.
static StringBijection< LinkState > LinkStates
link states
std::string joinNamedToStringSorting(const std::set< T *> &ns, const T_BETWEEN &between)
RightOfWay
algorithms for computing right of way
#define UNUSED_PARAMETER(x)
std::vector< std::string > getStrings() const
LateralAlignment
Numbers representing special SUMO-XML-attribute values Information how vehicles align themselves with...
LinkDirection
The different directions a link between two lanes may take (or a stream between two edges)...
std::string toString< Distribution_Parameterized >(const Distribution_Parameterized &dist, std::streamsize accuracy)
static StringBijection< LinkDirection > LinkDirections
link directions
static StringBijection< LaneChangeAction > LaneChangeActions
lane change actions
std::string toString(const T &t, std::streamsize accuracy=gPrecision)
std::string toString< TrafficLightType >(const TrafficLightType &type, std::streamsize accuracy)
static StringBijection< TrafficLightType > TrafficLightTypes
traffic light types
LinkState
The right-of-way state of a link between two lanes used when constructing a NBTrafficLightLogic, in MSLink and GNEInternalLane.
std::string toString< SumoXMLTag >(const SumoXMLTag &tag, std::streamsize accuracy)
std::string toString< PersonMode >(const PersonMode &personMode, std::streamsize accuracy)
StringBijection< SUMOVehicleClass > SumoVehicleClassStrings(sumoVehicleClassStringInitializer, SVC_CUSTOM2, false)
std::string toString< LaneChangeModel >(const LaneChangeModel &model, std::streamsize accuracy)
Base class for objects which have an id.
std::string toString< LateralAlignment >(const LateralAlignment &latA, std::streamsize accuracy)
static StringBijection< LateralAlignment > LateralAlignments
lateral alignments
std::string toString< SumoXMLEdgeFunc >(const SumoXMLEdgeFunc &edgeFunc, std::streamsize accuracy)
LaneChangeAction
The state of a vehicle's lane-change behavior.
std::string toHex(const T i, std::streamsize numDigits=0)
std::string toString< FringeType >(const FringeType &fringeType, std::streamsize accuracy)
static StringBijection< FringeType > FringeTypeValues
fringe types
SumoXMLNodeType
Numbers representing special SUMO-XML-attribute values for representing node- (junction-) types used ...
static StringBijection< int > Attrs
The names of SUMO-XML attributes for use in netbuild.
std::string toString< LinkState >(const LinkState &linkState, std::streamsize accuracy)
std::string joinToStringSorting(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString< SUMOVehicleClass >(const SUMOVehicleClass &vClass, std::streamsize accuracy)
SumoXMLEdgeFunc
Numbers representing special SUMO-XML-attribute values for representing edge functions used in netbui...
PersonMode
travel modes for persons
LaneSpreadFunction
Numbers representing special SUMO-XML-attribute values Information how the edge's lateral offset shal...
std::string toString< RightOfWay >(const RightOfWay &row, std::streamsize accuracy)
std::string toString< SumoXMLAttr >(const SumoXMLAttr &attr, std::streamsize accuracy)
static StringBijection< PersonMode > PersonModeValues
person modes
FringeType
algorithms for computing right of way
static StringBijection< int > Tags
The names of SUMO-XML elements for use in netbuild.
static StringBijection< SumoXMLEdgeFunc > EdgeFunctions
edge functions
static StringBijection< LaneChangeModel > LaneChangeModels
lane change models
std::string joinToString(const std::vector< T > &v, const T_BETWEEN &between, std::streamsize accuracy=gPrecision)
std::string toString< LaneSpreadFunction >(const LaneSpreadFunction &lsf, std::streamsize accuracy)
std::string toString< SumoXMLNodeType >(const SumoXMLNodeType &nodeType, std::streamsize accuracy)