Geant4
10.03
|
create a container for a c2_function which handles the reference counting. It is useful as a smart container to hold a c2_function and keep the reference count correct. The recommended way for a class to store a c2_function which is handed in from the outside is for it to have a c2_ptr member into which the passed-in function is stored. This way, when the class instance is deleted, it will automatically dereference any function which it was handed. More...
#include <c2_function.hh>
Public Member Functions | |
c2_const_ptr () | |
construct the container with no function More... | |
c2_const_ptr (const c2_function< float_type > &f) | |
construct the container with a pre-defined function More... | |
c2_const_ptr (const c2_const_ptr< float_type > &src) | |
copy constructor More... | |
void | set_function (const c2_function< float_type > *f) |
const c2_const_ptr< float_type > & | operator= (const c2_const_ptr< float_type > &f) |
fill the container from another container More... | |
const c2_function< float_type > & | operator= (const c2_function< float_type > &f) |
fill the container with a function More... | |
void | release_for_return () throw (c2_exception) |
release the function without destroying it, so it can be returned from a function More... | |
void | unset_function (void) |
clear the function More... | |
~c2_const_ptr () | |
destructor More... | |
const c2_function< float_type > & | get () const throw (c2_exception) |
get a reference to our owned function More... | |
const c2_function< float_type > * | get_ptr () const |
get an unchecked pointer to our owned function More... | |
const c2_function< float_type > * | operator-> () const |
get a checked pointer to our owned function More... | |
bool | valid () const |
check if we have a valid function More... | |
operator const c2_function< float_type > & () const | |
type coercion operator which lets us use a pointer as if it were a const c2_function More... | |
float_type | operator() (float_type x) const throw (c2_exception) |
convenience operator to make us look like a function More... | |
float_type | operator() (float_type x, float_type *yprime, float_type *yprime2) const throw (c2_exception) |
convenience operator to make us look like a function More... | |
c2_sum_p< float_type > & | operator+ (const c2_function< float_type > &rhs) const throw (c2_exception) |
factory function to create a c2_sum_p from a regular algebraic expression. More... | |
c2_diff_p< float_type > & | operator- (const c2_function< float_type > &rhs) const throw (c2_exception) |
c2_product_p< float_type > & | operator* (const c2_function< float_type > &rhs) const throw (c2_exception) |
c2_ratio_p< float_type > & | operator/ (const c2_function< float_type > &rhs) const throw (c2_exception) |
c2_composed_function_p < float_type > & | operator() (const c2_function< float_type > &inner) const throw (c2_exception) |
compose this function outside another. More... | |
Protected Attributes | |
const c2_function< float_type > * | func |
create a container for a c2_function which handles the reference counting. It is useful as a smart container to hold a c2_function and keep the reference count correct. The recommended way for a class to store a c2_function which is handed in from the outside is for it to have a c2_ptr member into which the passed-in function is stored. This way, when the class instance is deleted, it will automatically dereference any function which it was handed.
This class contains a copy constructor and operator=, to make it fairly easy to make a std::vector of these objects, and have it work as expected.
Definition at line 681 of file c2_function.hh.
|
inline |
construct the container with no function
Definition at line 684 of file c2_function.hh.
|
inline |
construct the container with a pre-defined function
f | the function to store |
Definition at line 687 of file c2_function.hh.
|
inline |
|
inline |
destructor
Definition at line 732 of file c2_function.hh.
|
inline |
get a reference to our owned function
Definition at line 735 of file c2_function.hh.
Referenced by G4ScreenedCoulombClassicalKinematics::DoScreeningComputation(), c2_ptr< G4double >::get(), and c2_typed_ptr< float_type, c2_class >::get().
|
inline |
get an unchecked pointer to our owned function
Definition at line 741 of file c2_function.hh.
Referenced by c2_const_ptr< G4double >::c2_const_ptr().
|
inline |
type coercion operator which lets us use a pointer as if it were a const c2_function
Definition at line 750 of file c2_function.hh.
|
inline |
convenience operator to make us look like a function
x | the value at which to evaluate the contained function |
Definition at line 756 of file c2_function.hh.
|
inline |
convenience operator to make us look like a function
x | the value at which to evaluate the contained function |
yprime | the derivative |
yprime2 | the second derivative |
Definition at line 767 of file c2_function.hh.
|
inline |
compose this function outside another.
inner | the inner function |
Definition at line 790 of file c2_function.hh.
|
inline |
Definition at line 780 of file c2_function.hh.
|
inline |
factory function to create a c2_sum_p from a regular algebraic expression.
rhs | the right-hand term of the sum |
Definition at line 774 of file c2_function.hh.
|
inline |
Definition at line 777 of file c2_function.hh.
|
inline |
get a checked pointer to our owned function
Definition at line 743 of file c2_function.hh.
|
inline |
Definition at line 783 of file c2_function.hh.
|
inline |
fill the container from another container
f | the container to copy |
Definition at line 703 of file c2_function.hh.
|
inline |
fill the container with a function
f | the function |
Definition at line 708 of file c2_function.hh.
|
inline |
release the function without destroying it, so it can be returned from a function
This is usually the very last line of a function before the return statement, so that any exceptions that happen during execution of the function will cause proper cleanup. Once the function has been released from its container this way, it is an orhpaned object until the caller claims it, so it could get lost if an exception happens.
Definition at line 720 of file c2_function.hh.
Referenced by LJZBLScreening().
|
inline |
Definition at line 693 of file c2_function.hh.
Referenced by c2_const_ptr< G4double >::c2_const_ptr(), c2_ptr< G4double >::c2_ptr(), c2_typed_ptr< float_type, c2_class >::c2_typed_ptr(), c2_const_ptr< G4double >::operator=(), c2_ptr< G4double >::operator=(), c2_typed_ptr< float_type, c2_class >::operator=(), c2_const_ptr< G4double >::unset_function(), and c2_const_ptr< G4double >::~c2_const_ptr().
|
inline |
clear the function
Any attempt to use this c2_plugin_function_p throws an exception if the saved function is cleared.
Definition at line 730 of file c2_function.hh.
|
inline |
check if we have a valid function
Definition at line 746 of file c2_function.hh.
|
protected |
Definition at line 795 of file c2_function.hh.
Referenced by c2_const_ptr< G4double >::get(), c2_const_ptr< G4double >::get_ptr(), c2_ptr< G4double >::get_ptr(), c2_typed_ptr< float_type, c2_class >::get_ptr(), c2_const_ptr< G4double >::release_for_return(), c2_const_ptr< G4double >::set_function(), and c2_const_ptr< G4double >::valid().