CMS 3D CMS Logo

funct::Master< F > Struct Template Reference

#include <PhysicsTools/Utilities/interface/FunctClone.h>

List of all members.

Public Member Functions

void add () const
double get (size_t i, double x) const
double get (size_t i) const
 Master (const F &f)
double operator() (double x) const
double operator() () const
size_t size () const

Private Member Functions

void clear () const
void reset () const
void update (double x) const
void update () const

Private Attributes

const boost::shared_ptr< F > f_
std::vector< booltoBeUpdated_
double value_


Detailed Description

template<typename F>
struct funct::Master< F >

Definition at line 10 of file FunctClone.h.


Constructor & Destructor Documentation

template<typename F>
funct::Master< F >::Master ( const F &  f  )  [inline]

Definition at line 11 of file FunctClone.h.

00011                        : f_(new F(f)), toBeUpdated_(1, true) { 
00012     }


Member Function Documentation

template<typename F>
void funct::Master< F >::add (  )  const [inline]

Definition at line 19 of file FunctClone.h.

References funct::Master< F >::size(), and funct::Master< F >::toBeUpdated_.

00019                      {
00020       toBeUpdated_.resize(size() + 1, true);
00021     }

template<typename F>
void funct::Master< F >::clear ( void   )  const [inline, private]

Definition at line 37 of file FunctClone.h.

References edm::pset::fill(), and funct::Master< F >::toBeUpdated_.

Referenced by funct::Master< F >::update().

00037                        {
00038       std::fill(toBeUpdated_.begin(), toBeUpdated_.end(), false);
00039     }

template<typename F>
double funct::Master< F >::get ( size_t  i,
double  x 
) const [inline]

Definition at line 28 of file FunctClone.h.

References i, funct::Master< F >::toBeUpdated_, funct::Master< F >::update(), funct::Master< F >::value_, and x.

00028                                          {
00029       if(toBeUpdated_[i]) update(x);
00030       toBeUpdated_[i] = true;
00031       return value_;
00032     }

template<typename F>
double funct::Master< F >::get ( size_t  i  )  const [inline]

Definition at line 23 of file FunctClone.h.

References i, funct::Master< F >::toBeUpdated_, funct::Master< F >::update(), and funct::Master< F >::value_.

00023                                {
00024       if(toBeUpdated_[i]) update();
00025       toBeUpdated_[i] = true;
00026       return value_;
00027     }

template<typename F>
double funct::Master< F >::operator() ( double  x  )  const [inline]

Definition at line 16 of file FunctClone.h.

00016                                       {
00017       return get(0, x);
00018     }

template<typename F>
double funct::Master< F >::operator() ( void   )  const [inline]

Definition at line 13 of file FunctClone.h.

00013                               {
00014       return get(0);
00015     }

template<typename F>
void funct::Master< F >::reset ( void   )  const [inline, private]

Definition at line 34 of file FunctClone.h.

References edm::pset::fill(), and funct::Master< F >::toBeUpdated_.

00034                        {
00035       std::fill(toBeUpdated_.begin(), toBeUpdated_.end(), true);
00036     }

template<typename F>
size_t funct::Master< F >::size ( void   )  const [inline]

Definition at line 22 of file FunctClone.h.

References funct::Master< F >::toBeUpdated_.

Referenced by funct::Master< F >::add().

00022 { return toBeUpdated_.size(); }

template<typename F>
void funct::Master< F >::update ( double  x  )  const [inline, private]

Definition at line 44 of file FunctClone.h.

References funct::Master< F >::clear(), and funct::Master< F >::value_.

00044                                 {
00045       clear();
00046       value_ = (*f_)(x);
00047     }

template<typename F>
void funct::Master< F >::update ( void   )  const [inline, private]

Definition at line 40 of file FunctClone.h.

References funct::Master< F >::clear(), and funct::Master< F >::value_.

Referenced by funct::Master< F >::get().

00040                         {
00041       clear();
00042       value_ = (*f_)();
00043     }


Member Data Documentation

template<typename F>
const boost::shared_ptr<F> funct::Master< F >::f_ [private]

Definition at line 48 of file FunctClone.h.

template<typename F>
std::vector<bool> funct::Master< F >::toBeUpdated_ [mutable, private]

Definition at line 50 of file FunctClone.h.

Referenced by funct::Master< F >::add(), funct::Master< F >::clear(), funct::Master< F >::get(), funct::Master< F >::reset(), and funct::Master< F >::size().

template<typename F>
double funct::Master< F >::value_ [mutable, private]

Definition at line 49 of file FunctClone.h.

Referenced by funct::Master< F >::get(), and funct::Master< F >::update().


The documentation for this struct was generated from the following file:
Generated on Tue Jun 9 18:47:02 2009 for CMSSW by  doxygen 1.5.4