SUMO - Simulation of Urban MObility
TplConvert Class Reference

#include <TplConvert.h>

Collaboration diagram for TplConvert:
Collaboration graph

Static Public Member Functions

template<class E >
static int getLength (const E *const data)
 returns the length of the string (the position of the 0-character) More...
 
Conversion of basic types and data arrays to String
static std::string _2str (const int var)
 convert int to string More...
 
static std::string _2str (const double var)
 convert double to string More...
 
static std::string _2str (const bool var)
 convert bool to string More...
 
template<class E >
static std::string _2str (const E *const data)
 converts a 0-terminated char-type array into std::string More...
 
static std::string _2str (const char *const data)
 converts a 0-terminated char array into std::string More...
 
template<class E >
static std::string _2str (const E *const data, int length)
 converts a char-type array into std::string considering the given length More...
 
static std::string _2str (const char *const data, int length)
 converts a char array into std::string considering the given length More...
 
template<class E >
static std::string _2strSec (const E *const data, const std::string &def)
 converts a 0-terminated char-type array into std::string More...
 
template<class E >
static std::string _2strSec (const E *const data, int length, const std::string &def)
 converts a char-type array into std::string considering the given length More...
 
Conversion to basic type int
template<class E >
static int _2int (const E *const data)
 converts a char-type array into the integer value described by it More...
 
static int _str2int (const std::string &sData)
 converts a string into the integer value described by it by calling the char-type converter, which More...
 
template<class E >
static int _hex2int (const E *const data)
 converts a char-type array with a hex value into the integer value described by it More...
 
static int _strHex2int (const std::string &sData)
 converts a string with a hex value into the integer value described by it by calling the char-type converter More...
 
template<class E >
static int _2intSec (const E *const data, int def)
 converts a 0-terminated char-type array into the integer value described by it More...
 
Conversion to basic type long integer (at least 64 bit)
template<class E >
static long long int _2long (const E *const data)
 converts a char-type array into the long value described by it More...
 
static long long int _str2long (const std::string &sData)
 converts a string into the long value described by it by calling the char-type converter, which More...
 
template<class E >
static long long int _hex2long (const E *const data)
 converts a char-type array with a hex value into the long value described by it More...
 
template<class E >
static long long int _2longSec (const E *const data, long def)
 converts a 0-terminated char-type array into the long value described by it More...
 
Conversion to basic type double (Double)
template<class E >
static double _2double (const E *const data)
 converts a char-type array into the double value described by it More...
 
static double _str2double (const std::string &sData)
 converts a string into the double value described by it by calling the char-type converter More...
 
template<class E >
static double _2doubleSec (const E *const data, double def)
 converts a 0-terminated char-type array into the double value described by it More...
 
Conversion to basic type bool
template<class E >
static bool _2bool (const E *const data)
 converts a 0-terminated char-type array into the boolean value described by it More...
 
static bool _str2Bool (const std::string &sData)
 converts a string into the bool value described by it by calling the char-type converter More...
 
template<class E >
*static bool _2boolSec (const E *const data, bool def)
 converts a 0-terminated char-type array into the double value described by it More...
 

Detailed Description

TplConvert Some methods that convert 0-terminated char-arrays of any type into other values (numerical/boolean) or into std::strings Also convert strings into any type of values (double, int, bool...)

Definition at line 51 of file TplConvert.h.

Member Function Documentation

◆ _2bool()

template<class E >
static bool TplConvert::_2bool ( const E *const  data)
inlinestatic

◆ _2boolSec()

template<class E >
* static bool TplConvert::_2boolSec ( const E *const  data,
bool  def 
)
inlinestatic

converts a 0-terminated char-type array into the double value described by it

Returns
true if the data* is one of the following (case insensitive): '1', 'x', 'true', 'yes', 'on'
false if the data* is one of the following (case insensitive): '0', '-', 'false', 'no', 'off'
the default value if the data is empty

Definition at line 419 of file TplConvert.h.

References _2bool().

◆ _2double()

template<class E >
static double TplConvert::_2double ( const E *const  data)
inlinestatic

converts a char-type array into the double value described by it

Exceptions
anEmptyData - exception if the given string is empty
aNumberFormatException - exception when the string does not contain a double

Definition at line 311 of file TplConvert.h.

References _2int().

