Jpp
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Attributes | Friends | List of all members
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 JSupervisor supervisor_type
 

Public Member Functions

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

Static Public Member Functions

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

Protected Member Functions

virtual void do_compile ()
 Function compilation. More...
 

Protected Attributes

JSupervisor supervisor
 

Private Attributes

result_type __y
 

Friends

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

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 >
typedef 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 >
typedef 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 >
typedef 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>
typedef JFunctional<JArgument_t, JResult_t> JTOOLS::JFunction1D< JArgument_t, JResult_t >::functional_type
inherited

Definition at line 322 of file JFunctional.hh.

◆ supervisor_type

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

Definition at line 89 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 320 of file JFunctional.hh.

320 { NUMBER_OF_DIMENSIONS = 1 };

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  :
40  function_type(),
41  __y()
42  {}

◆ 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  :
51  function_type(),
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  :
62  function_type(),
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
inlinevirtual

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 ( )
inlineprotectedvirtual

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 333 of file JFunctional.hh.

334  {
335  return this->evaluate(&x);
336  }

◆ 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 107 of file JFunctional.hh.

109  {
110  return function.evaluate(pX);
111  }

◆ 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 121 of file JFunctional.hh.

123  {
124  return value;
125  }

◆ getSupervisor()

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

Get supervisor.

Returns
supervisor

Definition at line 266 of file JFunctional.hh.

267  {
268  return supervisor;
269  }

◆ getExceptionHandler()

template<class JArgument_t, class JResult_t>
const JExceptionHandler& JTOOLS::JFunctional< JArgument_t, JResult_t >::getExceptionHandler ( ) const
inlineinherited

Get exception handler.

Returns
exception handler

Definition at line 277 of file JFunctional.hh.

278  {
279  return *supervisor;
280  }

◆ setExceptionHandler()

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

Set the supervisor for handling of exceptions.

Parameters
supervisorsupervisor

Definition at line 288 of file JFunctional.hh.

289  {
290  this->supervisor = supervisor;
291  }

Friends And Related Function 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::JFunctional< JArgument_t, JResult_t >::supervisor
protectedinherited

Definition at line 295 of file JFunctional.hh.


The documentation for this class was generated from the following file:
JTOOLS::JFunctional::supervisor
JSupervisor supervisor
Definition: JFunctional.hh:295
JTOOLS::pX
pX
Definition: JPolint.hh:625
JTOOLS::JConstantFunction1D::__y
result_type __y
Definition: JConstantFunction1D.hh:202
JTOOLS::JFunction1D::NUMBER_OF_DIMENSIONS
Definition: JFunctional.hh:320
JTOOLS::JFunctional::evaluate
virtual result_type evaluate(const argument_type *pX) const =0
Recursive function value evaluation.
JTOOLS::JConstantFunction1D::function_type
JFunction1D< JArgument_t, JResult_t > function_type
Definition: JConstantFunction1D.hh:31