foobar2000 SDK  2015-08-03
Public Member Functions | Static Public Member Functions | Private Types | Private Member Functions
service_nnptr_t< T >

#include <service.h>

+ Inheritance diagram for service_nnptr_t< T >:

Public Member Functions

 service_nnptr_t (T *p_ptr) throw ()
 
 service_nnptr_t (const t_self &p_source) throw ()
 
template<typename t_source >
 service_nnptr_t (t_source *p_ptr) throw ()
 
template<typename t_source >
 service_nnptr_t (const service_ptr_base_t< t_source > &p_source) throw ()
 
template<typename t_source >
 service_nnptr_t (service_ptr_t< t_source > &&p_source) throw ()
 
 ~service_nnptr_t () throw ()
 
service_ptr_t< service_base > & _as_base_ptr ()
 
T_duplicate_ptr () const throw ()
 
template<typename t_source >
void copy (t_source *p_ptr) throw ()
 
template<typename t_source >
void copy (const service_ptr_base_t< t_source > &p_source) throw ()
 
Tget_ptr () const throw ()
 
bool is_empty () const throw ()
 
bool is_valid () const throw ()
 
bool operator!= (const service_ptr_base_t< T > &p_item) const throw ()
 
bool operator!= (T *p_item) const throw ()
 
Toperator* () const throw ()
 
service_obscure_refcounting< T > * operator-> () const throw ()
 
bool operator< (const service_ptr_base_t< T > &p_item) const throw ()
 
bool operator< (T *p_item) const throw ()
 
const t_selfoperator= (const t_self &p_source) throw ()
 
const t_selfoperator= (T *p_ptr) throw ()
 
template<typename t_source >
t_selfoperator= (const service_ptr_base_t< t_source > &p_source) throw ()
 
template<typename t_source >
t_selfoperator= (t_source *p_ptr) throw ()
 
template<typename t_source >
t_selfoperator= (service_ptr_t< t_source > &&p_source) throw ()
 
bool operator== (const service_ptr_base_t< T > &p_item) const throw ()
 
bool operator== (T *p_item) const throw ()
 
bool operator> (const service_ptr_base_t< T > &p_item) const throw ()
 
bool operator> (T *p_item) const throw ()
 
- Public Member Functions inherited from service_ptr_base_t< T >
Tget_ptr () const throw ()
 

Static Public Member Functions

static bool _as_base_ptr_check ()
 

Private Types

typedef service_nnptr_t< Tt_self
 

Private Member Functions

 service_nnptr_t () throw ()
 
template<typename t_source >
void _init (t_source *in)
 

Additional Inherited Members

- Protected Attributes inherited from service_ptr_base_t< T >
Tm_ptr
 

Detailed Description

