Jpp 19.3.0-rc.2
the software that should make you happy
Loading...
Searching...
No Matches
JTOOLS::JConstantFunction1D< JArgument_t, JResult_t > Class Template Reference

Template implementation of function object in one dimension returning a constant value. More...

#include <JConstantFunction1D.hh>

Inheritance diagram for JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >:
JTOOLS::JFunction1D< JArgument_t, JResult_t > JTOOLS::JFunction< JArgument_t, JResult_t > JTOOLS::JFunctional< JArgument_t, JResult_t >

Public Types

typedef JFunction1D< JArgument_t, JResult_t > function_type
 
typedef function_type::argument_type argument_type
 
typedef function_type::result_type result_type
 
enum  { NUMBER_OF_DIMENSIONS = 1 }
 
typedef JFunctional< JArgument_t, JResult_t > functional_type
 
typedef functional_type::JExceptionHandler JExceptionHandler
 
typedef JSupervisor supervisor_type
 

Public Member Functions

 JConstantFunction1D ()
 Default constructor.
 
 JConstantFunction1D (const result_type y)
 Constructor.
 
 JConstantFunction1D (const JMATH::JZero &y)
 Constructor.
 
JConstantFunction1Dadd (typename JLANG::JClass< result_type >::argument_type value)
 Add offset.
 
JConstantFunction1Dsub (typename JLANG::JClass< result_type >::argument_type value)
 Subtract offset.
 
JConstantFunction1Dmul (const double value)
 Scale contents.
 
JConstantFunction1Ddiv (const double value)
 Scale contents.
 
JConstantFunction1Dadd (const JConstantFunction1D &function)
 Add function.
 
JConstantFunction1Dsub (const JConstantFunction1D &function)
 Subtract function.
 
result_type getY () const
 Function value.
 
virtual result_type evaluate (const argument_type *pX) const override
 Function value evaluation.
 
result_type operator() (const argument_type x) const
 Function value evaluation.
 
const JSupervisorgetSupervisor () const
 Get supervisor.
 
const JExceptionHandlergetExceptionHandler () const override
 Get exception handler.
 
void setExceptionHandler (const JSupervisor &supervisor)
 Set the supervisor for handling of exceptions.
 

Static Public Member Functions

static result_type getValue (const JFunctional &function, const argument_type *pX)
 Recursive function value evaluation.
 
static JClass< result_type >::argument_type getValue (typename JClass< result_type >::argument_type value, const argument_type *pX)
 Termination of recursive function value evaluation.
 

Protected Member Functions

virtual void do_compile () override
 Function compilation.
 

Protected Attributes

JSupervisor __supervisor
 

Private Attributes

result_type __y
 

Friends

JReaderoperator>> (JReader &in, JConstantFunction1D &function)
 Read function from input.
 
JWriteroperator<< (JWriter &out, const JConstantFunction1D &function)
 Write function to output.
 

Detailed Description

template<class JArgument_t, class JResult_t>
class JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >

Template implementation of function object in one dimension returning a constant value.

This class implements the JFunction1D interface.

Definition at line 26 of file JConstantFunction1D.hh.

Member Typedef Documentation

◆ function_type

template<class JArgument_t , class JResult_t >
JFunction1D<JArgument_t, JResult_t> JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::function_type

Definition at line 31 of file JConstantFunction1D.hh.

◆ argument_type

template<class JArgument_t , class JResult_t >
function_type::argument_type JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::argument_type

Definition at line 32 of file JConstantFunction1D.hh.

◆ result_type

template<class JArgument_t , class JResult_t >
function_type::result_type JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::result_type

Definition at line 33 of file JConstantFunction1D.hh.

◆ functional_type

template<class JArgument_t , class JResult_t >
JFunctional<JArgument_t, JResult_t> JTOOLS::JFunction1D< JArgument_t, JResult_t >::functional_type
inherited

Definition at line 332 of file JFunctional.hh.

◆ JExceptionHandler

template<class JArgument_t , class JResult_t >
functional_type::JExceptionHandler JTOOLS::JFunction< JArgument_t, JResult_t >::JExceptionHandler
inherited

Definition at line 235 of file JFunctional.hh.

