Panda3D
Public Types | Public Member Functions | List of all members
ReferenceCountedVector< Element > Class Template Reference

This defines the object that is actually stored and reference-counted internally by a PointerToArray. More...

#include "pointerToArrayBase.h"

Inheritance diagram for ReferenceCountedVector< Element >:
NodeReferenceCount pvector< Element > ReferenceCount MemoryBase

Public Types

typedef pvector< Element >::iterator iterator
 
typedef pvector< Element >::size_type size_type
 
- Public Types inherited from pvector< Element >
typedef pallocator_array< Element > allocator
 
typedef std::vector< Element, allocatorbase_class
 
typedef base_class::size_type size_type
 

Public Member Functions

 ReferenceCountedVector (TypeHandle type_handle)
 
 ReferenceCountedVector (size_type initial_size, TypeHandle type_handle)
 
 ReferenceCountedVector (const Element *begin, const Element *end, TypeHandle type_handle)
 Creates an array with all elements from begin up to but not including end. More...
 
 ReferenceCountedVector (pvector< Element > &&from)
 Creates an array that takes its elements from the given vector. More...
 
void clear ()
 
void erase (iterator position)
 
void erase (iterator first, iterator last)
 
iterator insert (iterator position, const Element &x)
 
void insert (iterator position, size_type n, const Element &x)
 
void pop_back ()
 
size_type size () const
 
- Public Member Functions inherited from NodeReferenceCount
int get_node_ref_count () const
 Returns the current reference count. More...
 
void node_ref () const
 Explicitly increments the node reference count and the normal reference count simultaneously. More...
 
bool node_unref () const
 Explicitly decrements the node reference count and the normal reference count simultaneously. More...
 
void node_unref_only () const
 Decrements the node reference count without affecting the normal reference count. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_weak_list () const
 Returns the WeakReferenceList associated with this ReferenceCount object. More...
 
bool has_weak_list () const
 Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More...
 
void local_object ()
 This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More...
 
void ref () const
 Explicitly increments the reference count. More...
 
bool ref_if_nonzero () const
 Atomically increases the reference count of this object if it is not zero. More...
 
bool test_ref_count_integrity () const
 Does some easy checks to make sure that the reference count isn't completely bogus. More...
 
bool test_ref_count_nonzero () const
 Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More...
 
virtual bool unref () const
 Explicitly decrements the reference count. More...
 
WeakReferenceListweak_ref ()
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref ()
 Removes the indicated PointerToVoid as a weak reference to this object. More...
 
- Public Member Functions inherited from pvector< Element >
 pvector (TypeHandle type_handle=pvector_type_handle)
 
 pvector (const pvector< Element > &copy)
 
 pvector (pvector< Element > &&from) noexcept
 
 pvector (size_type n, TypeHandle type_handle=pvector_type_handle)
 
 pvector (size_type n, const Element &value, TypeHandle type_handle=pvector_type_handle)
 
 pvector (const Element *begin, const Element *end, TypeHandle type_handle=pvector_type_handle)
 
pvector< Element > & operator= (const pvector< Element > &copy)
 
pvector< Element > & operator= (pvector< Element > &&from) noexcept
 

Additional Inherited Members

- Static Public Member Functions inherited from NodeReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Detailed Description

template<class Element>
class ReferenceCountedVector< Element >

This defines the object that is actually stored and reference-counted internally by a PointerToArray.

It is basically a NodeReferenceCount- capable STL vector.

We use NodeReferenceCount (instead of just ReferenceCount), which adds node_ref() and node_unref() to the standard ref() and unref(). This is particularly useful for GeomVertexArrayData; other classes may or may not find this additional counter useful, but since it adds relatively little overhead (compared with what is presumably a largish array), we go ahead and add it here, even though it is inherited by many different parts of the system that may not use it.

Definition at line 38 of file pointerToArrayBase.h.

Constructor & Destructor Documentation

◆ ReferenceCountedVector() [1/2]

template<class Element>
ReferenceCountedVector< Element >::ReferenceCountedVector ( const Element *  begin,
const Element *  end,
TypeHandle  type_handle 
)
inline

Creates an array with all elements from begin up to but not including end.

Definition at line 37 of file pointerToArrayBase.I.

◆ ReferenceCountedVector() [2/2]

template<class Element>
ReferenceCountedVector< Element >::ReferenceCountedVector ( pvector< Element > &&  from)
inline

Creates an array that takes its elements from the given vector.

Definition at line 47 of file pointerToArrayBase.I.


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