Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CLHEP
CLHEP
Commits
4785410b
Commit
4785410b
authored
Jul 25, 2016
by
Joseph Boudreau
Browse files
Adding override keyword to functions overriding virtual functions in the base class
parent
36504d21
Changes
83
Hide whitespace changes
Inline
Side-by-side
GenericFunctions/GenericFunctions/ACos.hh
View file @
4785410b
...
...
@@ -28,14 +28,14 @@ namespace Genfun {
ACos
(
const
ACos
&
right
);
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Derivative.
Derivative
partial
(
unsigned
int
)
const
;
Derivative
partial
(
unsigned
int
)
const
override
;
// Does this function have an analytic derivative?
virtual
bool
hasAnalyticDerivative
()
const
{
return
true
;}
virtual
bool
hasAnalyticDerivative
()
const
override
{
return
true
;}
private:
...
...
GenericFunctions/GenericFunctions/ASin.hh
View file @
4785410b
...
...
@@ -26,14 +26,14 @@ namespace Genfun {
ASin
(
const
ASin
&
right
);
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Derivative.
Derivative
partial
(
unsigned
int
)
const
;
Derivative
partial
(
unsigned
int
)
const
override
;
// Does this function have an analytic derivative?
virtual
bool
hasAnalyticDerivative
()
const
{
return
true
;}
virtual
bool
hasAnalyticDerivative
()
const
override
{
return
true
;}
private:
...
...
GenericFunctions/GenericFunctions/ATan.hh
View file @
4785410b
...
...
@@ -26,14 +26,14 @@ namespace Genfun {
ATan
(
const
ATan
&
right
);
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Derivative.
Derivative
partial
(
unsigned
int
)
const
;
Derivative
partial
(
unsigned
int
)
const
override
;
// Does this function have an analytic derivative?
virtual
bool
hasAnalyticDerivative
()
const
{
return
true
;}
virtual
bool
hasAnalyticDerivative
()
const
override
{
return
true
;}
private:
...
...
GenericFunctions/GenericFunctions/Abs.hh
View file @
4785410b
...
...
@@ -28,8 +28,8 @@ namespace Genfun {
virtual
~
Abs
();
// Retrieve function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
private:
...
...
GenericFunctions/GenericFunctions/AbsFunction.hh
View file @
4785410b
...
...
@@ -59,7 +59,7 @@ namespace Genfun {
virtual
~
AbsFunction
();
// Function value: N-dimensional functions must override these:
virtual
unsigned
int
dimensionality
()
const
;
// returns 1;
virtual
unsigned
int
dimensionality
()
const
;
// returns 1;
// Function value
virtual
double
operator
()
(
double
argument
)
const
=
0
;
...
...
@@ -129,39 +129,24 @@ typedef const AbsFunction & GENFUNCTION;
//----------------------------------------------------------------------------
//
// This macro does all the ugly boilerplate. For reference I will lis what
// it is doing:
//
// 1). It uses the base class function composition operator. It would be
// nice to just use the
//
// using AbsFunction::operator();
//
// directive but unfortunately this is compiler-dependent!
// These macros do all the ugly boilerplate.
//
//----------------------------------------------------------------------------
// A more modern way to accomplish this, which is slicker:
#define FUNCTION_OBJECT_DEF(classname) \
public: \
virtual FunctionComposition operator()(const AbsFunction &function) const; \
virtual ParameterComposition operator()(const AbsParameter &p) const; \
virtual classname *clone() const; \
using Genfun::AbsFunction::operator(); \
virtual classname *clone() const override; \
private:
//----------------------------------------------------------------------------
//
// This macro implements the ugly boilerplate
//
#define FUNCTION_OBJECT_IMP(classname) \
inline FunctionComposition classname::operator()(const AbsFunction & function) const\
{ \
return AbsFunction::operator() (function); \
} \
inline ParameterComposition classname::operator()(const AbsParameter & p) const\
{ \
return AbsFunction::operator() (p); \
} \
inline classname *classname::clone() const \
{ \
return new classname(*this); \
...
...
GenericFunctions/GenericFunctions/Airy.hh
View file @
4785410b
...
...
@@ -28,8 +28,8 @@ namespace Genfun {
virtual
~
Airy
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
private:
...
...
GenericFunctions/GenericFunctions/AnalyticConvolution.hh
View file @
4785410b
...
...
@@ -47,8 +47,8 @@ namespace Genfun {
virtual
~
AnalyticConvolution
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Frequency of oscillation
Parameter
&
frequency
();
...
...
GenericFunctions/GenericFunctions/ArrayFunction.hh
View file @
4785410b
...
...
@@ -27,8 +27,8 @@ class ArrayFunction : public AbsFunction {
ArrayFunction
(
const
ArrayFunction
&
right
);
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
private:
...
...
GenericFunctions/GenericFunctions/AssociatedLaguerre.hh
View file @
4785410b
...
...
@@ -37,8 +37,8 @@ namespace Genfun {
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Get the integer variable n
unsigned
int
n
()
const
;
...
...
GenericFunctions/GenericFunctions/AssociatedLegendre.hh
View file @
4785410b
...
...
@@ -33,8 +33,8 @@ namespace Genfun {
virtual
~
AssociatedLegendre
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Get the integer variable l
unsigned
int
l
()
const
;
...
...
GenericFunctions/GenericFunctions/Bessel.hh
View file @
4785410b
...
...
@@ -47,8 +47,8 @@ namespace FractionalOrder {
virtual
~
Bessel
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Get the order of the Bessel Function. Default value, 0.0. If modified the
// Bessel function
...
...
@@ -92,8 +92,8 @@ namespace IntegralOrder {
virtual
~
Bessel
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
private:
...
...
GenericFunctions/GenericFunctions/BetaDistribution.hh
View file @
4785410b
...
...
@@ -34,8 +34,8 @@ namespace Genfun {
virtual
~
BetaDistribution
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Get the paramter alpha
Parameter
&
alpha
();
...
...
GenericFunctions/GenericFunctions/BivariateGaussian.hh
View file @
4785410b
...
...
@@ -33,11 +33,11 @@ namespace Genfun {
virtual
~
BivariateGaussian
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
// Gives an error.
virtual
double
operator
()(
const
Argument
&
a
)
const
;
// Must use this one
virtual
double
operator
()(
double
argument
)
const
override
;
// Gives an error.
virtual
double
operator
()(
const
Argument
&
a
)
const
override
;
// Must use this one
// Dimensionality
virtual
unsigned
int
dimensionality
()
const
;
virtual
unsigned
int
dimensionality
()
const
override
;
// Get the mean of the BivariateGaussian
Parameter
&
mean0
();
...
...
GenericFunctions/GenericFunctions/ClassicalSolver.hh
View file @
4785410b
...
...
@@ -89,8 +89,8 @@ namespace Genfun {
EnergyFunction
(
const
EnergyFunction
&
right
);
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
private:
...
...
GenericFunctions/GenericFunctions/ConstMinusFunction.hh
View file @
4785410b
...
...
@@ -33,17 +33,17 @@ namespace Genfun {
virtual
~
ConstMinusFunction
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
;
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
;
// Dimensionality
virtual
unsigned
int
dimensionality
()
const
;
virtual
unsigned
int
dimensionality
()
const
override
;
// Derivative.
Derivative
partial
(
unsigned
int
)
const
;
Derivative
partial
(
unsigned
int
)
const
override
;
// Does this function have an analytic derivative?
virtual
bool
hasAnalyticDerivative
()
const
{
return
true
;}
virtual
bool
hasAnalyticDerivative
()
const
override
{
return
true
;}
private:
...
...
GenericFunctions/GenericFunctions/ConstOverFunction.hh
View file @
4785410b
...
...
@@ -33,17 +33,17 @@ namespace Genfun {
virtual
~
ConstOverFunction
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
;
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
;
// Dimensionality
virtual
unsigned
int
dimensionality
()
const
;
virtual
unsigned
int
dimensionality
()
const
override
;
// Derivative.
Derivative
partial
(
unsigned
int
)
const
;
Derivative
partial
(
unsigned
int
)
const
override
;
// Does this function have an analytic derivative?
virtual
bool
hasAnalyticDerivative
()
const
{
return
true
;}
virtual
bool
hasAnalyticDerivative
()
const
override
{
return
true
;}
private:
...
...
GenericFunctions/GenericFunctions/ConstPlusFunction.hh
View file @
4785410b
...
...
@@ -33,17 +33,17 @@ namespace Genfun {
virtual
~
ConstPlusFunction
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
;
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
rgument
)
const
override
;
// Dimensionality
virtual
unsigned
int
dimensionality
()
const
;
virtual
unsigned
int
dimensionality
()
const
override
;
// Derivative.
Derivative
partial
(
unsigned
int
)
const
;
Derivative
partial
(
unsigned
int
)
const
override
;
// Does this function have an analytic derivative?
virtual
bool
hasAnalyticDerivative
()
const
{
return
true
;}
virtual
bool
hasAnalyticDerivative
()
const
override
{
return
true
;}
private:
...
...
GenericFunctions/GenericFunctions/ConstTimesFunction.hh
View file @
4785410b
...
...
@@ -32,17 +32,17 @@ namespace Genfun {
virtual
~
ConstTimesFunction
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
;
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
;
// Dimensionality
virtual
unsigned
int
dimensionality
()
const
;
virtual
unsigned
int
dimensionality
()
const
override
;
// Derivative.
Derivative
partial
(
unsigned
int
)
const
;
Derivative
partial
(
unsigned
int
)
const
override
;
// Does this function have an analytic derivative?
virtual
bool
hasAnalyticDerivative
()
const
{
return
true
;}
virtual
bool
hasAnalyticDerivative
()
const
override
{
return
true
;}
private:
...
...
GenericFunctions/GenericFunctions/Cos.hh
View file @
4785410b
...
...
@@ -32,14 +32,14 @@ namespace Genfun {
Cos
(
const
Cos
&
right
);
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Derivative.
Derivative
partial
(
unsigned
int
)
const
;
Derivative
partial
(
unsigned
int
)
const
override
;
// Does this function have an analytic derivative?
virtual
bool
hasAnalyticDerivative
()
const
{
return
true
;}
virtual
bool
hasAnalyticDerivative
()
const
override
{
return
true
;}
private:
...
...
GenericFunctions/GenericFunctions/CubicSplinePolynomial.hh
View file @
4785410b
...
...
@@ -34,8 +34,8 @@ namespace Genfun {
virtual
~
CubicSplinePolynomial
();
// Retreive function value
virtual
double
operator
()(
double
argument
)
const
;
virtual
double
operator
()(
const
Argument
&
a
)
const
{
return
operator
()
(
a
[
0
]);}
virtual
double
operator
()(
double
argument
)
const
override
;
virtual
double
operator
()(
const
Argument
&
a
)
const
override
{
return
operator
()
(
a
[
0
]);}
// Puncture this thing:
void
addPoint
(
double
x
,
double
y
);
...
...
Prev
1
2
3
4
5
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment