foobar2000 SDK  2015-08-03
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions | Private Attributes
pfc::rcptr_t< t_object >

#include <rcptr.h>

Public Member Functions

 rcptr_t (t_rcptr_null) throw ()
 
 rcptr_t () throw ()
 
 rcptr_t (const t_self &p_source) throw ()
 
template<typename t_source >
 rcptr_t (const rcptr_t< t_source > &p_source) throw ()
 
 rcptr_t (t_self &&p_source) throw ()
 
 ~rcptr_t () throw ()
 
t_container__container () const throw ()
 
void __set_from_cast (t_container *p_container, t_object *p_ptr) throw ()
 
void _clear () throw ()
 
bool is_empty () const throw ()
 
bool is_valid () const throw ()
 
void new_t ()
 
template<typename t_param1 >
void new_t (t_param1 const &p_param1)
 
template<typename t_param1 , typename t_param2 >
void new_t (t_param1 const &p_param1, t_param2 const &p_param2)
 
template<typename t_param1 , typename t_param2 , typename t_param3 >
void new_t (t_param1 const &p_param1, t_param2 const &p_param2, t_param3 const &p_param3)
 
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 >
void new_t (t_param1 const &p_param1, t_param2 const &p_param2, t_param3 const &p_param3, t_param4 const &p_param4)
 
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 , typename t_param5 >
void new_t (t_param1 const &p_param1, t_param2 const &p_param2, t_param3 const &p_param3, t_param4 const &p_param4, t_param5 const &p_param5)
 
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 , typename t_param5 , typename t_param6 >
void new_t (t_param1 const &p_param1, t_param2 const &p_param2, t_param3 const &p_param3, t_param4 const &p_param4, t_param5 const &p_param5, t_param6 const &p_param6)
 
template<typename t_other >
bool operator!= (const rcptr_t< t_other > &p_other) const throw ()
 
t_object & operator* () const throw ()
 
t_object * operator-> () const throw ()
 
t_self const & operator= (const t_self &p_source) throw ()
 
template<typename t_source >
const t_selfoperator= (const rcptr_t< t_source > &p_source) throw ()
 
const t_selfoperator= (t_self &&p_source) throw ()
 
const t_selfoperator= (t_rcptr_null) throw ()
 
template<typename t_other >
bool operator== (const rcptr_t< t_other > &p_other) const throw ()
 
void release () throw ()
 
template<typename t_object_cast >
rcptr_t< t_object_cast > static_cast_t () const throw ()
 

Static Public Member Functions

static t_self g_new_t ()
 
template<typename t_param1 >
static t_self g_new_t (t_param1 const &p_param1)
 
template<typename t_param1 , typename t_param2 >
static t_self g_new_t (t_param1 const &p_param1, t_param2 const &p_param2)
 
template<typename t_param1 , typename t_param2 , typename t_param3 >
static t_self g_new_t (t_param1 const &p_param1, t_param2 const &p_param2, t_param3 const &p_param3)
 
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 >
static t_self g_new_t (t_param1 const &p_param1, t_param2 const &p_param2, t_param3 const &p_param3, t_param4 const &p_param4)
 
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 , typename t_param5 >
static t_self g_new_t (t_param1 const &p_param1, t_param2 const &p_param2, t_param3 const &p_param3, t_param4 const &p_param4, t_param5 const &p_param5)
 

Private Types

typedef rc_container_base t_container
 
typedef rc_container_t< t_object > t_container_impl
 
typedef rcptr_t< t_object > t_self
 

Private Member Functions

template<typename t_source >
void __copy (const rcptr_t< t_source > &p_source) throw ()
 
template<typename t_source >
void __init (const rcptr_t< t_source > &p_source) throw ()
 
template<typename t_source >
void _move (rcptr_t< t_source > &p_source) throw ()
 
void on_new (t_container_impl *p_container) throw ()
 

Private Attributes

t_containerm_container
 
t_object * m_ptr
 

Detailed Description

template<typename t_object>
class pfc::rcptr_t< t_object >

