STE-Industries: utilities testing
GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE > Class Template Reference

#include "NumericParameterDescriptor.h"

Inheritance diagram for GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >:
Inheritance graph
Collaboration diagram for GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >:
Collaboration graph

Public Member Functions

 NumericParameterDescriptor (const char *thisName, NUMERIC_TYPE thisMinimum, NUMERIC_TYPE thisMaximum, NUMERIC_TYPE Bitmap::CorrectionParameters::*thisParameterPointer, EXCEPTION_TYPE thisException) noexcept
 
virtual ~NumericParameterDescriptor (void) noexcept=default
 
void Assign (const char *String, Bitmap::CorrectionParameters &Parameters) const noexcept(false)
 
void Assign (const char *String, Bitmap::CorrectionParameters &Parameters) const noexcept(false)
 
void Assign (const char *String, Bitmap::CorrectionParameters &Parameters) const noexcept(false) override
 
NUMERIC_TYPE GetMaximum (void) const noexcept
 
NUMERIC_TYPE GetMinimum (void) const noexcept
 
void PrintUsage (const Bitmap::CorrectionParameters &DefaultParameters) const noexcept(false) override
 
- Public Member Functions inherited from GraphicSpace::ParameterDescriptor
const char * GetName (void) const noexcept
 

Private Member Functions

 NumericParameterDescriptor (const NumericParameterDescriptor &Descriptor) noexcept=delete
 
 NumericParameterDescriptor (NumericParameterDescriptor &&Descriptor) noexcept=delete
 
void operator= (const NumericParameterDescriptor &Descriptor) noexcept=delete
 
void operator= (NumericParameterDescriptor &&Descriptor) noexcept=delete
 
const char * UsageFormat
 Template specialization valid when NUMERIC_TYPE is float. More...
 
const char * UsageFormat
 Template specialization valid when NUMERIC_TYPE is unsigned int. More...
 

Private Attributes

EXCEPTION_TYPE ExceptionKind
 
NUMERIC_TYPE Maximum
 
NUMERIC_TYPE Minimum
 
NUMERIC_TYPE Bitmap::CorrectionParameters::* ParameterPointer
 

Static Private Attributes

static const char * UsageFormat
 

Additional Inherited Members

- Static Public Attributes inherited from GraphicSpace::ParameterDescriptor
static constexpr char EQUAL_CHARACTER = '='
 
- Protected Member Functions inherited from GraphicSpace::ParameterDescriptor
 ParameterDescriptor (const char *thisName) noexcept
 
virtual ~ParameterDescriptor (void) noexcept
 

Detailed Description

template<typename NUMERIC_TYPE, typename EXCEPTION_TYPE>
class GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >

The NumericParameterDescriptor class template represents the descriptor of a command line parameter with integer value.

Template Parameters
NUMERIC_TYPEThe type of the parameter; it must be either uint_fast32_t or float.
EXCEPTION_TYPEThe type of the exception generated if a string to be converted is not composed only of digits or if it represents a number less than Minimum or greater than Maximum. It must be a predefined or enumerated type.

Definition at line 41 of file NumericParameterDescriptor.h.

Constructor & Destructor Documentation

◆ NumericParameterDescriptor() [1/3]

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::NumericParameterDescriptor ( const NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE > &  Descriptor)
privatedeletenoexcept

◆ NumericParameterDescriptor() [2/3]

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::NumericParameterDescriptor ( NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE > &&  Descriptor)
privatedeletenoexcept

◆ NumericParameterDescriptor() [3/3]

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::NumericParameterDescriptor ( const char *  thisName,
NUMERIC_TYPE  thisMinimum,
NUMERIC_TYPE  thisMaximum,
NUMERIC_TYPE Bitmap::CorrectionParameters::*  thisParameterPointer,
EXCEPTION_TYPE  thisException 
)
inlinenoexcept
Description:
Constructor.
Parameters
thisNamePointer to the string containing the name of the parameter.
thisMinimumMinimum value for the parameter.
thisMaximumMaximum value for the parameter.
thisParameterPointerMember pointer to the parameter within the CorrectionParameter struct.
thisExceptionThe kind of exception that is generated if a string to be converted is not composed only of digits or if it represents a number less than Minimum or greater than Maximum.
Exceptions
None.
Returns
Not applicable.
Note
if thisName is not a valid pointer to a properly terminated string, the behavior is undefined.

Definition at line 45 of file NumericParameterDescriptor.tpl.

◆ ~NumericParameterDescriptor()

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
virtual GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::~NumericParameterDescriptor ( void  )
virtualdefaultnoexcept

Member Function Documentation

◆ Assign() [1/3]

void GraphicSpace::NumericParameterDescriptor< float, FloatExceptionType >::Assign ( const char *  String,
Bitmap::CorrectionParameters Parameters 
) const
virtualnoexcept
Description:
Convert a string to an integer value and assign it to a parameter.
Template specialization valid when NUMERIC_TYPE is unsigned int and EXCEPTION_TYPE is IntegerExceptionType.
Parameters
StringPointer to the string containing the value of the parameter.
ParametersReference to the CorrectionParameter struct to modify with the new value.
Exceptions
FloatException::ExceptionKindIf String does not begin with an equal sign or the rest does not contain a valid real number without leading sign or extra characters.
Returns
None.
Note
if String is not a valid pointer to a properly terminated string, the behavior is undefined.
See also
EQUAL_CHARACTER
END_STRING

