#include <RcObject_T.h>
Inheritance diagram for OpenDDS::DCPS::RcObject< T >:
Public Member Functions | |
virtual | ~RcObject () |
virtual void | _add_ref () |
virtual void | _remove_ref () |
long | ref_count () const |
This accessor is purely for debugging purposes. | |
Protected Member Functions | |
RcObject (ACE_Allocator *allocator=0) | |
Private Member Functions | |
RcObject (const RcObject &) | |
RcObject & | operator= (const RcObject &) |
Private Attributes | |
ACE_Atomic_Op< T, long > | ref_count_ |
ACE_Allocator * | allocator_ |
Definition at line 24 of file RcObject_T.h.
virtual OpenDDS::DCPS::RcObject< T >::~RcObject | ( | ) | [inline, virtual] |
OpenDDS::DCPS::RcObject< T >::RcObject | ( | ACE_Allocator * | allocator = 0 |
) | [inline, protected] |
OpenDDS::DCPS::RcObject< T >::RcObject | ( | const RcObject< T > & | ) | [private] |
virtual void OpenDDS::DCPS::RcObject< T >::_add_ref | ( | ) | [inline, virtual] |
Definition at line 29 of file RcObject_T.h.
Referenced by OpenDDS::DCPS::TransportImpl::configure(), OpenDDS::DCPS::TcpTransport::configure_i(), OpenDDS::DCPS::TcpConnection::open(), OpenDDS::DCPS::TcpSendStrategy::reset(), OpenDDS::DCPS::TcpReceiveStrategy::reset(), OpenDDS::DCPS::TcpConnection::set_datalink(), OpenDDS::DCPS::TcpConnection::set_receive_strategy(), OpenDDS::DCPS::TcpConnection::set_send_strategy(), and OpenDDS::DCPS::TcpDataLink::TcpDataLink().
00029 { 00030 ++this->ref_count_; 00031 }
virtual void OpenDDS::DCPS::RcObject< T >::_remove_ref | ( | ) | [inline, virtual] |
Definition at line 33 of file RcObject_T.h.
00033 { 00034 long new_count = --this->ref_count_; 00035 00036 if (new_count == 0) { 00037 // No need to protect the allocator with a lock since this 00038 // is the last reference to this object, and thus only one 00039 // thread will be doing this final _remove_ref(). 00040 ACE_Allocator* allocator = this->allocator_; 00041 this->allocator_ = 0; 00042 00043 if (allocator) { 00044 this->~RcObject(); 00045 allocator->free(this); 00046 } else { 00047 delete this; 00048 } 00049 } 00050 }
RcObject& OpenDDS::DCPS::RcObject< T >::operator= | ( | const RcObject< T > & | ) | [private] |
long OpenDDS::DCPS::RcObject< T >::ref_count | ( | ) | const [inline] |
This accessor is purely for debugging purposes.
Definition at line 53 of file RcObject_T.h.
00053 { 00054 return this->ref_count_.value(); 00055 }
ACE_Allocator* OpenDDS::DCPS::RcObject< T >::allocator_ [private] |
Definition at line 66 of file RcObject_T.h.
ACE_Atomic_Op<T, long> OpenDDS::DCPS::RcObject< T >::ref_count_ [private] |
Definition at line 65 of file RcObject_T.h.