EMANE  1.2.1
EMANE::Utils::ParameterConvert Class Reference

Parameter conversion class with range checks. More...

#include <parameterconvert.h>

Classes

class  ConversionException
 Parameter conversion exception class. More...
 

Public Member Functions

 ParameterConvert (const std::string &sParameter)
 
 ~ParameterConvert ()
 
std::int64_t toINT64 (std::int64_t i64Min=std::numeric_limits< std::int64_t >::min(), std::int64_t i64Max=std::numeric_limits< std::int64_t >::max()) const
 
std::uint64_t toUINT64 (std::uint64_t u64Min=std::numeric_limits< std::uint64_t >::min(), std::uint64_t u64Max=std::numeric_limits< std::uint64_t >::max()) const
 
std::int32_t toINT32 (std::int32_t i32Min=std::numeric_limits< std::int32_t >::min(), std::int32_t i32Max=std::numeric_limits< std::int32_t >::max()) const
 
std::uint32_t toUINT32 (std::uint32_t u32Min=std::numeric_limits< std::uint32_t >::min(), std::uint32_t u32Max=std::numeric_limits< std::uint32_t >::max()) const
 
std::int16_t toINT16 (std::int16_t i16Min=std::numeric_limits< std::int16_t >::min(), std::int16_t i16Max=std::numeric_limits< std::int16_t >::max()) const
 
std::uint16_t toUINT16 (std::uint16_t u16Min=std::numeric_limits< std::uint16_t >::min(), std::uint16_t u16Max=std::numeric_limits< std::uint16_t >::max()) const
 
std::int8_t toINT8 (std::int8_t i8Min=std::numeric_limits< std::int8_t >::min(), std::int8_t i8Max=std::numeric_limits< std::int8_t >::max()) const
 
std::uint8_t toUINT8 (std::uint8_t u8Min=std::numeric_limits< std::uint8_t >::min(), std::uint8_t u8Max=std::numeric_limits< std::uint8_t >::max()) const
 
float toFloat (float fMin=std::numeric_limits< float >::lowest(), float fMax=std::numeric_limits< float >::max()) const
 
double toDouble (double dMin=std::numeric_limits< double >::lowest(), double dMax=std::numeric_limits< double >::max()) const
 
INETAddr toINETAddr () const
 
bool toBool () const
 

Detailed Description

Parameter conversion class with range checks.

Definition at line 53 of file parameterconvert.h.

Constructor & Destructor Documentation

◆ ParameterConvert()

EMANE::Utils::ParameterConvert::ParameterConvert ( const std::string &  sParameter)
inline

Creates a ParameterConvert instance

Parameters
sParameterValue as a string

Definition at line 124 of file parameterconvert.inl.

◆ ~ParameterConvert()

EMANE::Utils::ParameterConvert::~ParameterConvert ( )
inline

Destroys an instance

Definition at line 128 of file parameterconvert.inl.

Member Function Documentation

◆ toBool()

bool EMANE::Utils::ParameterConvert::toBool ( ) const
inline

Convert parameter string to an bool

Returns
bool value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 247 of file parameterconvert.inl.

◆ toDouble()

double EMANE::Utils::ParameterConvert::toDouble ( double  dMin = std::numeric_limits<double>::lowest(),
double  dMax = std::numeric_limits<double>::max() 
) const
inline

Convert parameter string to a double

Parameters
dMinMinimum value in range
dMaxMaximum value in range
Returns
double value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 291 of file parameterconvert.inl.

◆ toFloat()

float EMANE::Utils::ParameterConvert::toFloat ( float  fMin = std::numeric_limits<float>::lowest(),
float  fMax = std::numeric_limits<float>::max() 
) const
inline

Convert parameter string to a float

Parameters
fMinMinimum value in range
fMaxMaximum value in range
Returns
float value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 331 of file parameterconvert.inl.

◆ toINETAddr()

EMANE::INETAddr EMANE::Utils::ParameterConvert::toINETAddr ( ) const
inline

Convert parameter string to an INETAddr

