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 SUMOReal var)
 convert SUMOReal 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
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...
 
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 SUMOReal (Double)
template<class E >
static SUMOReal _2SUMOReal (const E *const data)
 converts a char-type array into the SUMOReal value described by it More...
 
static SUMOReal _str2SUMOReal (const std::string &sData)
 converts a string into the SUMOReal value described by it by calling the char-type converter More...
 
template<class E >
static SUMOReal _2SUMORealSec (const E *const data, SUMOReal def)
 converts a 0-terminated char-type array into the SUMOReal 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 SUMOReal 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 (SUMOReal, int, bool...)

Definition at line 52 of file TplConvert.h.

Member Function Documentation

§ _2bool()

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

converts a 0-terminated char-type array into the boolean 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'
Exceptions
anEmptyData - exception if the given string is empty or 0 pointer
aBoolFormatException in any other case

Definition at line 364 of file TplConvert.h.

References _2str().

Referenced by _2boolSec(), _str2Bool(), MSDevice::equippedByDefaultAssignmentOptions(), SUMOSAXAttributesImpl_Xerces::getBool(), NIImporter_VISUM::getWeightedBool(), MSSOTLTrafficLightLogic::isDecayThresholdActivated(), MSActuatedTrafficLightLogic::MSActuatedTrafficLightLogic(), GUISettingsHandler::myStartElement(), GUIDialog_ViewSettings::onCmdEditTable(), NIImporter_VISUM::parse_Edges(), NIImporter_VISUM::parse_TrafficLights(), GUISettingsHandler::parseSizeSettings(), GUISettingsHandler::parseTextSettings(), and Option_Bool::set().

§ _2boolSec()

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

converts a 0-terminated char-type array into the SUMOReal 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 391 of file TplConvert.h.

References _2bool().

§ _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 149 of file TplConvert.h.

References _2long(), max, and min.

Referenced by _2intSec(), _2SUMOReal(), _str2int(), NIXMLEdgesHandler::addSplit(), MFXAddEditTypedTable::getControlForItem(), OutputDevice::getDevice(), MSTLLogicControl::WAUTSwitchProcedure::getGSPValue(), SUMOSAXAttributesImpl_Xerces::getInt(), NINavTeqHelper::getLaneNumber(), MSSwarmTrafficLightLogic::getMaxCongestionDuration(), MSSOTLRequestPolicy::getMinDecisionalPhaseDuration(), MSSOTLRequestTrafficLightLogic::getMinDecisionalPhaseDuration(), MSSOTLTrafficLightLogic::getMode(), MSSwarmTrafficLightLogic::getReinforcementMode(), NINavTeqHelper::getSpeed(), MSSOTLTrafficLightLogic::getThreshold(), MSSwarmTrafficLightLogic::init(), NIImporter_SUMO::interpretLaneID(), PCLoaderVisum::load(), NIImporter_ITSUMO::Handler::myEndElement(), GUISettingsHandler::myStartElement(), NIImporter_MATSim::EdgesHandler::myStartElement(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), GNEVariableSpeedSignalDialog::onCmdRemoveRow(), NIVissimSingleTypeParser_Streckendefinition::parse(), NIVissimSingleTypeParser_VWunschentscheidungsdefinition::parse(), NIVissimSingleTypeParser_Kantensperrung::parse(), NIVissimSingleTypeParser_Knotendefinition::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(), Option_Integer::set(), Option_IntVector::set(), MSSOTLE2Sensors::setVehicleWeigths(), GNENet::splitEdge(), 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 186 of file TplConvert.h.

References _2int().

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

§ _2long()

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

converts a char-type array 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 200 of file TplConvert.h.

Referenced by _2int(), _2longSec(), SUMOSAXAttributesImpl_Xerces::getLong(), PCLoaderVisum::load(), MSStateHandler::myStartElement(), NIImporter_VISUM::parse_AreaSubPartElement(), NIImporter_VISUM::parse_Districts(), NIImporter_VISUM::parse_Kante(), NIImporter_VISUM::parse_PartOfArea(), and NIImporter_VISUM::parse_Point().

§ _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 276 of file TplConvert.h.

References _2long().

§ _2str() [1/7]

§ _2str() [2/7]

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

convert SUMOReal to string

Definition at line 64 of file TplConvert.h.

§ _2str() [3/7]

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

convert bool to string

