19 return _InterlockedIncrement(&
m_val);
21 return __sync_add_and_fetch(&
m_val, 1);
26 return _InterlockedDecrement(&
m_val);
28 return __sync_sub_and_fetch(&
m_val, 1);
60 template<
typename t_source>
63 template<
typename t_source>
68 template<
typename t_source>
69 inline void copy(t_source * p_ptr)
throw() {
71 if (m_ptr != NULL) m_ptr->refcount_add_ref();
72 if (torel != NULL) torel->refcount_release();
76 template<
typename t_source>
80 inline const t_self &
operator=(
const t_self & p_source)
throw() {
copy(p_source);
return *
this;}
81 inline const t_self &
operator=(t_self && p_source) throw() {attach(p_source.detach());
return *
this;}
82 inline const t_self &
operator=(
T * p_ptr)
throw() {
copy(p_ptr);
return *
this;}
85 template<
typename t_source>
inline t_self &
operator=(t_source * p_ptr)
throw() {
copy(p_ptr);
return *
this;}
89 if (temp != NULL) temp->refcount_release();
95 inline T*
operator->()
const throw() {PFC_ASSERT(m_ptr != NULL);
return m_ptr;}
97 inline T*
get_ptr()
const throw() {
return m_ptr;}
99 inline bool is_valid()
const throw() {
return m_ptr != NULL;}
100 inline bool is_empty()
const throw() {
return m_ptr == NULL;}
102 inline bool operator==(
const t_self & p_item)
const throw() {
return m_ptr == p_item.get_ptr();}
103 inline bool operator!=(
const t_self & p_item)
const throw() {
return m_ptr != p_item.get_ptr();}
104 inline bool operator>(
const t_self & p_item)
const throw() {
return m_ptr > p_item.get_ptr();}
105 inline bool operator<(
const t_self & p_item)
const throw() {
return m_ptr < p_item.get_ptr();}
110 if (m_ptr) m_ptr->refcount_add_ref();
124 inline t_self &
operator<<(t_self & p_source)
throw() {attach(p_source.detach());
return *
this;}
125 inline t_self &
operator>>(t_self & p_dest)
throw() {p_dest.
attach(detach());
return *
this;}
133 enum { realloc_safe =
true, constructor_may_fail =
false};
bool operator>(const t_self &p_item) const
virtual ~refcounted_object_root()
refcounted_object_ptr_t(T *p_ptr)
T * _duplicate_ptr() const
t_self & operator=(t_source *p_ptr)
bool operator<(const t_self &p_item) const
bool operator==(const t_self &p_item) const
t_self & operator>>(t_self &p_dest)
void copy(const refcounted_object_ptr_t< t_source > &p_source)
t_type replace_t(t_type &p_var, const t_newval &p_newval)
const t_self & operator=(t_self &&p_source)
t_self & operator=(const refcounted_object_ptr_t< t_source > &p_source)
const t_self & operator=(const t_self &p_source)
refcounted_object_ptr_t(const refcounted_object_ptr_t< t_source > &p_source)
t_self & operator<<(t_self &p_source)
bool operator!=(const t_self &p_item) const
~refcounted_object_ptr_t()
refcounted_object_ptr_t< T > t_self
void copy(t_source *p_ptr)
refcounted_object_ptr_t()
refcounted_object_ptr_t(t_source *p_ptr)
This is free and unencumbered software released into the public domain Anyone is free to copy
const t_self & operator=(T *p_ptr)
void _refcount_release_temporary()
refcounted_object_ptr_t(t_self &&p_source)
refcounted_object_ptr_t(const t_self &p_source)