foobar2000 SDK  2015-08-03
Public Member Functions | Private Types | Private Attributes
pfc::refcounted_object_ptr_t< T >

#include <ref_counter.h>

Public Member Functions

 refcounted_object_ptr_t () throw ()
 
 refcounted_object_ptr_t (T *p_ptr) throw ()
 
 refcounted_object_ptr_t (const t_self &p_source) throw ()
 
 refcounted_object_ptr_t (t_self &&p_source) throw ()
 
template<typename t_source >
 refcounted_object_ptr_t (t_source *p_ptr) throw ()
 
template<typename t_source >
 refcounted_object_ptr_t (const refcounted_object_ptr_t< t_source > &p_source) throw ()
 
 ~refcounted_object_ptr_t () throw ()
 
T_duplicate_ptr () const throw ()
 
void attach (T *p_ptr) throw ()
 
template<typename t_source >
void copy (t_source *p_ptr) throw ()
 
template<typename t_source >
void copy (const refcounted_object_ptr_t< t_source > &p_source) throw ()
 
Tdetach () throw ()
 
Tget_ptr () const throw ()
 
bool is_empty () const throw ()
 
bool is_valid () const throw ()
 
bool operator!= (const t_self &p_item) const throw ()
 
Toperator* () const throw ()
 
Toperator-> () const throw ()
 
bool operator< (const t_self &p_item) const throw ()
 
t_selfoperator<< (t_self &p_source) throw ()
 
const t_selfoperator= (const t_self &p_source) throw ()
 
const t_selfoperator= (t_self &&p_source) throw ()
 
const t_selfoperator= (T *p_ptr) throw ()
 
template<typename t_source >
t_selfoperator= (const refcounted_object_ptr_t< t_source > &p_source) throw ()
 
template<typename t_source >
t_selfoperator= (t_source *p_ptr) throw ()
 
bool operator== (const t_self &p_item) const throw ()
 
bool operator> (const t_self &p_item) const throw ()
 
t_selfoperator>> (t_self &p_dest) throw ()
 
void release () throw ()
 

Private Types

typedef refcounted_object_ptr_t< Tt_self
 

Private Attributes

Tm_ptr
 

Detailed Description

template<typename T>
class pfc::refcounted_object_ptr_t< T >

Definition at line 51 of file ref_counter.h.

Member Typedef Documentation

template<typename T>
typedef refcounted_object_ptr_t<T> pfc::refcounted_object_ptr_t< T >::t_self
private

Definition at line 53 of file ref_counter.h.

Constructor & Destructor Documentation

template<typename T>
pfc::refcounted_object_ptr_t< T >::refcounted_object_ptr_t ( )
throw (
)
inline

Definition at line 55 of file ref_counter.h.

55 : m_ptr(NULL) {}
template<typename T>
pfc::refcounted_object_ptr_t< T >::refcounted_object_ptr_t ( T p_ptr)
throw (
)
inline

Definition at line 56 of file ref_counter.h.

56 : m_ptr(NULL) {copy(p_ptr);}
void copy(t_source *p_ptr)
Definition: ref_counter.h:69
template<typename T>
pfc::refcounted_object_ptr_t< T >::refcounted_object_ptr_t ( const t_self p_source)
throw (
)
inline

Definition at line 57 of file ref_counter.h.

57 : m_ptr(NULL) {copy(p_source);}
void copy(t_source *p_ptr)
Definition: ref_counter.h:69
template<typename T>
pfc::refcounted_object_ptr_t< T >::refcounted_object_ptr_t ( t_self &&  p_source)
throw (
)
inline

Definition at line 58 of file ref_counter.h.

58 { m_ptr = p_source.m_ptr; p_source.m_ptr = NULL; }
template<typename T>
template<typename t_source >
pfc::refcounted_object_ptr_t< T >::refcounted_object_ptr_t ( t_source *  p_ptr)
throw (
)
inline

Definition at line 61 of file ref_counter.h.

61 : m_ptr(NULL) {copy(p_ptr);}
void copy(t_source *p_ptr)
Definition: ref_counter.h:69
template<typename T>
template<typename t_source >
pfc::refcounted_object_ptr_t< T >::refcounted_object_ptr_t ( const refcounted_object_ptr_t< t_source > &  p_source)
throw (
)
inline

Definition at line 64 of file ref_counter.h.

64 : m_ptr(NULL) {copy(p_source);}
void copy(t_source *p_ptr)
Definition: ref_counter.h:69
template<typename T>
pfc::refcounted_object_ptr_t< T >::~refcounted_object_ptr_t ( )
throw (
)
inline

Definition at line 66 of file ref_counter.h.

66 {if (m_ptr != NULL) m_ptr->refcount_release();}

Member Function Documentation

template<typename T>
T* pfc::refcounted_object_ptr_t< T >::_duplicate_ptr ( ) const
throw (
)
inline

Definition at line 108 of file ref_counter.h.

109  {
110  if (m_ptr) m_ptr->refcount_add_ref();
111  return m_ptr;
112  }
template<typename T>
void pfc::refcounted_object_ptr_t< T >::attach ( T p_ptr)
throw (
)
inline

Definition at line 120 of file ref_counter.h.

120  {//should not be used ! temporary !
121  release();
122  m_ptr = p_ptr;
123  }
template<typename T>
template<typename t_source >
void pfc::refcounted_object_ptr_t< T >::copy ( t_source *  p_ptr)
throw (
)
inline

Definition at line 69 of file ref_counter.h.