Definition at line 33 of file rcptr.h.

Member Typedef Documentation

template<typename t_object>
typedef rc_container_base pfc::rcptr_t< t_object >::t_container
private

Definition at line 36 of file rcptr.h.

template<typename t_object>
typedef rc_container_t<t_object> pfc::rcptr_t< t_object >::t_container_impl
private

Definition at line 37 of file rcptr.h.

template<typename t_object>
typedef rcptr_t<t_object> pfc::rcptr_t< t_object >::t_self
private

Definition at line 35 of file rcptr.h.

Constructor & Destructor Documentation

template<typename t_object>
pfc::rcptr_t< t_object >::rcptr_t ( t_rcptr_null  )
throw (
)
inline

Definition at line 39 of file rcptr.h.

39 {_clear();}
void _clear()
Definition: rcptr.h:184
template<typename t_object>
pfc::rcptr_t< t_object >::rcptr_t ( )
throw (
)
inline

Definition at line 40 of file rcptr.h.

40 {_clear();}
void _clear()
Definition: rcptr.h:184
template<typename t_object>
pfc::rcptr_t< t_object >::rcptr_t ( const t_self p_source)
throw (
)
inline

Definition at line 41 of file rcptr.h.

41 {__init(p_source);}
void __init(const rcptr_t< t_source > &p_source)
Definition: rcptr.h:188
template<typename t_object>
template<typename t_source >
pfc::rcptr_t< t_object >::rcptr_t ( const rcptr_t< t_source > &  p_source)
throw (
)
inline

Definition at line 45 of file rcptr.h.

45 {__init(p_source);}
void __init(const rcptr_t< t_source > &p_source)
Definition: rcptr.h:188
template<typename t_object>
pfc::rcptr_t< t_object >::rcptr_t ( t_self &&  p_source)
throw (
)
inline

Definition at line 49 of file rcptr.h.

49 {_move(p_source);}
void _move(rcptr_t< t_source > &p_source)
Definition: rcptr.h:194
template<typename t_object>
pfc::rcptr_t< t_object >::~rcptr_t ( )
throw (
)
inline

Definition at line 84 of file rcptr.h.

84 {release();}
void release()
Definition: rcptr.h:86

Member Function Documentation

template<typename t_object>
t_container* pfc::rcptr_t< t_object >::__container ( ) const
throw (
)
inline

Definition at line 181 of file rcptr.h.

181 {return m_container;}
t_container * m_container
Definition: rcptr.h:210
template<typename t_object>
template<typename t_source >
void pfc::rcptr_t< t_object >::__copy ( const rcptr_t< t_source > &  p_source)
throw (
)
inlineprivate

Definition at line 200 of file rcptr.h.

200  {
201  __set_from_cast(p_source.__container(),&*p_source);
202  }
void __set_from_cast(t_container *p_container, t_object *p_ptr)
Definition: rcptr.h:72
template<typename t_object>
template<typename t_source >
void pfc::rcptr_t< t_object >::__init ( const rcptr_t< t_source > &  p_source)
throw (
)
inlineprivate

Definition at line 188 of file rcptr.h.

188  {
189  m_container = p_source.__container();
190  m_ptr = &*p_source;
191  if (m_container != NULL) m_container->add_ref();
192  }
t_object * m_ptr
Definition: rcptr.h:211
t_container * m_container
Definition: rcptr.h:210
template<typename t_object>
void pfc::rcptr_t< t_object >::__set_from_cast ( t_container p_container,
t_object *  p_ptr 
)
throw (
)
inline

Definition at line 72 of file rcptr.h.

72  {
73  //addref first because in rare cases this is the same pointer as the one we currently own
74  if (p_container != NULL) p_container->add_ref();
75  release();
76  m_container = p_container;
77  m_ptr = p_ptr;
78  }
t_object * m_ptr
Definition: rcptr.h:211
t_container * m_container
Definition: rcptr.h:210
void release()
Definition: rcptr.h:86
template<typename t_object>
void pfc::rcptr_t< t_object >::_clear ( )
throw (
)
inline

