TAO  2.2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
TAO_Intrusive_Ref_Count_Handle< T > Class Reference

Template class for smart-pointer to (intrusively) ref-counted object. More...

#include <Intrusive_Ref_Count_Handle_T.h>

Collaboration diagram for TAO_Intrusive_Ref_Count_Handle< T >:
Collaboration graph

Detailed Description

Template class for smart-pointer to (intrusively) ref-counted object.

This class behaves just like a xxx_var type behaves. The only significant difference is that this class provides a "bool is_nil() const" method, and xxx_var types don't (they use the "bool CORBA::is_nil(xxx_ptr ptr)" method instead). For example,

typedef TAO_Intrusive_Ref_Count_Handle<PortableServer::ServantBase> MyServantBase_var;

The MyServantBase_var and the PortableServer::ServantBase_var are nearly idenitical. The only difference is that the MyServantBase_var has a "isNil()" method that indicates whether or not the smart pointer is in the 'nil' state or not.

This class can be used to "safely" deal with an instance of a servant. For example, we can use a single variable TAO_Intrusive_Ref_Count_Handle<Foo_i>

typedef TAO_Intrusive_Ref_Count_Handle<Foo_i> Foo_i_var;
Foo_i_var servant_;

instead of using two variables

PortableServer::ServantBase_var servant_holder_;
Foo_i* servant_;

to deal with the servant memory.

The Foo_i_var type does everything that the PortableServer::ServantBase_var type does. In addition, the Foo_i_var type can provide access to the servant as derived class via the arrow operator.

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