Reimplemented from GraphicSpace::ParameterDescriptor.

Definition at line 63 of file FloatParameterDescriptor.cpp.

References END_STRING.

◆ Assign() [2/3]

void GraphicSpace::NumericParameterDescriptor< unsigned int, IntegerExceptionType >::Assign ( const char *  String,
Bitmap::CorrectionParameters Parameters 
) const
virtualnoexcept
Description:
Convert a string to an integer value and assign it to a parameter.
Template specialization valid when NUMERIC_TYPE is unsigned int and EXCEPTION_TYPE is IntegerExceptionType.
Parameters
StringPointer to the string containing the value of the parameter.
ParametersReference to the CorrectionParameter struct to modify with the new value.
Exceptions
IntegerException::ExceptionKindIf String does not begin with an equal sign or the rest is not composed only of digits or if it represents a number less than Minimum or greater than Maximum.
Returns
None.
Note
if String is not a valid pointer to a properly terminated string, the behavior is undefined.
See also
EQUAL_CHARACTER
DECIMAL_BASE
END_STRING
UINT_MAX

Reimplemented from GraphicSpace::ParameterDescriptor.

Definition at line 66 of file IntegerParameterDescriptor.cpp.

References DECIMAL_BASE, and END_STRING.

◆ Assign() [3/3]

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
void GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::Assign ( const char *  String,
Bitmap::CorrectionParameters Parameters 
) const
overridevirtualnoexcept

Reimplemented from GraphicSpace::ParameterDescriptor.

◆ GetMaximum()

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
NUMERIC_TYPE GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::GetMaximum ( void  ) const
inlinenoexcept
Description:
Get the maximum value of the parameter.
Exceptions
None.
Returns
NUMERIC_TYPE The maximum value of the parameter.

Definition at line 84 of file NumericParameterDescriptor.tpl.

◆ GetMinimum()

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
NUMERIC_TYPE GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::GetMinimum ( void  ) const
inlinenoexcept
Description:
Get the minimum value of the parameter.
Exceptions
None.
Returns
NUMERIC_TYPE The minimum value of the parameter.

Definition at line 67 of file NumericParameterDescriptor.tpl.

◆ operator=() [1/2]

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
void GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::operator= ( const NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE > &  Descriptor)
privatedeletenoexcept

◆ operator=() [2/2]

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
void GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::operator= ( NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE > &&  Descriptor)
privatedeletenoexcept

◆ PrintUsage()

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
void GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::PrintUsage ( const Bitmap::CorrectionParameters DefaultParameters) const
inlineoverridevirtualnoexcept
Description:
Write on standard output a string describing a numeric command line parameter.
Parameters
DefaultParametersReference to the CorrectionParameter struct which contains the default parameters.
Exceptions
FileExceptionType::FILE_WRITE_ERRORIf an error occurs while writing the string.
Returns
None.
See also
STANDARD_OUTPUT
EQUAL_CHARACTER

Reimplemented from GraphicSpace::ParameterDescriptor.

Definition at line 111 of file NumericParameterDescriptor.tpl.

References DefaultParameters, GraphicSpace::FILE_WRITE_ERROR, and STANDARD_OUTPUT.

◆ UsageFormat() [1/2]

const char * GraphicSpace::NumericParameterDescriptor< float, FloatExceptionType >::UsageFormat
private

Template specialization valid when NUMERIC_TYPE is float.

Definition at line 30 of file FloatParameterDescriptor.cpp.

◆ UsageFormat() [2/2]

const char * GraphicSpace::NumericParameterDescriptor< unsigned int, IntegerExceptionType >::UsageFormat
private

Template specialization valid when NUMERIC_TYPE is unsigned int.

Definition at line 30 of file IntegerParameterDescriptor.cpp.

Member Data Documentation

◆ ExceptionKind

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::ExceptionKind
private

The kind of exception that is generated if a string to be converted is not composed only of digits or if it represents a number less than Minimum or greater than Maximum.

Definition at line 63 of file NumericParameterDescriptor.h.

◆ Maximum

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::Maximum
private

Maximum valid value of the parameter.

Definition at line 52 of file NumericParameterDescriptor.h.

◆ Minimum

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::Minimum
private

Minimum valid value of the parameter.

Definition at line 48 of file NumericParameterDescriptor.h.

◆ ParameterPointer

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::ParameterPointer
private

Member pointer to the parameter within the CorrectionParameter struct.

Definition at line 57 of file NumericParameterDescriptor.h.

◆ UsageFormat

template<typename NUMERIC_TYPE , typename EXCEPTION_TYPE >
GraphicSpace::NumericParameterDescriptor< NUMERIC_TYPE, EXCEPTION_TYPE >::UsageFormat
staticprivate

Format string used to write the usage message related to a numeric parameter.

Definition at line 68 of file NumericParameterDescriptor.h.


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