Definition at line 184 of file rcptr.h.

184 {m_container = NULL; m_ptr = NULL;}
t_object * m_ptr
Definition: rcptr.h:211
t_container * m_container
Definition: rcptr.h:210
template<typename t_object>
template<typename t_source >
void pfc::rcptr_t< t_object >::_move ( rcptr_t< t_source > &  p_source)
throw (
)
inlineprivate

Definition at line 194 of file rcptr.h.

194  {
195  m_container = p_source.__container();
196  m_ptr = &*p_source;
197  p_source._clear();
198  }
t_object * m_ptr
Definition: rcptr.h:211
t_container * m_container
Definition: rcptr.h:210
template<typename t_object>
static t_self pfc::rcptr_t< t_object >::g_new_t ( )
inlinestatic

Definition at line 135 of file rcptr.h.

135  {
136  t_self temp;
137  temp.new_t();
138  return temp;
139  }
rcptr_t< t_object > t_self
Definition: rcptr.h:35
template<typename t_object>
template<typename t_param1 >
static t_self pfc::rcptr_t< t_object >::g_new_t ( t_param1 const &  p_param1)
inlinestatic

Definition at line 142 of file rcptr.h.

142  {
143  t_self temp;
144  temp.new_t(p_param1);
145  return temp;
146  }
rcptr_t< t_object > t_self
Definition: rcptr.h:35
template<typename t_object>
template<typename t_param1 , typename t_param2 >
static t_self pfc::rcptr_t< t_object >::g_new_t ( t_param1 const &  p_param1,
t_param2 const &  p_param2 
)
inlinestatic

Definition at line 149 of file rcptr.h.

149  {
150  t_self temp;
151  temp.new_t(p_param1,p_param2);
152  return temp;
153  }
rcptr_t< t_object > t_self
Definition: rcptr.h:35
template<typename t_object>
template<typename t_param1 , typename t_param2 , typename t_param3 >
static t_self pfc::rcptr_t< t_object >::g_new_t ( t_param1 const &  p_param1,
t_param2 const &  p_param2,
t_param3 const &  p_param3 
)
inlinestatic

Definition at line 156 of file rcptr.h.

156  {
157  t_self temp;
158  temp.new_t(p_param1,p_param2,p_param3);
159  return temp;
160  }
rcptr_t< t_object > t_self
Definition: rcptr.h:35
template<typename t_object>
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 >
static t_self pfc::rcptr_t< t_object >::g_new_t ( t_param1 const &  p_param1,
t_param2 const &  p_param2,
t_param3 const &  p_param3,
t_param4 const &  p_param4 
)
inlinestatic

Definition at line 163 of file rcptr.h.

163  {
164  t_self temp;
165  temp.new_t(p_param1,p_param2,p_param3,p_param4);
166  return temp;
167  }
rcptr_t< t_object > t_self
Definition: rcptr.h:35
template<typename t_object>
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 , typename t_param5 >
static t_self pfc::rcptr_t< t_object >::g_new_t ( t_param1 const &  p_param1,
t_param2 const &  p_param2,
t_param3 const &  p_param3,
t_param4 const &  p_param4,
t_param5 const &  p_param5 
)
inlinestatic

Definition at line 170 of file rcptr.h.

170  {
171  t_self temp;
172  temp.new_t(p_param1,p_param2,p_param3,p_param4,p_param5);
173  return temp;
174  }
rcptr_t< t_object > t_self
Definition: rcptr.h:35
template<typename t_object>
bool pfc::rcptr_t< t_object >::is_empty ( ) const
throw (
)
inline

Definition at line 81 of file rcptr.h.

81 {return m_container == NULL;}
t_container * m_container
Definition: rcptr.h:210
template<typename t_object>
bool pfc::rcptr_t< t_object >::is_valid ( ) const
throw (
)
inline

Definition at line 80 of file rcptr.h.

80 {return m_container != NULL;}
t_container * m_container
Definition: rcptr.h:210
template<typename t_object>
void pfc::rcptr_t< t_object >::new_t ( )
inline

