Jpp master_rocky-44-g75b7c4f75
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JFunctional< JArgument_t, JResult_t >::JDefaultResult Struct Reference

Exception handler for functional object using default result. More...

#include <JFunctional.hh>

Inheritance diagram for JTOOLS::JFunctional< JArgument_t, JResult_t >::JDefaultResult:
JTOOLS::JFunctional< JArgument_t, JResult_t >::JExceptionHandler JLANG::JException

Public Member Functions

 JDefaultResult (const result_type value)
 Constructor.
 
 JDefaultResult (const JMATH::JZero &value)
 Constructor.
 
virtual result_type action (const JException &error) const override
 Implementation of exception handler.
 
result_type action () const
 Implementation of exception handler.
 

Private Member Functions

virtual const char * what () const override throw ()
 Get error message.
 

Static Private Member Functions

static std::string getDateAndTime ()
 Get date and time [UTC].
 
static std::ostream & getOstream ()
 Get output stream for conversion of exception.
 

Private Attributes

result_type defaultResult
 
const std::string buffer
 

Detailed Description

template<class JArgument_t, class JResult_t>
struct JTOOLS::JFunctional< JArgument_t, JResult_t >::JDefaultResult

Exception handler for functional object using default result.

Definition at line 178 of file JFunctional.hh.

Constructor & Destructor Documentation

◆ JDefaultResult() [1/2]

template<class JArgument_t , class JResult_t >
JTOOLS::JFunctional< JArgument_t, JResult_t >::JDefaultResult::JDefaultResult ( const result_type value)
inline

Constructor.

Parameters
valuedefault result in case of exception

Definition at line 186 of file JFunctional.hh.

186 :
188 defaultResult(value)
189 {}
JExceptionHandler()
Default constructor.

◆ JDefaultResult() [2/2]

template<class JArgument_t , class JResult_t >
JTOOLS::JFunctional< JArgument_t, JResult_t >::JDefaultResult::JDefaultResult ( const JMATH::JZero & value)
inline

Constructor.

Parameters
valuedefault result in case of exception

Definition at line 197 of file JFunctional.hh.

197 :
200 {}

Member Function Documentation

◆ action() [1/2]

template<class JArgument_t , class JResult_t >
virtual result_type JTOOLS::JFunctional< JArgument_t, JResult_t >::JDefaultResult::action ( const JException & error) const
inlineoverridevirtual

Implementation of exception handler.

This implementation returns the default value.

Parameters
errorerror
Returns
default value

Reimplemented from JTOOLS::JFunctional< JArgument_t, JResult_t >::JExceptionHandler.

Definition at line 210 of file JFunctional.hh.

211 {
212 return defaultResult;
213 }

◆ action() [2/2]

template<class JArgument_t , class JResult_t >
result_type JTOOLS::JFunctional< JArgument_t, JResult_t >::JExceptionHandler::action ( ) const
inlineinherited

Implementation of exception handler.

This implementation throws the exception.

Returns
value

Definition at line 155 of file JFunctional.hh.

156 {
157 return this->action(static_cast<const JException&>(*this));
158 }
JException(const std::string &error)
Constructor.
Definition JException.hh:46
result_type action() const
Implementation of exception handler.

◆ getDateAndTime()

static std::string JLANG::JException::getDateAndTime ( )
inlinestaticinherited

Get date and time [UTC].

Returns
date and time [UTC]

Definition at line 31 of file JException.hh.

32 {
33 using namespace std;
34
35 time_t result = time(NULL);
36
37 return asctime(gmtime(&result));
38 }

◆ what()

virtual const char * JLANG::JException::what ( ) const
throw ( )
inlineoverridevirtualinherited

Get error message.

Returns
error message

Definition at line 64 of file JException.hh.

65 {
66 return buffer.c_str();
67 }
const std::string buffer
Definition JException.hh:99

◆ getOstream()

static std::ostream & JLANG::JException::getOstream ( )
inlinestaticinherited

Get output stream for conversion of exception.

Note that the ostream is emptied before use.

Returns
ostream

Definition at line 89 of file JException.hh.

90 {
91 static std::ostringstream buffer;
92
93 buffer.str("");
94
95 return buffer;
96 }

Member Data Documentation

◆ defaultResult

template<class JArgument_t , class JResult_t >
result_type JTOOLS::JFunctional< JArgument_t, JResult_t >::JDefaultResult::defaultResult
private

Definition at line 216 of file JFunctional.hh.

◆ buffer

const std::string JLANG::JException::buffer
privateinherited

Definition at line 99 of file JException.hh.


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