Panda3D

Loading...
Searching...
No Matches
Public Types | Public Member Functions | Friends | List of all members
ConstPointerToArray< Element > Class Template Reference

Similar to PointerToArray, except that its contents may not be modified. More...

`#include "pointerToArray.h"`

Inheritance diagram for ConstPointerToArray< Element >:

## 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 >::const_iterator | iterator
typedef pvector< Element >::const_reference | reference
typedef pvector< Element >::const_reverse_iterator | reverse_iterator
typedef pvector< Element >::size_type | size_type
typedef PointerToArrayBase< Element >::To | To
typedef pvector< Element >::value_type | value_type
Public Types inherited from PointerToArrayBase< Element >
typedef PointerToBase< ReferenceCountedVector< Element > >::To | To
Public Types inherited from PointerToBase< ReferenceCountedVector< Element > >
typedef ReferenceCountedVector< Element > | To

## Public Member Functions
| ConstPointerToArray (const ConstPointerToArray< Element > &copy)
| ConstPointerToArray (const Element *begin, const Element *end, TypeHandle type_handle=get_type_handle(Element))
| Initializes a ConstPointerToArray by copying existing elements.
| ConstPointerToArray (const PointerToArray< Element > &copy)
| ConstPointerToArray (ConstPointerToArray< Element > &&from) noexcept
| ConstPointerToArray (PointerToArray< Element > &&from) noexcept
| ConstPointerToArray (pvector< Element > &&from, TypeHandle type_handle=get_type_handle(Element))
| Initializes the PTA from a vector.
| ConstPointerToArray (TypeHandle type_handle=get_type_handle(Element))
reference | back () const
iterator | begin () const
size_type | capacity () const
PointerToArray< Element > | cast_non_const () const
| Casts away the constness of the CPTA(Element), and returns an equivalent PTA(Element).
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).
size_t | count (const Element &) const
| Counts the frequency at which the given element occurs in the vector.
bool | empty () const
iterator | end () const
reference | front () const
std::string | get_data () const
| This method exists mainly to access the data of the array easily from a high-level language such as Python.
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.
int | get_node_ref_count () const
| Returns the node_ref of the underlying vector.
int | get_ref_count () const
| Returns the reference count of the underlying vector.
std::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.
size_type | max_size () const
void | node_ref () const
| Increments the node_ref of the underlying vector.
bool | node_unref () const
| Decrements the node_ref of the underlying vector.
| operator const Element * () const
| The pointer typecast operator is convenient for maintaining the fiction that we actually have a C-style array.
ConstPointerToArray< Element > & | operator= (const ConstPointerToArray< Element > &copy)
ConstPointerToArray< Element > & | operator= (const PointerToArray< Element > &copy)
ConstPointerToArray< Element > & | operator= (ConstPointerToArray< Element > &&from) noexcept
ConstPointerToArray< Element > & | operator= (PointerToArray< Element > &&from) noexcept
ConstPointerToArray< Element > & | operator= (ReferenceCountedVector< Element > *ptr)
reference | operator[] (int n) const
reference | operator[] (size_type n) const
const Element * | p () const
| Function p() is similar to the function from ConstPointerTo.
ConstPointerToArray< Element >::reverse_iterator | rbegin () const
void | ref () const
| Increments the reference count of the underlying vector.
ConstPointerToArray< Element >::reverse_iterator | rend () const
size_type | size () const
bool | unref () const
| Decrements the reference count of the underlying vector.
const pvector< Element > & | v () const
| To access the vector itself, for more direct fiddling with some of the vector's esoteric functionality.
const ReferenceCountedVector< Element > * | v0 () const
| To access the internal ReferenceCountedVector object, for very low-level fiddling.
Public Member Functions inherited from PointerToBase< ReferenceCountedVector< Element > >
void | clear ()
| A convenient way to set the PointerTo object to NULL.
void | output (std::ostream &out) const
| A handy function to output PointerTo's as a hex pointer followed by a reference count.
Public Member Functions inherited from PointerToVoid
size_t | get_hash () const
constexpr bool | is_null () const
| Returns true if the PointerTo is a NULL pointer, false otherwise.
bool | operator!= (const PointerToVoid &other) const
bool | operator< (const PointerToVoid &other) const
bool | operator< (const void *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.
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)