Returns
INETAddr value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 272 of file parameterconvert.inl.

◆ toINT16()

std::int16_t EMANE::Utils::ParameterConvert::toINT16 ( std::int16_t  i16Min = std::numeric_limits<std::int16_t>::min(),
std::int16_t  i16Max = std::numeric_limits<std::int16_t>::max() 
) const
inline

Convert parameter string to an std::int16_t

Parameters
i16MinMinimum value in range
i16MaxMaximum value in range
Returns
std::int16_t value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 223 of file parameterconvert.inl.

◆ toINT32()

std::int32_t EMANE::Utils::ParameterConvert::toINT32 ( std::int32_t  i32Min = std::numeric_limits<std::int32_t>::min(),
std::int32_t  i32Max = std::numeric_limits<std::int32_t>::max() 
) const
inline

Convert parameter string to an std::int32_t

Parameters
i32MinMinimum value in range
i32MaxMaximum value in range
Returns
std::int32_t value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 211 of file parameterconvert.inl.

◆ toINT64()

std::int64_t EMANE::Utils::ParameterConvert::toINT64 ( std::int64_t  i64Min = std::numeric_limits<std::int64_t>::min(),
std::int64_t  i64Max = std::numeric_limits<std::int64_t>::max() 
) const
inline

Convert parameter string to an std::int64_t

Parameters
i64MinMinimum value in range
i64MaxMaximum value in range
Returns
std::int64_t value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 131 of file parameterconvert.inl.

◆ toINT8()

std::int8_t EMANE::Utils::ParameterConvert::toINT8 ( std::int8_t  i8Min = std::numeric_limits<std::int8_t>::min(),
std::int8_t  i8Max = std::numeric_limits<std::int8_t>::max() 
) const
inline

Convert parameter string to an std::int8_t

Parameters
i8MinMinimum value in range
i8MaxMaximum value in range
Returns
std::int8_t value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 235 of file parameterconvert.inl.

◆ toUINT16()

std::uint16_t EMANE::Utils::ParameterConvert::toUINT16 ( std::uint16_t  u16Min = std::numeric_limits<std::uint16_t>::min(),
std::uint16_t  u16Max = std::numeric_limits<std::uint16_t>::max() 
) const
inline

Convert parameter string to an std::uint16_t

Parameters
u16MinMinimum value in range
u16MaxMaximum value in range
Returns
std::uint16_t value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 229 of file parameterconvert.inl.

◆ toUINT32()

std::uint32_t EMANE::Utils::ParameterConvert::toUINT32 ( std::uint32_t  u32Min = std::numeric_limits<std::uint32_t>::min(),
std::uint32_t  u32Max = std::numeric_limits<std::uint32_t>::max() 
) const
inline

Convert parameter string to an std::uint32_t

Parameters
u32MinMinimum value in range
u32MaxMaximum value in range
Returns
std::uint32_t value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 217 of file parameterconvert.inl.

◆ toUINT64()

std::uint64_t EMANE::Utils::ParameterConvert::toUINT64 ( std::uint64_t  u64Min = std::numeric_limits<std::uint64_t>::min(),
std::uint64_t  u64Max = std::numeric_limits<std::uint64_t>::max() 
) const
inline

Convert parameter string to an std::uint64_t

Parameters
u64MinMinimum value in range
u64MaxMaximum value in range
Returns
std::uint64_t value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 171 of file parameterconvert.inl.

◆ toUINT8()

std::uint8_t EMANE::Utils::ParameterConvert::toUINT8 ( std::uint8_t  u8Min = std::numeric_limits<std::uint8_t>::min(),
std::uint8_t  u8Max = std::numeric_limits<std::uint8_t>::max() 
) const
inline

Convert parameter string to an std::uint8_t

Parameters
u8MinMinimum value in range
u8MaxMaximum value in range
Returns
std::uint8_t value
Exceptions
ConversionExceptionThrown when an error is encountered during conversion either to input format or out of range value.

Definition at line 241 of file parameterconvert.inl.


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