◆ supervisor_type

template<class JArgument_t , class JResult_t >
JSupervisor JTOOLS::JFunction< JArgument_t, JResult_t >::supervisor_type
inherited

Definition at line 237 of file JFunctional.hh.

Member Enumeration Documentation

◆ anonymous enum

template<class JArgument_t , class JResult_t >
anonymous enum
inherited
Enumerator
NUMBER_OF_DIMENSIONS 

Definition at line 330 of file JFunctional.hh.

Constructor & Destructor Documentation

◆ JConstantFunction1D() [1/3]

template<class JArgument_t , class JResult_t >
JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::JConstantFunction1D ( )
inline

Default constructor.

Definition at line 39 of file JConstantFunction1D.hh.

39 :
41 __y()
42 {}
JFunction1D< JArgument_t, JResult_t > function_type

◆ JConstantFunction1D() [2/3]

template<class JArgument_t , class JResult_t >
JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::JConstantFunction1D ( const result_type y)
inline

Constructor.

Parameters
yvalue

Definition at line 50 of file JConstantFunction1D.hh.

50 :
52 __y(y)
53 {}

◆ JConstantFunction1D() [3/3]

template<class JArgument_t , class JResult_t >
JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::JConstantFunction1D ( const JMATH::JZero & y)
inline

Constructor.

Parameters
yzero

Definition at line 61 of file JConstantFunction1D.hh.

61 :
63 __y(y)
64 {}

Member Function Documentation

◆ add() [1/2]

template<class JArgument_t , class JResult_t >
JConstantFunction1D & JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::add ( typename JLANG::JClass< result_type >::argument_type value)
inline

Add offset.

Parameters
valueoffset

Definition at line 72 of file JConstantFunction1D.hh.

73 {
74 __y += value;
75
76 return *this;
77 }

◆ sub() [1/2]

template<class JArgument_t , class JResult_t >
JConstantFunction1D & JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::sub ( typename JLANG::JClass< result_type >::argument_type value)
inline

Subtract offset.

Parameters
valueoffset

Definition at line 85 of file JConstantFunction1D.hh.

86 {
87 __y -= value;
88
89 return *this;
90 }

◆ mul()

template<class JArgument_t , class JResult_t >
JConstantFunction1D & JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::mul ( const double value)
inline

Scale contents.

Parameters
valuemultiplication factor

Definition at line 98 of file JConstantFunction1D.hh.

99 {
100 __y *= value;
101
102 return *this;
103 }

◆ div()

template<class JArgument_t , class JResult_t >
JConstantFunction1D & JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::div ( const double value)
inline

Scale contents.

Parameters
valuedivision factor

Definition at line 111 of file JConstantFunction1D.hh.

112 {
113 __y /= value;
114
115 return *this;
116 }

◆ add() [2/2]

template<class JArgument_t , class JResult_t >
JConstantFunction1D & JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::add ( const JConstantFunction1D< JArgument_t, JResult_t > & function)
inline

Add function.

Parameters
functionfunction

Definition at line 124 of file JConstantFunction1D.hh.

125 {
126 __y += function.getY();
127
128 return *this;
129 }

◆ sub() [2/2]

template<class JArgument_t , class JResult_t >
JConstantFunction1D & JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::sub ( const JConstantFunction1D< JArgument_t, JResult_t > & function)
inline

Subtract function.

Parameters
functionfunction

Definition at line 137 of file JConstantFunction1D.hh.

138 {
139 __y -= function.getY();
140
141 return *this;
142 }

◆ getY()

template<class JArgument_t , class JResult_t >
result_type JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::getY ( ) const
inline

Function value.

Returns
function value

Definition at line 150 of file JConstantFunction1D.hh.

151 {
152 return __y;
153 }

◆ evaluate()

template<class JArgument_t , class JResult_t >
virtual result_type JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::evaluate ( const argument_type * pX) const
inlineoverridevirtual

Function value evaluation.

Parameters
pXpointer to abscissa values
Returns
function value

Implements JTOOLS::JFunctional< JArgument_t, JResult_t >.

Definition at line 162 of file JConstantFunction1D.hh.

163 {
164 return __y;
165 }

◆ do_compile()

