Geant4.10
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Member Functions
c2_typed_ptr< float_type, c2_class > Class Template Reference

create a non-generic container for a c2_function which handles the reference counting. More...

#include <c2_function.hh>

Inheritance diagram for c2_typed_ptr< float_type, c2_class >:
c2_const_ptr< float_type >

Public Member Functions

 c2_typed_ptr ()
 construct the container with no function More...
 
 c2_typed_ptr (c2_class< float_type > &f)
 construct the container with a pre-defined function More...
 
 c2_typed_ptr (const c2_typed_ptr< float_type, c2_class > &src)
 copy constructor More...
 
c2_class< float_type > & get () const throw (c2_exception)
 get a reference to our owned function More...
 
c2_class< float_type > * operator-> () const
 get a checked pointer to our owned function More...
 
c2_class< float_type > * get_ptr () const
 get an unchecked pointer to our owned function More...
 
 operator c2_class< float_type > & () const
 type coercion operator which lets us use a pointer as if it were a c2_function More...
 
void operator= (const c2_typed_ptr< float_type, c2_class > &f)
 fill the container from another container More...
 
void operator= (c2_class< float_type > &f)
 fill the container with a function More...
 
- Public Member Functions inherited from c2_const_ptr< float_type >
 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)
 fill the container with a new function, or clear it with a null pointer More...
 
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)
 factory function to create a c2_diff_p from a regular algebraic expression. More...
 
c2_product_p< float_type > & operator* (const c2_function< float_type > &rhs) const throw (c2_exception)
 factory function to create a c2_product_p from a regular algebraic expression. More...
 
c2_ratio_p< float_type > & operator/ (const c2_function< float_type > &rhs) const throw (c2_exception)
 factory function to create a c2_ratio_p from a regular algebraic expression. More...
 
c2_composed_function_p
< float_type > & 
operator() (const c2_function< float_type > &inner) const throw (c2_exception)
 compose this function outside another. More...
 

Additional Inherited Members

- Protected Attributes inherited from c2_const_ptr< float_type >
const c2_function< float_type > * func
 

Detailed Description

template<typename float_type, template< typename > class c2_class>
class c2_typed_ptr< float_type, c2_class >

create a non-generic container for a c2_function which handles the reference counting.

See also
c2_const_ptr and Use of c2_ptr for memory management
Note
Overuse of this class will generate massive bloat. Use c2_ptr and c2_const_ptr if you don't really need specific pointer types.
See also
Use of c2_ptr for memory management

Definition at line 725 of file c2_function.hh.

Constructor & Destructor Documentation

template<typename float_type, template< typename > class c2_class>
c2_typed_ptr< float_type, c2_class >::c2_typed_ptr ( )
inline

construct the container with no function

Definition at line 728 of file c2_function.hh.

728 : c2_ptr<float_type>() {}
create a container for a c2_function which handles the reference counting.
Definition: c2_function.hh:86
template<typename float_type, template< typename > class c2_class>
c2_typed_ptr< float_type, c2_class >::c2_typed_ptr ( c2_class< float_type > &  f)
inline

construct the container with a pre-defined function

Parameters
fthe function to store

Definition at line 731 of file c2_function.hh.

References c2_const_ptr< float_type >::set_function().

732  : c2_const_ptr<float_type>() { this->set_function(&f); }
create a container for a c2_function which handles the reference counting.It is useful as a smart con...
Definition: c2_function.hh:566
void set_function(const c2_function< float_type > *f)
fill the container with a new function, or clear it with a null pointer
Definition: c2_function.hh:580
template<typename float_type, template< typename > class c2_class>
c2_typed_ptr< float_type, c2_class >::c2_typed_ptr ( const c2_typed_ptr< float_type, c2_class > &  src)
inline

copy constructor

Parameters
srcthe container to copy

Definition at line 735 of file c2_function.hh.

References c2_typed_ptr< float_type, c2_class >::get_ptr(), and c2_const_ptr< float_type >::set_function().

736  : c2_const_ptr<float_type>() { this->set_function(src.get_ptr()); }
create a container for a c2_function which handles the reference counting.It is useful as a smart con...
Definition: c2_function.hh:566
c2_class< float_type > * get_ptr() const
get an unchecked pointer to our owned function
Definition: c2_function.hh:747
void set_function(const c2_function< float_type > *f)
fill the container with a new function, or clear it with a null pointer
Definition: c2_function.hh:580

Member Function Documentation

template<typename float_type, template< typename > class c2_class>
c2_class<float_type>& c2_typed_ptr< float_type, c2_class >::get ( ) const
throw (c2_exception
)
inline

get a reference to our owned function

Definition at line 739 of file c2_function.hh.

References c2_const_ptr< float_type >::get().

740  {
741  return *static_cast<c2_class<float_type> *>(const_cast<c2_function<float_type>*>(&c2_const_ptr<float_type>::get()));
742  }
const c2_function< float_type > & get() const
get a reference to our owned function
Definition: c2_function.hh:614
the parent class for all c2_functions.c2_functions know their value, first, and second derivative at ...
Definition: c2_function.hh:138
template<typename float_type, template< typename > class c2_class>
c2_class<float_type>* c2_typed_ptr< float_type, c2_class >::get_ptr ( ) const
inline

get an unchecked pointer to our owned function

Definition at line 747 of file c2_function.hh.

References c2_const_ptr< float_type >::func.

Referenced by c2_typed_ptr< float_type, c2_class >::c2_typed_ptr(), and c2_typed_ptr< float_type, c2_class >::operator=().

748  { return static_cast<c2_class<float_type> *>(const_cast<c2_function<float_type>*>(this->func)); }
const c2_function< float_type > * func
Definition: c2_function.hh:674
the parent class for all c2_functions.c2_functions know their value, first, and second derivative at ...
Definition: c2_function.hh:138
template<typename float_type, template< typename > class c2_class>
c2_typed_ptr< float_type, c2_class >::operator c2_class< float_type > & ( ) const
inline

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

Definition at line 750 of file c2_function.hh.

750 { return get(); }
template<typename float_type, template< typename > class c2_class>
c2_class<float_type>* c2_typed_ptr< float_type, c2_class >::operator-> ( ) const
inline

get a checked pointer to our owned function

Definition at line 744 of file c2_function.hh.

745  { return &get(); }
template<typename float_type, template< typename > class c2_class>
void c2_typed_ptr< float_type, c2_class >::operator= ( const c2_typed_ptr< float_type, c2_class > &  f)
inline

fill the container from another container

Parameters
fthe container to copy

Definition at line 753 of file c2_function.hh.

References c2_typed_ptr< float_type, c2_class >::get_ptr(), and c2_const_ptr< float_type >::set_function().

754  { this->set_function(f.get_ptr()); }
c2_class< float_type > * get_ptr() const
get an unchecked pointer to our owned function
Definition: c2_function.hh:747
void set_function(const c2_function< float_type > *f)
fill the container with a new function, or clear it with a null pointer
Definition: c2_function.hh:580
template<typename float_type, template< typename > class c2_class>
void c2_typed_ptr< float_type, c2_class >::operator= ( c2_class< float_type > &  f)
inline

fill the container with a function

Parameters
fthe function

Definition at line 757 of file c2_function.hh.

References c2_const_ptr< float_type >::set_function().

758  { this->set_function(&f); }
void set_function(const c2_function< float_type > *f)
fill the container with a new function, or clear it with a null pointer
Definition: c2_function.hh:580

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