Definition at line 101 of file rcptr.h.

101  {
102  on_new(new t_container_impl());
103  }
rc_container_t< t_object > t_container_impl
Definition: rcptr.h:37
void on_new(t_container_impl *p_container)
Definition: rcptr.h:203
template<typename t_object>
template<typename t_param1 >
void pfc::rcptr_t< t_object >::new_t ( t_param1 const &  p_param1)
inline

Definition at line 106 of file rcptr.h.

106  {
107  on_new(new t_container_impl(p_param1));
108  }
rc_container_t< t_object > t_container_impl
Definition: rcptr.h:37
void on_new(t_container_impl *p_container)
Definition: rcptr.h:203
template<typename t_object>
template<typename t_param1 , typename t_param2 >
void pfc::rcptr_t< t_object >::new_t ( t_param1 const &  p_param1,
t_param2 const &  p_param2 
)
inline

Definition at line 111 of file rcptr.h.

111  {
112  on_new(new t_container_impl(p_param1,p_param2));
113  }
rc_container_t< t_object > t_container_impl
Definition: rcptr.h:37
void on_new(t_container_impl *p_container)
Definition: rcptr.h:203
template<typename t_object>
template<typename t_param1 , typename t_param2 , typename t_param3 >
void pfc::rcptr_t< t_object >::new_t ( t_param1 const &  p_param1,
t_param2 const &  p_param2,
t_param3 const &  p_param3 
)
inline

Definition at line 116 of file rcptr.h.

116  {
117  on_new(new t_container_impl(p_param1,p_param2,p_param3));
118  }
rc_container_t< t_object > t_container_impl
Definition: rcptr.h:37
void on_new(t_container_impl *p_container)
Definition: rcptr.h:203
template<typename t_object>
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 >
void pfc::rcptr_t< t_object >::new_t ( t_param1 const &  p_param1,
t_param2 const &  p_param2,
t_param3 const &  p_param3,
t_param4 const &  p_param4 
)
inline

Definition at line 121 of file rcptr.h.

121  {
122  on_new(new t_container_impl(p_param1,p_param2,p_param3,p_param4));
123  }
rc_container_t< t_object > t_container_impl
Definition: rcptr.h:37
void on_new(t_container_impl *p_container)
Definition: rcptr.h:203
template<typename t_object>
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 , typename t_param5 >
void pfc::rcptr_t< t_object >::new_t ( t_param1 const &  p_param1,
t_param2 const &  p_param2,
t_param3 const &  p_param3,
t_param4 const &  p_param4,
t_param5 const &  p_param5 
)
inline

Definition at line 126 of file rcptr.h.

126  {
127  on_new(new t_container_impl(p_param1,p_param2,p_param3,p_param4,p_param5));
128  }
rc_container_t< t_object > t_container_impl
Definition: rcptr.h:37
void on_new(t_container_impl *p_container)
Definition: rcptr.h:203
template<typename t_object>
template<typename t_param1 , typename t_param2 , typename t_param3 , typename t_param4 , typename t_param5 , typename t_param6 >
void pfc::rcptr_t< t_object >::new_t ( t_param1 const &  p_param1,
t_param2 const &  p_param2,
t_param3 const &  p_param3,
t_param4 const &  p_param4,
t_param5 const &  p_param5,
t_param6 const &  p_param6 
)
inline

Definition at line 131 of file rcptr.h.

131  {
132  on_new(new t_container_impl(p_param1,p_param2,p_param3,p_param4,p_param5,p_param6));
133  }
rc_container_t< t_object > t_container_impl
Definition: rcptr.h:37
void on_new(t_container_impl *p_container)
Definition: rcptr.h:203
template<typename t_object>
void pfc::rcptr_t< t_object >::on_new ( t_container_impl p_container)
throw (
)
inlineprivate

Definition at line 203 of file rcptr.h.