template<class JArgument_t , class JResult_t >
virtual void JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::do_compile ( )
inlineoverrideprotectedvirtual

Function compilation.

Definition at line 198 of file JConstantFunction1D.hh.

199 {}

◆ operator()()

template<class JArgument_t , class JResult_t >
result_type JTOOLS::JFunction1D< JArgument_t, JResult_t >::operator() ( const argument_type x) const
inlineinherited

Function value evaluation.

Parameters
xargument value
Returns
function value

Definition at line 343 of file JFunctional.hh.

344 {
345 return this->evaluate(&x);
346 }
virtual result_type evaluate(const argument_type *pX) const =0
Recursive function value evaluation.

◆ getSupervisor()

template<class JArgument_t , class JResult_t >
const JSupervisor & JTOOLS::JFunction< JArgument_t, JResult_t >::getSupervisor ( ) const
inlineinherited

Get supervisor.

Returns
supervisor

Definition at line 290 of file JFunctional.hh.

291 {
292 return __supervisor;
293 }
JSupervisor __supervisor

◆ getExceptionHandler()

template<class JArgument_t , class JResult_t >
const JExceptionHandler & JTOOLS::JFunction< JArgument_t, JResult_t >::getExceptionHandler ( ) const
inlineoverridevirtualinherited

Get exception handler.

Returns
exception handler

Implements JTOOLS::JFunctional< JArgument_t, JResult_t >.

Definition at line 301 of file JFunctional.hh.

302 {
303 return *__supervisor.handler;
304 }
std::shared_ptr< JExceptionHandler > handler

◆ setExceptionHandler()

template<class JArgument_t , class JResult_t >
void JTOOLS::JFunction< JArgument_t, JResult_t >::setExceptionHandler ( const JSupervisor & supervisor)
inlineinherited

Set the supervisor for handling of exceptions.

Parameters
supervisorsupervisor

Definition at line 312 of file JFunctional.hh.

313 {
314 this->__supervisor = supervisor;
315 }

◆ getValue() [1/2]

template<class JArgument_t , class JResult_t >
static result_type JTOOLS::JFunctional< JArgument_t, JResult_t >::getValue ( const JFunctional< JArgument_t, JResult_t > & function,
const argument_type * pX )
inlinestaticinherited

Recursive function value evaluation.

Parameters
functionfunction
pXpointer to abscissa values

Definition at line 103 of file JFunctional.hh.

105 {
106 return function.evaluate(pX);
107 }

◆ getValue() [2/2]

template<class JArgument_t , class JResult_t >
static JClass< result_type >::argument_type JTOOLS::JFunctional< JArgument_t, JResult_t >::getValue ( typename JClass< result_type >::argument_type value,
const argument_type * pX )
inlinestaticinherited

Termination of recursive function value evaluation.

Parameters
valueresult
pXpointer to abscissa values

Definition at line 117 of file JFunctional.hh.

119 {
120 return value;
121 }

Friends And Related Symbol Documentation

◆ operator>>

template<class JArgument_t , class JResult_t >
JReader & operator>> ( JReader & in,
JConstantFunction1D< JArgument_t, JResult_t > & function )
friend

Read function from input.

Parameters
inreader
functionfunction
Returns
reader

Definition at line 175 of file JConstantFunction1D.hh.

176 {
177 return in >> function.__y;
178 }

◆ operator<<

template<class JArgument_t , class JResult_t >
JWriter & operator<< ( JWriter & out,
const JConstantFunction1D< JArgument_t, JResult_t > & function )
friend

Write function to output.

Parameters
outwriter
functionfunction
Returns
writer

Definition at line 188 of file JConstantFunction1D.hh.

189 {
190 return out << function.__y;
191 }

Member Data Documentation

◆ __y

template<class JArgument_t , class JResult_t >
result_type JTOOLS::JConstantFunction1D< JArgument_t, JResult_t >::__y
private

Definition at line 202 of file JConstantFunction1D.hh.

◆ __supervisor

template<class JArgument_t , class JResult_t >
JSupervisor JTOOLS::JFunction< JArgument_t, JResult_t >::__supervisor
protectedinherited

Definition at line 318 of file JFunctional.hh.


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