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

openvrml::node_class_ptr Class Reference

node_class_ptr is a reference-counting smart pointer for node_classes. More...

Collaboration diagram for openvrml::node_class_ptr:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 node_class_ptr (node_class *class_=0) throw (std::bad_alloc)
 node_class_ptr (const node_class_ptr &ptr) throw ()
 Copy constructor.

 ~node_class_ptr () throw ()
 Destroy.

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

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

node_classoperator * () const throw ()
 Dereference.

node_classoperator-> () const throw ()
 Delegate to the node_class.

node_classget () const throw ()
 Get the node_class pointer.

void reset (node_class *class_=0) throw (std::bad_alloc)

Private Member Functions

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


Private Attributes

node_classclass_
 The node_class.

size_t * count
 Reference count.


Friends

bool operator== (const node_class_ptr &lhs, const node_class_ptr &rhs) throw ()
 Compare for equality.


Related Functions

(Note that these are not member functions.)

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


Detailed Description

node_class_ptr is a reference-counting smart pointer for node_classes.

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

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


Constructor & Destructor Documentation

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

Copy constructor.

Parameters:
ptr the node_class_ptr to copy.

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

Destroy.


Member Function Documentation

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

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

node_class * openvrml::node_class_ptr::get  )  const throw () [inline]
 

Get the node_class pointer.

Returns:
a pointer to the node_class.

node_class & openvrml::node_class_ptr::operator *  )  const throw () [inline]
 

Dereference.

Returns:
a reference to the node_class.

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

Automatic conversion to bool.

Returns:
true if the node_class_ptr is non-null; false otherwise.

node_class * openvrml::node_class_ptr::operator->  )  const throw () [inline]
 

Delegate to the node_class.

Returns:
a pointer to the node_class.

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

Assignment operator.

Parameters:
ptr 
Returns:
a reference to the node_class_ptr.

Friends And Related Function Documentation

bool operator!= const node_class_ptr &  lhs,
const node_class_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_classes; false otherwise.

bool openvrml::node_class_ptr::operator== const node_class_ptr &  lhs,
const node_class_ptr &  rhs
throw () [friend]
 

Compare for equality.

Parameters:
lhs left-hand operand.
rhs right-hand operand.
Returns:
true if lhs and rhs point to the same node_class; false otherwise.

Member Data Documentation

node_class * openvrml::node_class_ptr::class_ [private]
 

The node_class.

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

Reference count.