69  {
70  T* torel = pfc::replace_t(m_ptr,pfc::safe_ptr_cast<T>(p_ptr));
71  if (m_ptr != NULL) m_ptr->refcount_add_ref();
72  if (torel != NULL) torel->refcount_release();
73 
74  }
t_type replace_t(t_type &p_var, const t_newval &p_newval)
Definition: primitives.h:682
template<typename T>
template<typename t_source >
void pfc::refcounted_object_ptr_t< T >::copy ( const refcounted_object_ptr_t< t_source > &  p_source)
throw (
)
inline

Definition at line 77 of file ref_counter.h.

77 {copy(p_source.get_ptr());}
void copy(t_source *p_ptr)
Definition: ref_counter.h:69
template<typename T>
T* pfc::refcounted_object_ptr_t< T >::detach ( )
throw (
)
inline

Definition at line 114 of file ref_counter.h.

114  {//should not be used ! temporary !
115  T* ret = m_ptr;
116  m_ptr = 0;
117  return ret;
118  }
template<typename T>
T* pfc::refcounted_object_ptr_t< T >::get_ptr ( ) const
throw (
)
inline

Definition at line 97 of file ref_counter.h.

template<typename T>
bool pfc::refcounted_object_ptr_t< T >::is_empty ( ) const
throw (
)
inline

Definition at line 100 of file ref_counter.h.

100 {return m_ptr == NULL;}
template<typename T>
bool pfc::refcounted_object_ptr_t< T >::is_valid ( ) const
throw (
)
inline

Definition at line 99 of file ref_counter.h.

99 {return m_ptr != NULL;}
template<typename T>
bool pfc::refcounted_object_ptr_t< T >::operator!= ( const t_self p_item) const
throw (
)
inline

Definition at line 103 of file ref_counter.h.

103 {return m_ptr != p_item.get_ptr();}
template<typename T>
T& pfc::refcounted_object_ptr_t< T >::operator* ( ) const
throw (
)
inline

Definition at line 93 of file ref_counter.h.

93 {return *m_ptr;}
template<typename T>
T* pfc::refcounted_object_ptr_t< T >::operator-> ( ) const
throw (
)
inline

Definition at line 95 of file ref_counter.h.

95 {PFC_ASSERT(m_ptr != NULL);return m_ptr;}
template<typename T>
bool pfc::refcounted_object_ptr_t< T >::operator< ( const t_self p_item) const
throw (
)
inline

Definition at line 105 of file ref_counter.h.

105 {return m_ptr < p_item.get_ptr();}
template<typename T>
t_self& pfc::refcounted_object_ptr_t< T >::operator<< ( t_self p_source)
throw (
)
inline

Definition at line 124 of file ref_counter.h.

124 {attach(p_source.detach());return *this;}
template<typename T>
const t_self& pfc::refcounted_object_ptr_t< T >::operator= ( const t_self p_source)
throw (
)
inline

Definition at line 80 of file ref_counter.h.

80 {copy(p_source); return *this;}
void copy(t_source *p_ptr)
Definition: ref_counter.h:69
template<typename T>
const t_self& pfc::refcounted_object_ptr_t< T >::operator= ( t_self &&  p_source)
throw (
)
inline

Definition at line 81 of file ref_counter.h.

81 {attach(p_source.detach()); return *this;}
template<typename T>
const t_self& pfc::refcounted_object_ptr_t< T >::operator= ( T p_ptr)
throw (
)
inline

Definition at line 82 of file ref_counter.h.

82 {copy(p_ptr); return *this;}
void copy(t_source *p_ptr)
Definition: ref_counter.h:69
template<typename T>
template<typename t_source >
t_self& pfc::refcounted_object_ptr_t< T >::operator= ( const refcounted_object_ptr_t< t_source > &  p_source)
throw (
)
inline

Definition at line 84 of file ref_counter.h.

84 {copy(p_source); return *this;}
void copy(t_source *p_ptr)
Definition: ref_counter.h:69
template<typename T>
template<typename t_source >
t_self& pfc::refcounted_object_ptr_t< T >::operator= ( t_source *  p_ptr)
throw (
)
inline

Definition at line 85 of file ref_counter.h.

85 {copy(p_ptr); return *this;}
void copy(t_source *p_ptr)
Definition: ref_counter.h:69
template<typename T>
bool pfc::refcounted_object_ptr_t< T >::operator== ( const t_self p_item) const
throw (
)
inline

Definition at line 102 of file ref_counter.h.

102 {return m_ptr == p_item.get_ptr();}
template<typename T>
bool pfc::refcounted_object_ptr_t< T >::operator> ( const t_self p_item) const
throw (
)
inline

Definition at line 104 of file ref_counter.h.

104 {return m_ptr > p_item.get_ptr();}
template<typename T>
t_self& pfc::refcounted_object_ptr_t< T >::operator>> ( t_self p_dest)
throw (
)
inline

Definition at line 125 of file ref_counter.h.

125 {p_dest.attach(detach());return *this;}
template<typename T>
void pfc::refcounted_object_ptr_t< T >::release ( )
throw (
)
inline

Definition at line 87 of file ref_counter.h.

87  {
88  T * temp = pfc::replace_t(m_ptr,(T*)NULL);
89  if (temp != NULL) temp->refcount_release();
90  }
t_type replace_t(t_type &p_var, const t_newval &p_newval)
Definition: primitives.h:682

Field Documentation

template<typename T>
T* pfc::refcounted_object_ptr_t< T >::m_ptr
private

Definition at line 127 of file ref_counter.h.


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