## Friends
class | PointerToArray< Element >

## Detailed Description

template<class Element>
class ConstPointerToArray< Element >

Similar to PointerToArray, except that its contents may not be modified.

Definition at line 254 of file pointerToArray.h.

## Member Typedef Documentation

## ◆ const_iterator

template<class Element>

typedef pvector<Element>::const_iterator ConstPointerToArray< Element >::const_iterator

Definition at line 295 of file pointerToArray.h.

## ◆ const_reference

template<class Element>

typedef pvector<Element>::const_reference ConstPointerToArray< Element >::const_reference

Definition at line 293 of file pointerToArray.h.

## ◆ const_reverse_iterator

template<class Element>

typedef pvector<Element>::const_reverse_iterator ConstPointerToArray< Element >::const_reverse_iterator

Definition at line 302 of file pointerToArray.h.

## ◆ difference_type

template<class Element>

typedef pvector<Element>::difference_type ConstPointerToArray< Element >::difference_type

Definition at line 303 of file pointerToArray.h.

## ◆ iterator

template<class Element>

typedef pvector<Element>::const_iterator ConstPointerToArray< Element >::iterator

Definition at line 294 of file pointerToArray.h.

## ◆ reference

template<class Element>

typedef pvector<Element>::const_reference ConstPointerToArray< Element >::reference

Definition at line 292 of file pointerToArray.h.

## ◆ reverse_iterator

template<class Element>

typedef pvector<Element>::const_reverse_iterator ConstPointerToArray< Element >::reverse_iterator

Definition at line 300 of file pointerToArray.h.

## ◆ size_type

template<class Element>

typedef pvector<Element>::size_type ConstPointerToArray< Element >::size_type

Definition at line 304 of file pointerToArray.h.

## ◆ To

template<class Element>

typedef PointerToArrayBase<Element>::To ConstPointerToArray< Element >::To

Definition at line 290 of file pointerToArray.h.

## ◆ value_type

template<class Element>

typedef pvector<Element>::value_type ConstPointerToArray< Element >::value_type

Definition at line 291 of file pointerToArray.h.

## Constructor & Destructor Documentation

## ◆ ConstPointerToArray() [1/7]

template<class Element>

ConstPointerToArray< Element >::ConstPointerToArray | ( | TypeHandle | type_handle = get_type_handle(Element) | ) |
| inline

Definition at line 654 of file pointerToArray.I.

## ◆ ConstPointerToArray() [2/7]

template<class Element>

ConstPointerToArray< Element >::ConstPointerToArray | ( | const Element * | begin,
|  | const Element * | end,
|  | TypeHandle | type_handle = get_type_handle(Element) )
| inline

Initializes a ConstPointerToArray by copying existing elements.

Definition at line 665 of file pointerToArray.I.

## ◆ ConstPointerToArray() [3/7]

template<class Element>

ConstPointerToArray< Element >::ConstPointerToArray | ( | const PointerToArray< Element > & | copy | ) |
| inline

Definition at line 676 of file pointerToArray.I.

## ◆ ConstPointerToArray() [4/7]

template<class Element>

ConstPointerToArray< Element >::ConstPointerToArray | ( | const ConstPointerToArray< Element > & | copy | ) |
| inline

Definition at line 687 of file pointerToArray.I.

## ◆ ConstPointerToArray() [5/7]

template<class Element>

ConstPointerToArray< Element >::ConstPointerToArray | ( | PointerToArray< Element > && | from | ) |
| inline noexcept

Definition at line 698 of file pointerToArray.I.

## ◆ ConstPointerToArray() [6/7]

template<class Element>

ConstPointerToArray< Element >::ConstPointerToArray | ( | ConstPointerToArray< Element > && | from | ) |
| inline noexcept

Definition at line 709 of file pointerToArray.I.

## ◆ ConstPointerToArray() [7/7]

template<class Element>