203  {
204  this->release();
205  p_container->add_ref();
206  this->m_ptr = &p_container->m_object;
207  this->m_container = p_container;
208  }
t_object * m_ptr
Definition: rcptr.h:211
t_container * m_container
Definition: rcptr.h:210
void release()
Definition: rcptr.h:86
template<typename t_object>
template<typename t_other >
bool pfc::rcptr_t< t_object >::operator!= ( const rcptr_t< t_other > &  p_other) const
throw (
)
inline

Definition at line 68 of file rcptr.h.

68  {
69  return m_container != p_other.__container();
70  }
t_container * m_container
Definition: rcptr.h:210
template<typename t_object>
t_object& pfc::rcptr_t< t_object >::operator* ( ) const
throw (
)
inline

Definition at line 176 of file rcptr.h.

176 {return *this->m_ptr;}
t_object * m_ptr
Definition: rcptr.h:211
template<typename t_object>
t_object* pfc::rcptr_t< t_object >::operator-> ( ) const
throw (
)
inline

Definition at line 178 of file rcptr.h.

178 {return this->m_ptr;}
t_object * m_ptr
Definition: rcptr.h:211
template<typename t_object>
t_self const& pfc::rcptr_t< t_object >::operator= ( const t_self p_source)
throw (
)
inline

Definition at line 42 of file rcptr.h.

42 {__copy(p_source); return *this;}
void __copy(const rcptr_t< t_source > &p_source)
Definition: rcptr.h:200
template<typename t_object>
template<typename t_source >
const t_self& pfc::rcptr_t< t_object >::operator= ( const rcptr_t< t_source > &  p_source)
throw (
)
inline

Definition at line 47 of file rcptr.h.

47 {__copy(p_source); return *this;}
void __copy(const rcptr_t< t_source > &p_source)
Definition: rcptr.h:200
template<typename t_object>
const t_self& pfc::rcptr_t< t_object >::operator= ( t_self &&  p_source)
throw (
)
inline

Definition at line 50 of file rcptr.h.

50 {release(); _move(p_source); return *this;}
void _move(rcptr_t< t_source > &p_source)
Definition: rcptr.h:194
void release()
Definition: rcptr.h:86
template<typename t_object>
const t_self& pfc::rcptr_t< t_object >::operator= ( t_rcptr_null  )
throw (
)
inline

Definition at line 52 of file rcptr.h.

52 {release(); return *this;}
void release()
Definition: rcptr.h:86
template<typename t_object>
template<typename t_other >
bool pfc::rcptr_t< t_object >::operator== ( const rcptr_t< t_other > &  p_other) const
throw (
)
inline

Definition at line 63 of file rcptr.h.

63  {
64  return m_container == p_other.__container();
65  }
t_container * m_container
Definition: rcptr.h:210
template<typename t_object>
void pfc::rcptr_t< t_object >::release ( )
throw (
)
inline

Definition at line 86 of file rcptr.h.

86  {
87  t_container * temp = m_container;
88  m_ptr = NULL;
89  m_container = NULL;
90  if (temp != NULL) temp->release();
91  }
rc_container_base t_container
Definition: rcptr.h:36
t_object * m_ptr
Definition: rcptr.h:211
t_container * m_container
Definition: rcptr.h:210
template<typename t_object>
template<typename t_object_cast >
rcptr_t<t_object_cast> pfc::rcptr_t< t_object >::static_cast_t ( ) const
throw (
)
inline

Definition at line 95 of file rcptr.h.

95  {
96  rcptr_t<t_object_cast> temp;
97  if (is_valid()) temp.__set_from_cast(this->m_container,static_cast<t_object_cast*>(this->m_ptr));
98  return temp;
99  }
t_object * m_ptr
Definition: rcptr.h:211
t_container * m_container
Definition: rcptr.h:210
bool is_valid() const
Definition: rcptr.h:80

Field Documentation

template<typename t_object>
t_container* pfc::rcptr_t< t_object >::m_container
private

Definition at line 210 of file rcptr.h.

template<typename t_object>
t_object* pfc::rcptr_t< t_object >::m_ptr
private

Definition at line 211 of file rcptr.h.


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