Panda3D
|
A special kind of PointerTo that stores an array of the indicated element type, instead of a single element. More...
#include "pointerToArray.h"
Public Types | |
typedef pvector< Element >::const_iterator | const_iterator |
typedef pvector< Element >::const_reference | const_reference |
typedef pvector< Element >::const_reverse_iterator | const_reverse_iterator |
typedef pvector< Element >::difference_type | difference_type |
typedef pvector< Element >::iterator | iterator |
typedef pvector< Element >::reference | reference |
typedef pvector< Element >::reverse_iterator | reverse_iterator |
typedef pvector< Element >::size_type | size_type |
typedef PointerToArrayBase< Element >::To | To |
typedef pvector< Element >::value_type | value_type |
![]() | |
typedef PointerToBase< ReferenceCountedVector< Element > >::To | To |
![]() | |
typedef ReferenceCountedVector< Element > | To |
Public Member Functions | |
PointerToArray (TypeHandle type_handle=get_type_handle(Element)) | |
PointerToArray (size_type n, const Element &value, TypeHandle type_handle=get_type_handle(Element)) | |
PointerToArray (const PointerToArray< Element > ©) | |
reference | back () const |
iterator | begin () const |
size_type | capacity () const |
void | clear () |
To empty the PTA, use the clear() method, since assignment to NULL is problematic (given the ambiguity of the pointer type of NULL). More... | |
bool | empty () const |
iterator | end () const |
void | erase (iterator position) |
void | erase (iterator first, iterator last) |
reference | front () const |
string | get_data () const |
This method exists mainly to access the data of the array easily from a high-level language such as Python. More... | |
const Element & | get_element (size_type n) const |
This method exists mainly to access the elements of the array easily from a high-level language such as Python, especially on Windows, where the above index element accessor methods can't be defined because of a confusion with the pointer typecast operator. More... | |
int | get_node_ref_count () const |
Returns the node_ref of the underlying vector. More... | |
int | get_ref_count () const |
Returns the reference count of the underlying vector. More... | |
string | get_subdata (size_type n, size_type count) const |
This method exists mainly to access the data of the array easily from a high-level language such as Python. More... | |
void * | get_void_ptr () const |
Returns the reference to memory where the vector is stored. More... | |
iterator | insert (iterator position, const Element &x) |
void | insert (iterator position, size_type n, const Element &x) |
void | make_empty () |
Empties the array pointed to. More... | |
size_type | max_size () const |
void | node_ref () const |
Increments the node_ref of the underlying vector. More... | |
bool | node_unref () const |
Decrements the node_ref of the underlying vector. More... | |
operator Element * () const | |
The pointer typecast operator is convenient for maintaining the fiction that we actually have a C-style array. More... | |
PointerToArray< Element > & | operator= (ReferenceCountedVector< Element > *ptr) |
PointerToArray< Element > & | operator= (const PointerToArray< Element > ©) |
reference | operator[] (size_type n) const |
reference | operator[] (int n) const |
Element * | p () const |
Function p() is similar to the function from PointerTo. More... | |
void | pop_back () |
void | push_back (const Element &x) |
PointerToArray< Element >::reverse_iterator | rbegin () const |
void | ref () const |
Increments the reference count of the underlying vector. More... | |
PointerToArray< Element >::reverse_iterator | rend () const |
void | reserve (size_type n) |
void | resize (size_type n) |
void | set_data (const string &data) |
This method exists mainly to access the data of the array easily from a high-level language such as Python. More... | |
void | set_element (size_type n, const Element &value) |
This method exists mainly to access the elements of the array easily from a high-level language such as Python, especially on Windows, where the above index element accessor methods can't be defined because of a confusion with the pointer typecast operator. More... | |
void | set_subdata (size_type n, size_type count, const string &data) |
This method exists mainly to access the data of the array easily from a high-level language such as Python. More... | |
void | set_void_ptr (void *p) |
Sets this PTA to point to the pointer passed in. More... | |
size_type | size () const |
bool | unref () const |
Decrements the reference count of the underlying vector. More... | |
pvector< Element > & | v () const |
To access the vector itself, for more direct fiddling with some of the vector's esoteric functionality. More... | |
ReferenceCountedVector< Element > * | v0 () const |
To access the internal ReferenceCountedVector object, for very low-level fiddling. More... | |
![]() | |
void | clear () |
A convenient way to set the PointerTo object to NULL. More... | |
void | output (ostream &out) const |
A handy function to output PointerTo's as a hex pointer followed by a reference count. More... | |
![]() | |
size_t | get_hash () const |
bool | is_null () const |
Returns true if the PointerTo is a NULL pointer, false otherwise. More... | |
bool | operator!= (const PointerToVoid &other) const |
bool | operator< (const void *other) const |
bool | operator< (const PointerToVoid &other) const |
bool | operator== (const PointerToVoid &other) const |
void | swap (PointerToVoid &other) NOEXCEPT |
Swaps the contents of this PointerTo with the other, without touching the reference counts. More... | |
Static Public Member Functions | |
static PointerToArray< Element > | empty_array (size_type n, TypeHandle type_handle=get_type_handle(Element)) |
Return an empty array of size n. More... | |
Friends | |
class | ConstPointerToArray< Element > |
A special kind of PointerTo that stores an array of the indicated element type, instead of a single element.
This is actually implemented as an STL vector, using the RefCountObj class to wrap it up with a reference count.
We actually inherit from NodeRefCountObj these days, 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 99 of file pointerToArray.h.
|
inline |
To empty the PTA, use the clear() method, since assignment to NULL is problematic (given the ambiguity of the pointer type of NULL).
Definition at line 724 of file pointerToArray.I.
Referenced by PointerToArray< Element >::make_empty(), and PointerToArray< Element >::node_unref().
|
inlinestatic |
Return an empty array of size n.
Definition at line 43 of file pointerToArray.I.
References PointerToArray< Element >::make_empty(), and PointerToVoid::swap().
|
inline |
This method exists mainly to access the data of the array easily from a high-level language such as Python.
It returns the entire contents of the vector as a block of raw data in a string.
Definition at line 500 of file pointerToArray.I.
References PointerToArray< Element >::get_subdata(), and PointerToArray< Element >::set_data().
Referenced by PointerToArray< Element >::set_element().
|
inline |
This method exists mainly to access the elements of the array easily from a high-level language such as Python, especially on Windows, where the above index element accessor methods can't be defined because of a confusion with the pointer typecast operator.
Definition at line 468 of file pointerToArray.I.
References PointerToArray< Element >::set_element().
Referenced by PointerToArray< Element >::v0().
|
inline |
Returns the node_ref of the underlying vector.
Definition at line 645 of file pointerToArray.I.
References PointerToArray< Element >::node_ref().
Referenced by ConstPointerToArray< unsigned char >::get_node_ref_count(), and PointerToArray< Element >::unref().
|
inline |
Returns the reference count of the underlying vector.
Definition at line 608 of file pointerToArray.I.
References PointerToArray< Element >::ref().
Referenced by ConstPointerToArray< unsigned char >::get_ref_count(), and PointerToArray< Element >::set_void_ptr().
|
inline |
This method exists mainly to access the data of the array easily from a high-level language such as Python.
It returns the contents of a portion of the vector–from element (n) through element (n + count - 1)–as a block of raw data in a string.
Definition at line 533 of file pointerToArray.I.
References PointerToArray< Element >::p(), and PointerToArray< Element >::set_subdata().
Referenced by PointerToArray< Element >::get_data(), ConstPointerToArray< unsigned char >::get_data(), and PointerToArray< Element >::set_data().
|
inline |
Returns the reference to memory where the vector is stored.
To be used only with set_void_ptr
Definition at line 586 of file pointerToArray.I.
References PointerToArray< Element >::set_void_ptr().
Referenced by PointerToArray< Element >::set_subdata().
|
inline |
Empties the array pointed to.
This is different from clear(), which reassigns the pointer to a NULL pointer.
Definition at line 392 of file pointerToArray.I.
References PointerToArray< Element >::clear().
Referenced by PointerToArray< Element >::empty_array().
|
inline |
Increments the node_ref of the underlying vector.
Definition at line 656 of file pointerToArray.I.
References PointerToArray< Element >::node_unref().
Referenced by PointerToArray< Element >::get_node_ref_count(), and ConstPointerToArray< unsigned char >::node_ref().
|
inline |
Decrements the node_ref of the underlying vector.
Definition at line 670 of file pointerToArray.I.
References PointerToArray< Element >::clear().
Referenced by PointerToArray< Element >::node_ref().
|
inline |
The pointer typecast operator is convenient for maintaining the fiction that we actually have a C-style array.
It returns the address of the first element in the array, unless the pointer is unassigned, in which case it returns NULL.
Definition at line 411 of file pointerToArray.I.
References PointerToArray< Element >::p().
|
inline |
Function p() is similar to the function from PointerTo.
It does the same thing: it returns the same thing as the typecast operator, above.
Definition at line 425 of file pointerToArray.I.
References PointerToArray< Element >::v().
Referenced by PointerToArray< Element >::get_subdata(), ConstPointerToArray< unsigned char >::get_subdata(), PointerToArray< Element >::operator Element *(), and PointerToArray< Element >::set_subdata().
|
inline |
Increments the reference count of the underlying vector.
Definition at line 619 of file pointerToArray.I.
References PointerToArray< Element >::unref().
Referenced by PointerToArray< Element >::get_ref_count(), and ConstPointerToArray< unsigned char >::ref().
|
inline |
This method exists mainly to access the data of the array easily from a high-level language such as Python.
It replaces the entire contents of the vector from a block of raw data in a string.
Definition at line 516 of file pointerToArray.I.
References PointerToArray< Element >::get_subdata(), and PointerToArray< Element >::set_subdata().
Referenced by PointerToArray< Element >::get_data().
|
inline |
This method exists mainly to access the elements of the array easily from a high-level language such as Python, especially on Windows, where the above index element accessor methods can't be defined because of a confusion with the pointer typecast operator.
Definition at line 483 of file pointerToArray.I.
References PointerToArray< Element >::get_data().
Referenced by PointerToArray< Element >::get_element().
|
inline |
This method exists mainly to access the data of the array easily from a high-level language such as Python.
It replaces the contents of a portion of the vector–from element (n) through element (n + count - 1)–as a block of raw data in a string. The length of the string must be an even multiple of Element size bytes. The array may be expanded or truncated if the length of the string does not correspond to exactly count elements.
Definition at line 557 of file pointerToArray.I.
References PointerToArray< Element >::get_void_ptr(), and PointerToArray< Element >::p().
Referenced by PointerToArray< Element >::get_subdata(), and PointerToArray< Element >::set_data().
|
inline |
Sets this PTA to point to the pointer passed in.
Definition at line 597 of file pointerToArray.I.
References PointerToArray< Element >::get_ref_count().
Referenced by PointerToArray< Element >::get_void_ptr().
|
inline |
Decrements the reference count of the underlying vector.
Definition at line 633 of file pointerToArray.I.
References PointerToArray< Element >::get_node_ref_count().
Referenced by PointerToArray< Element >::ref().
|
inline |
To access the vector itself, for more direct fiddling with some of the vector's esoteric functionality.
Definition at line 438 of file pointerToArray.I.
References PointerToArray< Element >::v0().
Referenced by PointerToArray< Element >::p().
|
inline |
To access the internal ReferenceCountedVector object, for very low-level fiddling.
Know what you are doing!
Definition at line 453 of file pointerToArray.I.
References PointerToArray< Element >::get_element().
Referenced by PointerToArray< Element >::v().