ConstPointerToArray< Element >::ConstPointerToArray | ( | pvector< Element > && | from,
|  | TypeHandle | type_handle = get_type_handle(Element) )
| inline explicit

Initializes the PTA from a vector.

Definition at line 720 of file pointerToArray.I.

## Member Function Documentation

## ◆ back()

template<class Element>

ConstPointerToArray< Element >::reference ConstPointerToArray< Element >::back | ( |  | ) | const
| inline

Definition at line 836 of file pointerToArray.I.

## ◆ begin()

template<class Element>

ConstPointerToArray< Element >::iterator ConstPointerToArray< Element >::begin | ( |  | ) | const
| inline

Definition at line 731 of file pointerToArray.I.

## ◆ capacity()

template<class Element>

ConstPointerToArray< Element >::size_type ConstPointerToArray< Element >::capacity | ( |  | ) | const
| inline

Definition at line 809 of file pointerToArray.I.

## ◆ cast_non_const()

template<class Element>

PointerToArray< Element > ConstPointerToArray< Element >::cast_non_const | ( |  | ) | const
| inline

Casts away the constness of the CPTA(Element), and returns an equivalent PTA(Element).

Definition at line 926 of file pointerToArray.I.

## ◆ clear()

template<class Element>

void ConstPointerToArray< Element >::clear | ( |  | ) |
| 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 1108 of file pointerToArray.I.

## ◆ count()

template<class Element>

size_t ConstPointerToArray< Element >::count | ( | const Element & | value | ) | const
| inline

Counts the frequency at which the given element occurs in the vector.

Definition at line 1040 of file pointerToArray.I.

Referenced by get_subdata().

## ◆ empty()

template<class Element>

bool ConstPointerToArray< Element >::empty | ( |  | ) | const
| inline

Definition at line 800 of file pointerToArray.I.

## ◆ end()

template<class Element>

ConstPointerToArray< Element >::iterator ConstPointerToArray< Element >::end | ( |  | ) | const
| inline

Definition at line 743 of file pointerToArray.I.

## ◆ front()

template<class Element>

ConstPointerToArray< Element >::reference ConstPointerToArray< Element >::front | ( |  | ) | const
| inline

Definition at line 821 of file pointerToArray.I.

## ◆ get_data()

template<class Element>

std::string ConstPointerToArray< Element >::get_data | ( |  | ) | const
| 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 953 of file pointerToArray.I.

References get_subdata().

## ◆ get_element()

template<class Element>

const Element & ConstPointerToArray< Element >::get_element | ( | size_type | n | ) | const
| 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 940 of file pointerToArray.I.

## ◆ get_node_ref_count()

template<class Element>

int ConstPointerToArray< Element >::get_node_ref_count | ( |  | ) | const
| inline

Returns the node_ref of the underlying vector.

Definition at line 1009 of file pointerToArray.I.

## ◆ get_ref_count()

template<class Element>

int ConstPointerToArray< Element >::get_ref_count | ( |  | ) | const
| inline

Returns the reference count of the underlying vector.

Definition at line 978 of file pointerToArray.I.

## ◆ get_subdata()

template<class Element>

std::string ConstPointerToArray< Element >::get_subdata | ( | size_type | n,
|  | size_type | count ) const
| 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 966 of file pointerToArray.I.

References count(), and p().

Referenced by get_data().

## ◆ max_size()

template<class Element>

ConstPointerToArray< Element >::size_type ConstPointerToArray< Element >::max_size | ( |  | ) | const
| inline

Definition at line 788 of file pointerToArray.I.

## ◆ node_ref()

template<class Element>

void ConstPointerToArray< Element >::node_ref | ( |  | ) | const
| inline

Increments the node_ref of the underlying vector.

Definition at line 1018 of file pointerToArray.I.

## ◆ node_unref()

template<class Element>

bool ConstPointerToArray< Element >::node_unref | ( |  | ) | const
| inline

Decrements the node_ref of the underlying vector.

Definition at line 1030 of file pointerToArray.I.

## ◆ operator const Element *()

template<class Element>

ConstPointerToArray< Element >::operator const Element * | ( |  | ) | const
| 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 881 of file pointerToArray.I.

