Main Page | Modules | Namespace List | Class Hierarchy | Class List | Namespace Members | Class 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)
 Construct.

 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_ptroperator= (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)
 Reset the node_type_ptr to a new node_type.


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 node_type type = 0  )  throw (std::bad_alloc) [explicit]
 

Construct.

Parameters:
type a pointer to a node_type constructed with new.
Exceptions:
std::bad_alloc if memory allocation fails.

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

Construct a copy.

Parameters:
ptr the node_type_ptr to copy.

Member Function Documentation

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.

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 

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

Reset the node_type_ptr to a new node_type.

Parameters:
type a pointer to a node_type constructed with new.
Exceptions:
std::bad_alloc if memory allocation fails.

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.