template<typename T>
class service_nnptr_t< T >

Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
This assumes that the pointers are valid all the time (can't point to null). Mainly intended to be used for scenarios where null pointers are not valid and relevant code should crash ASAP if somebody passes invalid pointers around.
You want to use service_ptr_t<> rather than service_nnptr_t<> most of the time.

Definition at line 51 of file service.h.

Member Typedef Documentation

template<typename T>
typedef service_nnptr_t<T> service_nnptr_t< T >::t_self
private

Definition at line 187 of file service.h.

Constructor & Destructor Documentation

template<typename T>
service_nnptr_t< T >::service_nnptr_t ( )
throw (
)
inlineprivate

Definition at line 193 of file service.h.

193 {pfc::crash();}
void crash()
Definition: other.cpp:112
template<typename T>
service_nnptr_t< T >::service_nnptr_t ( T p_ptr)
throw (
)
inline

Definition at line 195 of file service.h.

195 {_init(p_ptr);}
void _init(t_source *in)
Definition: service.h:189
template<typename T>
service_nnptr_t< T >::service_nnptr_t ( const t_self p_source)
throw (
)
inline

Definition at line 196 of file service.h.

196 {_init(p_source.get_ptr());}
void _init(t_source *in)
Definition: service.h:189
template<typename T>
template<typename t_source >
service_nnptr_t< T >::service_nnptr_t ( t_source *  p_ptr)
throw (
)
inline

Definition at line 197 of file service.h.

197 {_init(p_ptr);}
void _init(t_source *in)
Definition: service.h:189
template<typename T>
template<typename t_source >
service_nnptr_t< T >::service_nnptr_t ( const service_ptr_base_t< t_source > &  p_source)
throw (
)
inline

Definition at line 198 of file service.h.

198 {_init(p_source.get_ptr());}
void _init(t_source *in)
Definition: service.h:189
T * get_ptr() const
Definition: service.h:45
template<typename T>
template<typename t_source >
service_nnptr_t< T >::service_nnptr_t ( service_ptr_t< t_source > &&  p_source)
throw (
)
inline

Definition at line 200 of file service.h.

200 {this->m_ptr = p_source.detach();}
T * detach()
Definition: service.h:145
template<typename T>
service_nnptr_t< T >::~service_nnptr_t ( )
throw (
)
inline

Definition at line 202 of file service.h.

202 {this->m_ptr->service_release();}

Member Function Documentation

template<typename T>
service_ptr_t<service_base>& service_nnptr_t< T >::_as_base_ptr ( )
inline

Definition at line 249 of file service.h.

249  {
250  PFC_ASSERT( _as_base_ptr_check() );
251  return *reinterpret_cast<service_ptr_t<service_base>*>(this);
252  }
static bool _as_base_ptr_check()
Definition: service.h:253
Autopointer class to be used with all services. Manages reference counter calls behind-the-scenes.
Definition: service.h:55
template<typename T>
static bool service_nnptr_t< T >::_as_base_ptr_check ( )
inlinestatic

Definition at line 253 of file service.h.

253  {
254  return static_cast<service_base*>((T*)NULL) == reinterpret_cast<service_base*>((T*)NULL);
255  }
Base class for all service classes. Provides interfaces for reference counter and querying for differ...
Definition: service.h:333
template<typename T>
T* service_nnptr_t< T >::_duplicate_ptr ( ) const
throw (
)
inline

Definition at line 242 of file service.h.

242  {//should not be used ! temporary !
244  return this->m_ptr;
245  }
static void service_add_ref_safe(T *p_ptr)
Definition: service.h:36
template<typename T>
template<typename t_source >
void service_nnptr_t< T >::_init ( t_source *  in)
inlineprivate

Definition at line 189 of file service.h.

189  {
190  this->m_ptr = in;
191  this->m_ptr->service_add_ref();
192  }
template<typename T>
template<typename t_source >
void service_nnptr_t< T >::copy ( t_source *  p_ptr)
throw (
)
inline

Definition at line 205 of file service.h.

205  {
206  p_ptr->service_add_ref();
207  this->m_ptr->service_release();
208  this->m_ptr = pfc::safe_ptr_cast<T>(p_ptr);
209  }
t_ret * safe_ptr_cast(t_param *p_param)
Definition: primitives.h:185
template<typename T>
template<typename t_source >
void service_nnptr_t< T >::copy ( const service_ptr_base_t< t_source > &  p_source)
throw (
)
inline

Definition at line 212 of file service.h.

212 {copy(p_source.get_ptr());}
void copy(t_source *p_ptr)
Definition: service.h:205
T * get_ptr() const
Definition: service.h:45
template<typename T>
T* service_nnptr_t< T >::get_ptr ( ) const
throw (
)
inline

Definition at line 225 of file service.h.

225 {return this->m_ptr;}
template<typename T>
bool service_nnptr_t< T >::is_empty ( ) const
throw (
)
inline

Definition at line 228 of file service.h.

228 {return false;}
template<typename T>
bool service_nnptr_t< T >::is_valid ( ) const
throw (
)
inline

Definition at line 227 of file service.h.

227 {return true;}
template<typename T>
bool service_nnptr_t< T >::operator!= ( const service_ptr_base_t< T > &  p_item) const
throw (
)
inline

Definition at line 231 of file service.h.

231 {return this->m_ptr != p_item.get_ptr();}
T * get_ptr() const
Definition: service.h:45
template<typename T>
bool service_nnptr_t< T >::operator!= ( T p_item) const
throw (
)
inline

Definition at line 237 of file service.h.

237 {return this->m_ptr != p_item;}
template<typename T>
T& service_nnptr_t< T >::operator* ( ) const
throw (
)
inline

Definition at line 247 of file service.h.

247 {return *this->m_ptr;}
template<typename T>
service_obscure_refcounting<T>* service_nnptr_t< T >::operator-> ( ) const
throw (
)
inline

Definition at line 223 of file service.h.

223 {PFC_ASSERT(this->m_ptr != NULL);return service_obscure_refcounting_cast(this->m_ptr);}
static service_obscure_refcounting< T > * service_obscure_refcounting_cast(T *p_source)
Converts a service interface pointer to a pointer that obscures service counter functionality.
Definition: service.h:28
template<typename T>
bool service_nnptr_t< T >::operator< ( const service_ptr_base_t< T > &  p_item) const
throw (
)
inline

Definition at line 234 of file service.h.

234 {return this->m_ptr < p_item.get_ptr();}
T * get_ptr() const
Definition: service.h:45
template<typename T>
bool service_nnptr_t< T >::operator< ( T p_item) const
throw (
)
inline

Definition at line 240 of file service.h.

240 {return this->m_ptr < p_item;}
template<typename T>
const t_self& service_nnptr_t< T >::operator= ( const t_self p_source)
throw (
)
inline

Definition at line 215 of file service.h.

215 {copy(p_source); return *this;}
void copy(t_source *p_ptr)
Definition: service.h:205
template<typename T>
const t_self& service_nnptr_t< T >::operator= ( T p_ptr)
throw (
)
inline

Definition at line 216 of file service.h.

216 {copy(p_ptr); return *this;}
void copy(t_source *p_ptr)
Definition: service.h:205
template<typename T>
template<typename t_source >
t_self& service_nnptr_t< T >::operator= ( const service_ptr_base_t< t_source > &  p_source)
throw (
)
inline

Definition at line 218 of file service.h.

218 {copy(p_source); return *this;}
void copy(t_source *p_ptr)
Definition: service.h:205
template<typename T>
template<typename t_source >
t_self& service_nnptr_t< T >::operator= ( t_source *  p_ptr)
throw (
)
inline

Definition at line 219 of file service.h.

219 {copy(p_ptr); return *this;}
void copy(t_source *p_ptr)
Definition: service.h:205
template<typename T>
template<typename t_source >
t_self& service_nnptr_t< T >::operator= ( service_ptr_t< t_source > &&  p_source)
throw (
)
inline

Definition at line 220 of file service.h.

220 {this->m_ptr->service_release(); this->m_ptr = p_source.detach();}
T * detach()
Definition: service.h:145
template<typename T>
bool service_nnptr_t< T >::operator== ( const service_ptr_base_t< T > &  p_item) const
throw (
)
inline

Definition at line 230 of file service.h.

230 {return this->m_ptr == p_item.get_ptr();}
T * get_ptr() const
Definition: service.h:45
template<typename T>
bool service_nnptr_t< T >::operator== ( T p_item) const
throw (
)
inline

Definition at line 236 of file service.h.

236 {return this->m_ptr == p_item;}
template<typename T>
bool service_nnptr_t< T >::operator> ( const service_ptr_base_t< T > &  p_item) const
throw (
)
inline

Definition at line 233 of file service.h.

233 {return this->m_ptr > p_item.get_ptr();}
T * get_ptr() const
Definition: service.h:45
template<typename T>
bool service_nnptr_t< T >::operator> ( T p_item) const
throw (
)
inline

Definition at line 239 of file service.h.

239 {return this->m_ptr > p_item;}

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