## ◆ operator=() [1/5]

template<class Element>

ConstPointerToArray< Element > & ConstPointerToArray< Element >::operator= | ( | const ConstPointerToArray< Element > & | copy | ) |
| inline

Definition at line 1074 of file pointerToArray.I.

## ◆ operator=() [2/5]

template<class Element>

ConstPointerToArray< Element > & ConstPointerToArray< Element >::operator= | ( | const PointerToArray< Element > & | copy | ) |
| inline

Definition at line 1063 of file pointerToArray.I.

## ◆ operator=() [3/5]

template<class Element>

ConstPointerToArray< Element > & ConstPointerToArray< Element >::operator= | ( | ConstPointerToArray< Element > && | from | ) |
| inline noexcept

Definition at line 1096 of file pointerToArray.I.

## ◆ operator=() [4/5]

template<class Element>

ConstPointerToArray< Element > & ConstPointerToArray< Element >::operator= | ( | PointerToArray< Element > && | from | ) |
| inline noexcept

Definition at line 1085 of file pointerToArray.I.

## ◆ operator=() [5/5]

template<class Element>

ConstPointerToArray< Element > & ConstPointerToArray< Element >::operator= | ( | ReferenceCountedVector< Element > * | ptr | ) |
| inline

Definition at line 1053 of file pointerToArray.I.

## ◆ operator[]() [1/2]

template<class Element>

ConstPointerToArray< Element >::reference ConstPointerToArray< Element >::operator[] | ( | int | n | ) | const
| inline

Definition at line 868 of file pointerToArray.I.

## ◆ operator[]() [2/2]

template<class Element>

ConstPointerToArray< Element >::reference ConstPointerToArray< Element >::operator[] | ( | size_type | n | ) | const
| inline

Definition at line 852 of file pointerToArray.I.

## ◆ p()

template<class Element>

const Element * ConstPointerToArray< Element >::p | ( |  | ) | const
| inline

Function p() is similar to the function from ConstPointerTo.

It does the same thing: it returns the same thing as the typecast operator, above.

Definition at line 892 of file pointerToArray.I.

Referenced by get_subdata().

## ◆ rbegin()

template<class Element>

ConstPointerToArray< Element >::reverse_iterator ConstPointerToArray< Element >::rbegin | ( |  | ) | const
| inline

Definition at line 755 of file pointerToArray.I.

## ◆ ref()

template<class Element>

void ConstPointerToArray< Element >::ref | ( |  | ) | const
| inline

Increments the reference count of the underlying vector.

Definition at line 987 of file pointerToArray.I.

## ◆ rend()

template<class Element>

ConstPointerToArray< Element >::reverse_iterator ConstPointerToArray< Element >::rend | ( |  | ) | const
| inline

Definition at line 767 of file pointerToArray.I.

## ◆ size()

template<class Element>

ConstPointerToArray< Element >::size_type ConstPointerToArray< Element >::size | ( |  | ) | const
| inline

Definition at line 779 of file pointerToArray.I.

## ◆ unref()

template<class Element>

bool ConstPointerToArray< Element >::unref | ( |  | ) | const
| inline

Decrements the reference count of the underlying vector.

Definition at line 999 of file pointerToArray.I.

## ◆ v()

template<class Element>

const pvector< Element > & ConstPointerToArray< Element >::v | ( |  | ) | const
| inline

To access the vector itself, for more direct fiddling with some of the vector's esoteric functionality.

Definition at line 903 of file pointerToArray.I.

## ◆ v0()

template<class Element>

const ReferenceCountedVector< Element > * ConstPointerToArray< Element >::v0 | ( |  | ) | const
| inline

To access the internal ReferenceCountedVector object, for very low-level fiddling.

Know what you are doing!

Definition at line 916 of file pointerToArray.I.

## Friends And Related Symbol Documentation

## ◆ PointerToArray< Element >

template<class Element>

friend class PointerToArray< Element >
| friend

Definition at line 382 of file pointerToArray.h.

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

- panda/src/express/pointerToArray.h
- panda/src/express/pointerToArray.I