bpp-core3  3.0.0
bpp::ConstraintException Class Reference

Exception thrown when a value do not match a given constraint. More...

#include <Bpp/Numeric/ParameterExceptions.h>

+ Inheritance diagram for bpp::ConstraintException:
+ Collaboration diagram for bpp::ConstraintException:

Public Member Functions

 ConstraintException (const std::string &text, const Parameter *param, double badValue)
 Build a new ConstraintException object. More...
 
virtual ~ConstraintException ()
 
virtual double getBadValue () const
 Get the value that doesn't match the constraint. More...
 
virtual const Parameterparameter () const
 Get the parameter that threw the exception. More...
 
const char * what () const noexcept override
 Method to get the message of the exception (STL method redefinition). More...
 
const std::string & message () const noexcept
 Access the message as a std::string. More...
 

Private Attributes

double badValue_
 

Detailed Description

Exception thrown when a value do not match a given constraint.

See also
Constraint

Definition at line 67 of file ParameterExceptions.h.

Constructor & Destructor Documentation

◆ ConstraintException()

ConstraintException::ConstraintException ( const std::string &  text,
const Parameter param,
double  badValue 
)

Build a new ConstraintException object.

Parameters
textA message to be passed to the exception hierarchy.
paramA const pointer toward the parameter that threw the exception.
badValueThe value that doesn't match the constraint.

Definition at line 24 of file ParameterExceptions.cpp.

◆ ~ConstraintException()

virtual bpp::ConstraintException::~ConstraintException ( )
inlinevirtual

Definition at line 83 of file ParameterExceptions.h.

Member Function Documentation

◆ getBadValue()

double ConstraintException::getBadValue ( ) const
virtual

Get the value that doesn't match the constraint.

Returns
The faulty value.

Definition at line 29 of file ParameterExceptions.cpp.

References badValue_.

Referenced by bpp::AutoParameter::setValue().

◆ message()

const std::string & bpp::Exception::message ( ) const
noexceptinherited

Access the message as a std::string.

Definition at line 79 of file Exceptions.cpp.

References bpp::Exception::message_.

◆ parameter()

const Parameter * ParameterException::parameter ( ) const
virtualinherited

Get the parameter that threw the exception.

Returns
A const pointer toward the parameter.

Definition at line 20 of file ParameterExceptions.cpp.

References bpp::ParameterException::parameter_.

Referenced by bpp::ParameterException::~ParameterException(), and bpp::ParameterNotFoundException::~ParameterNotFoundException().

◆ what()

const char * bpp::Exception::what ( ) const
overridenoexceptinherited

Method to get the message of the exception (STL method redefinition).

Returns
The message passed to the exception hierarchy.

Definition at line 78 of file Exceptions.cpp.

References bpp::Exception::message_.

Member Data Documentation

◆ badValue_

double bpp::ConstraintException::badValue_
private

Definition at line 70 of file ParameterExceptions.h.

Referenced by getBadValue().


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