ECCE @ EIC Software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
c2_const_ptr< float_type > Class Template Reference

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 <geant4/tree/geant4-10.6-release/examples/extended/electromagnetic/TestEm7/include/c2_function.hh>

+ Inheritance diagram for c2_const_ptr< float_type >:

Public Member Functions

 c2_const_ptr ()
 construct the container with no function
 
 c2_const_ptr (const c2_function< float_type > &f)
 construct the container with a pre-defined function
 
 c2_const_ptr (const c2_const_ptr< float_type > &src)
 copy constructor
 
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
 
const c2_function< float_type > & operator= (const c2_function< float_type > &f)
 fill the container with a function
 
void release_for_return ()
 release the function without destroying it, so it can be returned from a function
 
void unset_function (void)
 clear the function
 
 ~c2_const_ptr ()
 destructor
 
const c2_function< float_type > & get () const
 get a reference to our owned function
 
const c2_function< float_type > * get_ptr () const
 get an unchecked pointer to our owned function
 
const c2_function< float_type > * operator-> () const
 get a checked pointer to our owned function
 
bool valid () const
 check if we have a valid function
 
 operator const c2_function< float_type > & () const
 type coercion operator which lets us use a pointer as if it were a const c2_function
 
float_type operator() (float_type x) const
 convenience operator to make us look like a function
 
float_type operator() (float_type x, float_type *yprime, float_type *yprime2) const
 convenience operator to make us look like a function
 
c2_sum_p< float_type > & operator+ (const c2_function< float_type > &rhs) const
 factory function to create a c2_sum_p from a regular algebraic expression.
 
c2_diff_p< float_type > & operator- (const c2_function< float_type > &rhs) const
 
c2_product_p< float_type > & operator* (const c2_function< float_type > &rhs) const
 
c2_ratio_p< float_type > & operator/ (const c2_function< float_type > &rhs) const
 
c2_composed_function_p
< float_type > & 
operator() (const c2_function< float_type > &inner) const
 compose this function outside another.
 

Protected Attributes

const c2_function< float_type > * func
 

Detailed Description

template<typename float_type>
class c2_const_ptr< float_type >

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 680 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 680 of file c2_function.hh

Constructor & Destructor Documentation

template<typename float_type>
c2_const_ptr< float_type >::c2_const_ptr ( )
inline

construct the container with no function

Definition at line 683 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 683 of file c2_function.hh

template<typename float_type>
c2_const_ptr< float_type >::c2_const_ptr ( const c2_function< float_type > &  f)
inline

construct the container with a pre-defined function

Parameters
fthe function to store

Definition at line 686 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 686 of file c2_function.hh

template<typename float_type>
c2_const_ptr< float_type >::c2_const_ptr ( const c2_const_ptr< float_type > &  src)
inline

copy constructor

Parameters
srcthe container to copy

Definition at line 690 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 690 of file c2_function.hh

template<typename float_type>
c2_const_ptr< float_type >::~c2_const_ptr ( )
inline

destructor

Definition at line 731 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 731 of file c2_function.hh

Member Function Documentation

template<typename float_type>
const c2_function<float_type>& c2_const_ptr< float_type >::get ( void  ) const
inline

get a reference to our owned function

Definition at line 734 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 734 of file c2_function.hh

Referenced by G4ScreenedCoulombClassicalKinematics::DoScreeningComputation(), c2_ptr< G4double >::get(), and c2_typed_ptr< float_type, c2_class >::get().

+ Here is the caller graph for this function:

template<typename float_type>
const c2_function<float_type>* c2_const_ptr< float_type >::get_ptr ( ) const
inline

get an unchecked pointer to our owned function

Definition at line 740 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 740 of file c2_function.hh

Referenced by c2_const_ptr< G4double >::c2_const_ptr().

+ Here is the caller graph for this function:

template<typename float_type>
c2_const_ptr< float_type >::operator const c2_function< float_type > & ( ) const
inline

type coercion operator which lets us use a pointer as if it were a const c2_function

Definition at line 749 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 749 of file c2_function.hh

template<typename float_type>
float_type c2_const_ptr< float_type >::operator() ( float_type  x) const
inline

convenience operator to make us look like a function

Parameters
xthe value at which to evaluate the contained function
Returns
the evaluated function

Definition at line 755 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 755 of file c2_function.hh

template<typename float_type>
float_type c2_const_ptr< float_type >::operator() ( float_type  x,
float_type *  yprime,
float_type *  yprime2 
) const
inline

convenience operator to make us look like a function

Parameters
xthe value at which to evaluate the contained function
yprimethe derivative
yprime2the second derivative
Returns
the evaluated function
Note
If you using this repeatedly, do const c2_function<float_type> &func=ptr; and use func(x). Calling this operator wastes some time, since it checks the alidity of the pointer every time.

Definition at line 766 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 766 of file c2_function.hh

template<typename float_type>
c2_composed_function_p<float_type>& c2_const_ptr< float_type >::operator() ( const c2_function< float_type > &  inner) const
inline

compose this function outside another.

Parameters
innerthe inner function
Returns
the composed function

Definition at line 789 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 789 of file c2_function.hh

template<typename float_type>
c2_product_p<float_type>& c2_const_ptr< float_type >::operator* ( const c2_function< float_type > &  rhs) const
inline

Definition at line 779 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 779 of file c2_function.hh

template<typename float_type>
c2_sum_p<float_type>& c2_const_ptr< float_type >::operator+ ( const c2_function< float_type > &  rhs) const
inline

factory function to create a c2_sum_p from a regular algebraic expression.

Parameters
rhsthe right-hand term of the sum
Returns
a new c2_function

Definition at line 773 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 773 of file c2_function.hh

template<typename float_type>
c2_diff_p<float_type>& c2_const_ptr< float_type >::operator- ( const c2_function< float_type > &  rhs) const
inline

Definition at line 776 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 776 of file c2_function.hh

template<typename float_type>
const c2_function<float_type>* c2_const_ptr< float_type >::operator-> ( ) const
inline

get a checked pointer to our owned function

Definition at line 742 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 742 of file c2_function.hh

template<typename float_type>
c2_ratio_p<float_type>& c2_const_ptr< float_type >::operator/ ( const c2_function< float_type > &  rhs) const
inline

Definition at line 782 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 782 of file c2_function.hh

template<typename float_type>
const c2_const_ptr<float_type>& c2_const_ptr< float_type >::operator= ( const c2_const_ptr< float_type > &  f)
inline

fill the container from another container

Parameters
fthe container to copy

Definition at line 702 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 702 of file c2_function.hh

template<typename float_type>
const c2_function<float_type>& c2_const_ptr< float_type >::operator= ( const c2_function< float_type > &  f)
inline

fill the container with a function

Parameters
fthe function

Definition at line 707 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 707 of file c2_function.hh

template<typename float_type>
void c2_const_ptr< float_type >::release_for_return ( )
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 719 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 719 of file c2_function.hh

Referenced by LJZBLScreening().

+ Here is the caller graph for this function:

template<typename float_type>
void c2_const_ptr< float_type >::set_function ( const c2_function< float_type > *  f)
inline

Definition at line 692 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 692 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().

+ Here is the caller graph for this function:

template<typename float_type>
void c2_const_ptr< float_type >::unset_function ( void  )
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 729 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 729 of file c2_function.hh

template<typename float_type>
bool c2_const_ptr< float_type >::valid ( ) const
inline

check if we have a valid function

Definition at line 745 of file c2_function.hh.

View newest version in sPHENIX GitHub at line 745 of file c2_function.hh

Member Data Documentation


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