BOSS 7.0.6
BESIII Offline Software System
Loading...
Searching...
No Matches
SPtr< T > Class Template Reference

#include <pointer.h>

Public Member Functions

T * operator-> () const
 
bool operator== (const T *pobj) const
 
bool operator!= (const T *pobj) const
 
bool operator== (const SPtr< T > &spobj) const
 
bool operator!= (const SPtr< T > &spobj) const
 
 SPtr (T *pobj=0)
 
 SPtr (const SPtr &ptr)
 
SPtroperator= (const SPtr &ptr)
 
 ~SPtr ()
 

Detailed Description

template<typename T>
class SPtr< T >

Definition at line 24 of file pointer.h.

Constructor & Destructor Documentation

◆ SPtr() [1/2]

template<typename T >
SPtr< T >::SPtr ( T *  pobj = 0)
inline

Definition at line 34 of file pointer.h.

34 : pObj(pobj) {
35 if (pObj) { pObj->count++; }
36 }

◆ SPtr() [2/2]

template<typename T >
SPtr< T >::SPtr ( const SPtr< T > &  ptr)
inline

Definition at line 37 of file pointer.h.

37 : pObj(ptr.pObj) {
38 if (pObj) { pObj->count++; }
39 }

◆ ~SPtr()

template<typename T >
SPtr< T >::~SPtr ( )
inline

Definition at line 48 of file pointer.h.

48 {
49 if (pObj && --(pObj->count) == 0) { delete pObj; }
50 }

Member Function Documentation

◆ operator!=() [1/2]

template<typename T >
bool SPtr< T >::operator!= ( const SPtr< T > &  spobj) const
inline

Definition at line 32 of file pointer.h.

32{ return spobj.pObj!=pObj; }

◆ operator!=() [2/2]

template<typename T >
bool SPtr< T >::operator!= ( const T *  pobj) const
inline

Definition at line 29 of file pointer.h.

29{ return pobj!=pObj; }

◆ operator->()

template<typename T >
T * SPtr< T >::operator-> ( ) const
inline

Definition at line 27 of file pointer.h.

27{ return pObj; }

◆ operator=()

template<typename T >
SPtr & SPtr< T >::operator= ( const SPtr< T > &  ptr)
inline

Definition at line 41 of file pointer.h.

41 {
42 if (this == &ptr) { return *this; }
43 if (pObj && --(pObj->count) == 0) { delete pObj; }
44 if ( (pObj=ptr.pObj) ) { pObj->count++; }
45 return *this;
46 }

◆ operator==() [1/2]

template<typename T >
bool SPtr< T >::operator== ( const SPtr< T > &  spobj) const
inline

Definition at line 31 of file pointer.h.

31{ return spobj.pObj==pObj; }

◆ operator==() [2/2]

template<typename T >
bool SPtr< T >::operator== ( const T *  pobj) const
inline

Definition at line 28 of file pointer.h.

28{ return pobj==pObj; }

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