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 ParametergetParameter () 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_
 
const Parameterparameter_
 
std::string message_
 

Detailed Description

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

See also
Constraint

Definition at line 104 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 61 of file ParameterExceptions.cpp.

◆ ~ConstraintException()

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

Definition at line 120 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 66 of file ParameterExceptions.cpp.

References badValue_.

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

◆ getParameter()

const Parameter * ParameterException::getParameter ( ) const
virtualinherited

Get the parameter that threw the exception.

Returns
A const pointer toward the parameter.

Definition at line 57 of file ParameterExceptions.cpp.

References bpp::ParameterException::parameter_.

◆ message()

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

Access the message as a std::string.

Definition at line 119 of file Exceptions.cpp.

References bpp::Exception::message_.

◆ 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 118 of file Exceptions.cpp.

References bpp::Exception::message_.

Member Data Documentation

◆ badValue_

double bpp::ConstraintException::badValue_
private

Definition at line 107 of file ParameterExceptions.h.

Referenced by getBadValue().

◆ message_

std::string bpp::Exception::message_
privateinherited

◆ parameter_

const Parameter* bpp::ParameterException::parameter_
privateinherited

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