Referenced by _2doubleSec(), _str2double(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::adaptLogic(), NBEdgeCont::applyOptions(), MSDevice_Battery::buildVehicleDevices(), MSDevice_Example::buildVehicleDevices(), MSDevice_Bluelight::buildVehicleDevices(), MSSwarmTrafficLightLogic::getBetaNo(), MSSwarmTrafficLightLogic::getBetaSp(), SUMOSAXAttributesImpl_Cached::getBoundary(), SUMOSAXAttributesImpl_Xerces::getBoundary(), MSSwarmTrafficLightLogic::getChangePlanProbability(), MFXAddEditTypedTable::getControlForItem(), MSSOTLTrafficLightLogic::getDecayConstant(), MSDevice_SSM::getDetectionRange(), Parameterised::getDouble(), MSDevice_SSM::getExtraTime(), SUMOSAXAttributesImpl_Cached::getFloat(), SUMOSAXAttributesImpl_Binary::getFloat(), SUMOSAXAttributesImpl_Xerces::getFloat(), MSSwarmTrafficLightLogic::getForgettingCox(), MSSwarmTrafficLightLogic::getGammaNo(), MSSwarmTrafficLightLogic::getGammaSp(), MSSOTLTrafficLightLogic::getInputSensorsLength(), MSSwarmTrafficLightLogic::getLearningCox(), MSDevice_SSM::getMeasuresAndThresholds(), NIImporter_VISUM::getNamedFloat(), MSSOTLTrafficLightLogic::getOutputSensorsLength(), MSSwarmTrafficLightLogic::getPheroMaxVal(), SUMOSAXAttributesImpl_Cached::getShape(), SUMOSAXAttributesImpl_Xerces::getShape(), MSSOTLTrafficLightLogic::getSpeedThreshold(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::getStretchBereichDef(), MSSwarmTrafficLightLogic::getThetaInit(), MSSwarmTrafficLightLogic::getThetaMax(), MSSwarmTrafficLightLogic::getThetaMin(), getTurningDefaults(), MSTriggeredRerouter::getWeight(), NIImporter_VISUM::getWeightedFloat(), PushButtonLogic::init(), SigmoidLogic::init(), MSSwarmTrafficLightLogic::init(), LandmarkLookupTable< E, V >::LandmarkLookupTable(), PCLoaderVisum::load(), PCLoaderDlrNavteq::loadPolyFile(), MSActuatedTrafficLightLogic::MSActuatedTrafficLightLogic(), MSDelayBasedTrafficLightLogic::MSDelayBasedTrafficLightLogic(), MSSOTLPolicy::MSSOTLPolicy(), NIImporter_ITSUMO::Handler::myEndElement(), GUISettingsHandler::myStartElement(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), GUIDialog_ViewSettings::onCmdEditTable(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Laengenverteilungsdefinition::parse(), NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition::parse(), NIVissimSingleTypeParser_Simdauer::parse(), NIVissimSingleTypeParser_Zeitenverteilungsdefinition::parse(), NIVissimSingleTypeParser_Verbindungsdefinition::parse(), NIImporter_VISUM::parse_Lanes(), NIImporter_VISUM::parse_Point(), SUMOVehicleParameter::parseArrivalPos(), SUMOVehicleParameter::parseArrivalPosLat(), SUMOVehicleParameter::parseArrivalSpeed(), GeomConvHelper::parseBoundaryReporting(), RGBColor::parseColor(), SUMOVehicleParameter::parseDepartPos(), SUMOVehicleParameter::parseDepartPosLat(), SUMOVehicleParameter::parseDepartSpeed(), GeomConvHelper::parseShapeReporting(), GUISettingsHandler::parseSizeSettings(), GUISettingsHandler::parseTextSettings(), ODMatrix::parseTimeLine(), RODFDetFlowLoader::read(), ODMatrix::readFactor(), ODMatrix::readO(), ODMatrix::readV(), NIImporter_DlrNavteq::readVersion(), Option_Float::set(), MSDevice_Battery::setParameter(), MSLCM_LC2013::setParameter(), MSDevice_Example::setParameter(), MSDevice_Bluelight::setParameter(), MSLCM_SL2015::setParameter(), MSDevice_Routing::setParameter(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::stretchLogic(), and RODFDetector::writeEmitterDefinition().

◆ _2doubleSec()

template<class E >
static double TplConvert::_2doubleSec ( const E *const  data,
double  def 
)
inlinestatic

converts a 0-terminated char-type array into the double value described by it

Returns
the default value if the data is empty

Definition at line 371 of file TplConvert.h.

References _2double().

Referenced by MSRouteHandler::openRouteDistribution(), NIImporter_VISUM::parse_Edges(), and MSSOTLPolicyDesirability::readParameter().

◆ _2int()

template<class E >
static int TplConvert::_2int ( const E *const  data)
inlinestatic

converts a char-type array into the integer value described by it

Exceptions
anEmptyData - exception if the given string is empty
aNumberFormatException - exception when the string does not contain an integer

Definition at line 155 of file TplConvert.h.

References _2long().

Referenced by _2double(), _2intSec(), _str2int(), NIXMLEdgesHandler::addSplit(), MFXAddEditTypedTable::getControlForItem(), OutputDevice::getDevice(), MSTLLogicControl::WAUTSwitchProcedure::getGSPValue(), SUMOSAXAttributesImpl_Cached::getInt(), SUMOSAXAttributesImpl_Xerces::getInt(), NINavTeqHelper::getLaneNumber(), MSSwarmTrafficLightLogic::getMaxCongestionDuration(), MSSOTLRequestPolicy::getMinDecisionalPhaseDuration(), MSSOTLRequestTrafficLightLogic::getMinDecisionalPhaseDuration(), MSSOTLTrafficLightLogic::getMode(), MSSwarmTrafficLightLogic::getReinforcementMode(), NINavTeqHelper::getSpeed(), MSSOTLTrafficLightLogic::getThreshold(), MSSwarmTrafficLightLogic::init(), NBHelpers::interpretLaneID(), PCLoaderVisum::load(), NIImporter_ITSUMO::Handler::myEndElement(), GUISettingsHandler::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Kantensperrung::parse(), NIVissimSingleTypeParser_Knotendefinition::parse(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_Verbindungsdefinition::parse(), NIVissimSingleTypeParser_Fahrzeugklassendefinition::parse(), NIVissimSingleTypeParser_Fahrzeugtypdefinition::parse(), NIImporter_VISUM::parse_EdgePolys(), NIImporter_VISUM::parse_Lanes(), NIImporter_VISUM::parse_LanesConnections(), NIImporter_VISUM::parse_Types(), SUMOVehicleParameter::parseArrivalLane(), NIImporter_Vissim::VissimSingleTypeParser::parseAssignedVehicleTypes(), RGBColor::parseColor(), SUMOVehicleParameter::parseDepartLane(), NIVissimSingleTypeParser_Querverkehrsstoerungsdefinition::parsePos(), ODMatrix::parseSingleTime(), NIImporter_Vissim::VissimSingleTypeParser::readExtEdgePointDef(), ODMatrix::readO(), ODMatrix::readV(), NIImporter_DlrNavteq::EdgesHandler::report(), NIImporter_DlrNavteq::ConnectedLanesHandler::report(), Option_Integer::set(), Option_IntVector::set(), MSSOTLE2Sensors::setVehicleWeigths(), and RODFDetector::writeEmitterDefinition().

◆ _2intSec()

template<class E >
static int TplConvert::_2intSec ( const E *const  data,
int  def 
)
inlinestatic

converts a 0-terminated char-type array into the integer value described by it

Returns
the default value if the data is empty

Definition at line 195 of file TplConvert.h.

References _2int().

Referenced by RODFDetectorHandler::myStartElement(), NIImporter_VISUM::parse_Edges(), and NIXMLConnectionsHandler::parseDeprecatedLaneDefinition().

◆ _2long()

template<class E >
static long long int TplConvert::_2long ( const E *const  data)
inlinestatic

◆ _2longSec()

template<class E >
static long long int TplConvert::_2longSec ( const E *const  data,
long  def 
)
inlinestatic

converts a 0-terminated char-type array into the long value described by it

Returns
the default value if the data is empty

Definition at line 296 of file TplConvert.h.

References _2long().

◆ _2str() [1/7]

◆ _2str() [2/7]

static std::string TplConvert::_2str ( const double  var)
inlinestatic

convert double to string

Definition at line 63 of file TplConvert.h.

◆ _2str() [3/7]

static std::string TplConvert::_2str ( const bool  var)
inlinestatic

convert bool to string

Definition at line 70 of file TplConvert.h.

◆ _2str() [4/7]

template<class E >
static std::string TplConvert::_2str ( const E *const  data)
inlinestatic

converts a 0-terminated char-type array into std::string

Exceptions
anEmptyData - exception if the given pointer is 0

Definition at line 78 of file TplConvert.h.

References _2str(), and getLength().

◆ _2str() [5/7]

static std::string TplConvert::_2str ( const char *const  data)
inlinestatic

converts a 0-terminated char array into std::string

Exceptions
anEmptyData - exception if the given pointer is 0

Definition at line 85 of file TplConvert.h.

◆ _2str() [6/7]

template<class E >
static std::string TplConvert::_2str ( const E *const  data,
int  length 
)
inlinestatic

converts a char-type array into std::string considering the given length

Exceptions
anEmptyData - exception if the given pointer is 0

Definition at line 96 of file TplConvert.h.

◆ _2str() [7/7]

static std::string TplConvert::_2str ( const char *const  data,
int  length 
)
inlinestatic

converts a char array into std::string considering the given length

Exceptions
anEmptyData - exception if the given pointer is 0

Definition at line 121 of file TplConvert.h.

◆ _2strSec() [1/2]

template<class E >
static std::string TplConvert::_2strSec ( const E *const  data,
const std::string &  def 
)
inlinestatic

converts a 0-terminated char-type array into std::string

Returns
the default value if the data is empty

Definition at line 132 of file TplConvert.h.

References getLength().

Referenced by SUMOSAXAttributesImpl_Xerces::getStringSecure().

◆ _2strSec() [2/2]

template<class E >
static std::string TplConvert::_2strSec ( const E *const  data,
int  length,
const std::string &  def 
)
inlinestatic

converts a char-type array into std::string considering the given length

Returns
returns the default value if the data is empty

Definition at line 140 of file TplConvert.h.

References _2str().

◆ _hex2int()

template<class E >
static int TplConvert::_hex2int ( const E *const  data)
inlinestatic

converts a char-type array with a hex value into the integer value described by it

Exceptions
anEmptyData - exception if the given string is empty
aNumberFormatException - exception when the string does not contain an integer

Definition at line 176 of file TplConvert.h.

References _hex2long().

Referenced by _strHex2int(), and RGBColor::parseColor().

◆ _hex2long()

template<class E >
static long long int TplConvert::_hex2long ( const E *const  data)
inlinestatic

converts a char-type array with a hex value into the long value described by it

Exceptions
anEmptyData - exception if the given string is empty
aNumberFormatException - exception when the string does not contain a long

Definition at line 252 of file TplConvert.h.

Referenced by _hex2int().

◆ _str2Bool()

static bool TplConvert::_str2Bool ( const std::string &  sData)
inlinestatic

converts a string into the bool value described by it by calling the char-type converter

Exceptions
anEmptyData - exception if the given string is empty
aNumberFormatException - exception when the string does not contain a bool

Definition at line 410 of file TplConvert.h.

References _2bool().

Referenced by GNEAttributeCarrier::parse().

◆ _str2double()

static double TplConvert::_str2double ( const std::string &  sData)
inlinestatic

converts a string into the double value described by it by calling the char-type converter

Exceptions
anEmptyData - exception if the given string is empty
aNumberFormatException - exception when the string does not contain a double

Definition at line 363 of file TplConvert.h.

References _2double().

Referenced by SUMOVTypeParameter::getCFParam(), SUMOVTypeParameter::getJMParam(), SUMOVTypeParameter::getLCParam(), NIImporter_Vissim::NIVissimXMLHandler_Streckendefinition::myEndElement(), NIImporter_Vissim::NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition::myEndElement(), Distribution_Parameterized::parse(), and GNEAttributeCarrier::parse().

◆ _str2int()

static int TplConvert::_str2int ( const std::string &  sData)
inlinestatic

converts a string into the integer value described by it by calling the char-type converter, which

Exceptions
anEmptyData - exception if the given string is empty
NumberFormatException- exception when the string does not contain an integer

Definition at line 167 of file TplConvert.h.

References _2int().

Referenced by NIImporter_Vissim::NIVissimXMLHandler_Streckendefinition::myEndElement(), NIImporter_Vissim::NIVissimXMLHandler_Fahrzeugklassendefinition::myEndElement(), GNEAttributeCarrier::parse(), NIImporter_DlrNavteq::readDate(), NIVissimConflictArea::setPriorityRegulation(), and GUIMainWindow::setWindowSizeAndPos().

◆ _str2long()

static long long int TplConvert::_str2long ( const std::string &  sData)
inlinestatic

converts a string into the long value described by it by calling the char-type converter, which

Exceptions
anEmptyData - exception if the given string is empty
NumberFormatException- exception when the string does not contain a long integer

Definition at line 243 of file TplConvert.h.

References _2long().

Referenced by NBNodeCont::remapIDs(), and NBEdgeCont::remapIDs().

◆ _strHex2int()

static int TplConvert::_strHex2int ( const std::string &  sData)
inlinestatic

converts a string with a hex value into the integer value described by it by calling the char-type converter

Exceptions
anEmptyData - exception if the given string is empty
aNumberFormatException - exception when the string does not contain an integer

Definition at line 188 of file TplConvert.h.

References _hex2int().

Referenced by NIImporter_Vissim::NIVissimXMLHandler_Fahrzeugklassendefinition::myEndElement().

◆ getLength()

template<class E >
static int TplConvert::getLength ( const E *const  data)
inlinestatic

returns the length of the string (the position of the 0-character)

Definition at line 429 of file TplConvert.h.

Referenced by _2str(), and _2strSec().


The documentation for this class was generated from the following file: