CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Attributes
ProxyBase11< T > Class Template Reference

#include <ProxyBase11.h>

Inheritance diagram for ProxyBase11< T >:
TrajectoryStateOnSurface

Public Types

using pointer = std::shared_ptr< T >
 

Public Member Functions

void check () const
 
const Tdata () const
 
void destroy () noexcept
 
bool isValid () const
 
template<typename U >
ProxyBase11operator= (std::shared_ptr< U > p)
 
ProxyBase11operator= (ProxyBase11 &&other) noexcept=default
 
ProxyBase11operator= (const ProxyBase11 &other)=default
 
 ProxyBase11 ()
 
 ProxyBase11 (T *p)
 
template<typename U >
 ProxyBase11 (std::shared_ptr< U > p)
 
 ProxyBase11 (ProxyBase11 &&other) noexcept=default
 
 ProxyBase11 (ProxyBase11 const &other)=default
 
int references () const
 
void reset ()
 
TsharedData ()
 
void swap (ProxyBase11 &other) noexcept
 
TunsharedData ()
 
 ~ProxyBase11 () noexcept
 

Private Attributes

std::shared_ptr< TtheData
 

Detailed Description

template<class T>
class ProxyBase11< T >

A base class for reference counting proxies. The class to which this one is proxy must inherit from ReferenceCounted. A ProxyBase has value semantics, in contrast to ReferenceCountingPointer, which has pointer semantics. The Proxy class inheriting from ProxyBase must duplicate the part of the interface of the reference counted class that it whiches to expose.

Definition at line 24 of file ProxyBase11.h.

Member Typedef Documentation

template<class T>
using ProxyBase11< T >::pointer = std::shared_ptr<T>

Definition at line 27 of file ProxyBase11.h.

Constructor & Destructor Documentation

template<class T>
ProxyBase11< T >::ProxyBase11 ( )
inline

Definition at line 31 of file ProxyBase11.h.

Referenced by ProxyBase11< T >::swap().

31 {}
template<class T>
ProxyBase11< T >::ProxyBase11 ( T p)
inlineexplicit

Definition at line 33 of file ProxyBase11.h.

template<class T>
template<typename U >
ProxyBase11< T >::ProxyBase11 ( std::shared_ptr< U >  p)
inline

Definition at line 35 of file ProxyBase11.h.

35 : theData(std::move(p)){}
std::shared_ptr< T > theData
Definition: ProxyBase11.h:78
def move(src, dest)
Definition: eostools.py:510
template<class T>
ProxyBase11< T >::~ProxyBase11 ( )
inlinenoexcept

Definition at line 39 of file ProxyBase11.h.

References ProxyBase11< T >::destroy().

39  {
40  destroy();
41  }
void destroy() noexcept
Definition: ProxyBase11.h:74
template<class T>
ProxyBase11< T >::ProxyBase11 ( ProxyBase11< T > &&  other)
defaultnoexcept
template<class T>
ProxyBase11< T >::ProxyBase11 ( ProxyBase11< T > const &  other)
default

Member Function Documentation

template<class T>
void ProxyBase11< T >::check ( void  ) const
inline

Definition at line 68 of file ProxyBase11.h.

References gather_cfg::cout, ProxyBase11< T >::references(), ProxyBase11< T >::theData, and unlikely.

Referenced by ProxyBase11< T >::data(), ProxyBase11< T >::sharedData(), and ProxyBase11< T >::unsharedData().

68  {
69 #ifdef TR_DEBUG
70  if unlikely(!theData) std::cout << "dead proxyBase11 " << references() << std::endl;
71 #endif
72  }
std::shared_ptr< T > theData
Definition: ProxyBase11.h:78
#define unlikely(x)
int references() const
Definition: ProxyBase11.h:75
template<class T>
const T& ProxyBase11< T >::data ( ) const
inline
template<class T>
void ProxyBase11< T >::destroy ( )
inlinenoexcept

Definition at line 74 of file ProxyBase11.h.

Referenced by ProxyBase11< T >::~ProxyBase11().

74 {}
template<class T>
bool ProxyBase11< T >::isValid ( void  ) const
inline
template<class T>
template<typename U >
ProxyBase11& ProxyBase11< T >::operator= ( std::shared_ptr< U >  p)
inline

Definition at line 37 of file ProxyBase11.h.

References eostools::move(), and ProxyBase11< T >::theData.

Referenced by TrajectoryStateOnSurface::operator=(), and ProxyBase11< T >::swap().

37 { theData =std::move(p); return *this;}
std::shared_ptr< T > theData
Definition: ProxyBase11.h:78
def move(src, dest)
Definition: eostools.py:510
template<class T>
ProxyBase11& ProxyBase11< T >::operator= ( ProxyBase11< T > &&  other)
defaultnoexcept
template<class T>
ProxyBase11& ProxyBase11< T >::operator= ( const ProxyBase11< T > &  other)
default
template<class T>
int ProxyBase11< T >::references ( ) const
inline

Definition at line 75 of file ProxyBase11.h.

References ProxyBase11< T >::theData.

Referenced by ProxyBase11< T >::check(), and ProxyBase11< T >::unsharedData().

75 {return theData.use_count();}
std::shared_ptr< T > theData
Definition: ProxyBase11.h:78
template<class T>
void ProxyBase11< T >::reset ( void  )
inline

Definition at line 52 of file ProxyBase11.h.

References ProxyBase11< T >::theData.

Referenced by MultiHitGeneratorFromChi2::hitSets().

52 { theData.reset();}
std::shared_ptr< T > theData
Definition: ProxyBase11.h:78
template<class T>
T& ProxyBase11< T >::sharedData ( )
inline

Definition at line 64 of file ProxyBase11.h.

References ProxyBase11< T >::check(), and ProxyBase11< T >::theData.

Referenced by TrajectoryStateOnSurface::setCurvilinearError().

64 { check(); return *theData;}
std::shared_ptr< T > theData
Definition: ProxyBase11.h:78
void check() const
Definition: ProxyBase11.h:68
template<class T>
void ProxyBase11< T >::swap ( ProxyBase11< T > &  other)
inlinenoexcept

Definition at line 43 of file ProxyBase11.h.

References noexcept, ProxyBase11< T >::operator=(), trackingPlots::other, ProxyBase11< T >::ProxyBase11(), std::swap(), and ProxyBase11< T >::theData.

Referenced by TrajectoryStateOnSurface::operator=(), and TrajectoryStateOnSurface::swap().

43  {
44  std::swap(theData,other.theData);
45  }
std::shared_ptr< T > theData
Definition: ProxyBase11.h:78
void swap(edm::DataFrameContainer &lhs, edm::DataFrameContainer &rhs)
template<class T>
T& ProxyBase11< T >::unsharedData ( )
inline

Definition at line 56 of file ProxyBase11.h.

References ProxyBase11< T >::check(), ProxyBase11< T >::references(), and ProxyBase11< T >::theData.

Referenced by TrajectoryStateOnSurface::rescaleError(), and TrajectoryStateOnSurface::update().

56  {
57  check();
58  if ( references() > 1) {
59  theData = theData->clone();
60  }
61  return *theData;
62  }
std::shared_ptr< T > theData
Definition: ProxyBase11.h:78
int references() const
Definition: ProxyBase11.h:75
void check() const
Definition: ProxyBase11.h:68

Member Data Documentation

template<class T>
std::shared_ptr<T> ProxyBase11< T >::theData
private