H3DUtil::AutoRefVector< NodeClass > Class Template Reference

This class is similar to the AutoRef class in the vector elements are Node * or pointers to subclasses of Node. More...

#include <H3DUtil/AutoRefVector.h>

List of all members.

Public Types

typedef vector< NodeClass * >
::value_type 
value_type
 The type of the Node, NodeClass, stored in the vector.
typedef vector< NodeClass * >
::pointer 
pointer
 Pointer to NodeClass.
typedef vector< NodeClass * >
::const_reference 
const_reference
 Const reference to NodeClass.
typedef vector< NodeClass * >
::size_type 
size_type
 An unsigned integral type.
typedef vector< NodeClass * >
::difference_type 
difference_type
 A signed integral type.
typedef vector< NodeClass * >
::const_iterator 
const_iterator
 Const iterator used to iterate through a vector.
typedef vector< NodeClass * >
::const_reverse_iterator 
const_reverse_iterator
 Iterator used to iterate backwards through a vector.

Public Member Functions

 AutoRefVector ()
 Creates an empty vector.
 AutoRefVector (const vector< NodeClass * > &v)
 Copy constructor from a vector class.
 AutoRefVector (const AutoRefVector< NodeClass > &v)
 Copy constructor.
 AutoRefVector (size_type n)
 Creates a vector with n elements.
virtual ~AutoRefVector ()
 Destructor.
AutoRefVector< NodeClass > & operator= (const AutoRefVector< NodeClass > &v)
 Assignement operator.
AutoRefVector< NodeClass > & operator= (const vector< NodeClass * > &v)
 Assignement operator.
const_iterator begin () const
 Returns a const_iterator pointing to the beginning of the vector.
const_iterator end () const
 Returns a const_iterator pointing to the end of the vector.
const_reverse_iterator rbegin () const
 Returns a const_reverse_iterator pointing to the beginning of the reversed vector.
const_reverse_iterator rend () const
 Returns a const_reverse_iterator pointing to the end of the reversed vector.
size_type size () const
 Returns the size of the vector.
size_type max_size () const
 Returns the largest possible size of the vector.
size_type capacity () const
 Number of elements for which memory has been allocated.
void swap (AutoRefVector< NodeClass > &x)
 Swaps the contents of two vectors.
void swap (vector< NodeClass * > &x)
 Swaps the contents of two vectors.
void reserve (size_t s)
 A request for allocation of additional memory.
virtual void resize (size_t n, NodeClass *t=NULL)
 Inserts or erases elements at the end such that the size becomes n.
bool empty () const
 true if the vector's size is 0.
const_reference operator[] (size_type n) const
 Returns the n'th element.
void set (size_type i, const value_type &v)
 Set value at index i to v.
const_reference front () const
 Returns the first element.
const_reference back () const
 Returns the last element.
void push_back (const value_type &x)
 Inserts a new element at the end.
void pop_back ()
 Removed the last element.
void clear ()
 Erases all of the elements.
virtual void erase (NodeClass *a)
 Erase the first element equal to a.

Protected Member Functions

virtual void ref (NodeClass *n) const
 Virtual function that is called when a Node is added to the vector.
virtual void unref (NodeClass *n) const
 Virtual function that is called when a Node is removed from the vector.
void refAll () const
 Call ref () on all values in the vector.
void unrefAll () const
 Call unref () on all values in the vector.


Detailed Description

template<class NodeClass>
class H3DUtil::AutoRefVector< NodeClass >

This class is similar to the AutoRef class in the vector elements are Node * or pointers to subclasses of Node.

Reference counting will be upheld on all nodes in the vector.


Member Function Documentation

template<class NodeClass >
size_type H3DUtil::AutoRefVector< NodeClass >::capacity (  )  const [inline]

Number of elements for which memory has been allocated.

capacity() is always greater than or equal to size().

template<class NodeClass >
const_reference H3DUtil::AutoRefVector< NodeClass >::operator[] ( size_type  n  )  const [inline]

Returns the n'th element.

We return a const_reference so that the values of the vector only can be changed using member functions. To change the value of a specific index use the set( index, value ) function.

Referenced by H3DUtil::AutoRefVector< NodeClass >::set().

template<class NodeClass >
const_reverse_iterator H3DUtil::AutoRefVector< NodeClass >::rbegin (  )  const [inline]

Returns a const_reverse_iterator pointing to the beginning of the reversed vector.

template<class NodeClass >
virtual void H3DUtil::AutoRefVector< NodeClass >::ref ( NodeClass *  n  )  const [inline, protected, virtual]

Virtual function that is called when a Node is added to the vector.

Referenced by H3DUtil::AutoRefVector< NodeClass >::push_back(), H3DUtil::AutoRefVector< NodeClass >::refAll(), and H3DUtil::AutoRefVector< NodeClass >::set().

template<class NodeClass >
const_reverse_iterator H3DUtil::AutoRefVector< NodeClass >::rend (  )  const [inline]

Returns a const_reverse_iterator pointing to the end of the reversed vector.

template<class NodeClass >
void H3DUtil::AutoRefVector< NodeClass >::reserve ( size_t  s  )  [inline]

A request for allocation of additional memory.

If s is less than or equal to capacity(), this call has no effect. Otherwise, it is a request for allocation of additional memory. If the request is successful, then capacity() is greater than or equal to s; otherwise, capacity() is unchanged. In either case, size() is unchanged.

template<class NodeClass >
virtual void H3DUtil::AutoRefVector< NodeClass >::unref ( NodeClass *  n  )  const [inline, protected, virtual]


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

Generated on Fri Nov 7 10:23:44 2008 for H3DUtil by  doxygen 1.5.7