Main Page   Modules   Namespace List   Class Hierarchy   Compound List   Namespace Members   Compound Members   Related Pages  

openvrml::node_type_ptr Class Reference

node_type_ptr is a reference-counting smart pointer for node_types. More...

Collaboration diagram for openvrml::node_type_ptr:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 node_type_ptr (node_type *type=0) throw (std::bad_alloc)
 node_type_ptr (const node_type_ptr &ptr) throw ()
 Construct a copy.

 ~node_type_ptr () throw ()
 Destroy.

 operator bool () const throw ()
 Automatic conversion to bool.

node_type_ptr & operator= (const node_type_ptr &ptr) throw ()
 Assignment.

node_typeoperator * () const throw ()
 Dereference.

node_typeoperator-> () const throw ()
 Delegate to the node_type.

node_typeget () const throw ()
 Get the node_type pointer.

void reset (node_type *type=0) throw (std::bad_alloc)

Private Member Functions

void dispose () throw ()
 Decrement the reference count; destroy the node_type if the count drops to zero.


Private Attributes

node_typetype
 node_type.

size_t * count
 Reference count.


Friends

bool operator== (const node_type_ptr &lhs, const node_type_ptr &rhs) throw ()

Related Functions

(Note that these are not member functions.)

bool operator!= (const node_type_ptr &lhs, const node_type_ptr &rhs) throw()
 Compare for inequality.


Detailed Description

node_type_ptr is a reference-counting smart pointer for node_types.

node_type_ptr is patterned after the Boost shared_ptr, and it works basically the same way. A node_type_ptr should be constructed or reset with a node_type created with new (or 0).

See also:
http://boost.org/libs/smart_ptr/shared_ptr.htm


Constructor & Destructor Documentation

openvrml::node_type_ptr::node_type_ptr const node_type_ptr &  ptr  )  throw ()
 

Construct a copy.

Parameters:
ptr the node_type_ptr to copy.

openvrml::node_type_ptr::~node_type_ptr  )  throw () [inline]
 

Destroy.


Member Function Documentation

void openvrml::node_type_ptr::dispose  )  throw () [private]
 

Decrement the reference count; destroy the node_type if the count drops to zero.

node_type * openvrml::node_type_ptr::get  )  const throw () [inline]
 

Get the node_type pointer.

Returns:
a pointer to the node_type.

node_type & openvrml::node_type_ptr::operator *  )  const throw () [inline]
 

Dereference.

Returns:
a reference to the node_type.

openvrml::node_type_ptr::operator bool  )  const throw () [inline]
 

Automatic conversion to bool.

node_type * openvrml::node_type_ptr::operator->  )  const throw () [inline]
 

Delegate to the node_type.

Returns:
a pointer to the node_type.

node_type_ptr & openvrml::node_type_ptr::operator= const node_type_ptr &  ptr  )  throw ()
 

Assignment.

Parameters:
ptr 

Friends And Related Function Documentation

bool operator!= const node_type_ptr &  lhs,
const node_type_ptr &  rhs
throw() [related]
 

Compare for inequality.

Parameters:
lhs left-hand operand.
rhs right-hand operand.
Returns:
true if lhs and rhs point to different node_types; false otherwise.

Member Data Documentation

size_t * openvrml::node_type_ptr::count [private]
 

Reference count.

node_type * openvrml::node_type_ptr::type [private]
 

node_type.