Definition at line 71 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 84 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 94 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 118 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 128 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 135 of file TplConvert.h.

References _2str().

§ _2SUMOReal()

template<class E >
static SUMOReal TplConvert::_2SUMOReal ( const E *const  data)
inlinestatic

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

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

Definition at line 290 of file TplConvert.h.

References _2int(), and SUMOReal.

Referenced by _2SUMORealSec(), _str2SUMOReal(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::adaptLogic(), NBEdgeCont::applyOptions(), MSDevice_Battery::buildVehicleDevices(), MSDevice_Example::buildVehicleDevices(), MSSwarmTrafficLightLogic::getBetaNo(), MSSwarmTrafficLightLogic::getBetaSp(), SUMOSAXAttributesImpl_Xerces::getBoundary(), MSSwarmTrafficLightLogic::getChangePlanProbability(), MFXAddEditTypedTable::getControlForItem(), MSSOTLTrafficLightLogic::getDecayConstant(), SUMOSAXAttributesImpl_Xerces::getFloat(), SUMOSAXAttributesImpl_Binary::getFloat(), MSSwarmTrafficLightLogic::getForgettingCox(), MSSwarmTrafficLightLogic::getGammaNo(), MSSwarmTrafficLightLogic::getGammaSp(), MSSOTLTrafficLightLogic::getInputSensorsLength(), MSSwarmTrafficLightLogic::getLearningCox(), NIImporter_VISUM::getNamedFloat(), MSSOTLTrafficLightLogic::getOutputSensorsLength(), MSSwarmTrafficLightLogic::getPheroMaxVal(), SUMOSAXAttributesImpl_Xerces::getShape(), MSSOTLTrafficLightLogic::getSpeedThreshold(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::getStretchBereichDef(), MSSwarmTrafficLightLogic::getThetaInit(), MSSwarmTrafficLightLogic::getThetaMax(), MSSwarmTrafficLightLogic::getThetaMin(), getTurningDefaults(), NIImporter_VISUM::getWeightedFloat(), PushButtonLogic::init(), SigmoidLogic::init(), MSSwarmTrafficLightLogic::init(), PCLoaderVisum::load(), PCLoaderDlrNavteq::loadPolyFile(), MSActuatedTrafficLightLogic::MSActuatedTrafficLightLogic(), MSSOTLPolicy::MSSOTLPolicy(), NIImporter_ITSUMO::Handler::myEndElement(), GUISettingsHandler::myStartElement(), NIImporter_OpenStreetMap::NodesHandler::myStartElement(), NIImporter_OpenStreetMap::EdgesHandler::myStartElement(), GUIDialog_ViewSettings::onCmdEditTable(), NIVissimSingleTypeParser_Geschwindigkeitsverteilungsdefinition::parse(), NIVissimSingleTypeParser_Laengenverteilungsdefinition::parse(), NIVissimSingleTypeParser_Simdauer::parse(), NIVissimSingleTypeParser_Streckendefinition::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::EdgesHandler::report(), Option_Float::set(), MSTLLogicControl::WAUTSwitchProcedure_Stretch::stretchLogic(), and RODFDetector::writeEmitterDefinition().

§ _2SUMORealSec()

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

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

Returns
the default value if the data is empty

Definition at line 348 of file TplConvert.h.

References _2SUMOReal().

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

§ _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 168 of file TplConvert.h.

References _hex2long(), max, and min.

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 233 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 382 of file TplConvert.h.

References _2bool().

Referenced by GNEAttributeCarrier::getDefaultValue(), and GNEAttributeCarrier::parse().

§ _str2int()

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

§ _str2SUMOReal()

static SUMOReal TplConvert::_str2SUMOReal ( const std::string &  sData)
inlinestatic

converts a string into the SUMOReal 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 SUMOReal

Definition at line 341 of file TplConvert.h.

References _2SUMOReal().

Referenced by GNEAttributeCarrier::getDefaultValue(), NIImporter_Vissim::NIVissimXMLHandler_Streckendefinition::myEndElement(), NIImporter_Vissim::NIVissimXMLHandler_Geschwindigkeitsverteilungsdefinition::myEndElement(), GNECalibratorDialog::onCmdAddRow(), GNEVariableSpeedSignalDialog::onCmdAddRow(), and GNEAttributeCarrier::parse().

§ _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 179 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 401 of file TplConvert.h.

Referenced by _2str(), and _2strSec().


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