14#ifndef POINTERTOARRAY_H
15#define POINTERTOARRAY_H
64#if (defined(WIN32_VC) || defined(WIN64_VC)) && !defined(__INTEL_COMPILER)
67#pragma warning (disable : 4506)
70template <
class Element>
86template <
class Element>
103 INLINE size_type size()
const;
104 INLINE
void push_back(
const Element &x);
105 INLINE
void pop_back();
106 INLINE
const Element &
get_element(size_type n)
const;
107 INLINE
void set_element(size_type n,
const Element &value);
108 EXTENSION(
const Element &__getitem__(size_type n)
const);
109 EXTENSION(
void __setitem__(size_type n,
const Element &value));
110 EXTENSION(PyObject *
get_data()
const);
111 EXTENSION(
void set_data(PyObject *data));
113 INLINE
void set_subdata(size_type n, size_type
count,
const std::string &data);
117 INLINE
size_t count(
const Element &)
const;
120 EXTENSION(PyObject *__reduce__(PyObject *self)
const);
122 EXTENSION(
int __getbuffer__(PyObject *self, Py_buffer *view,
int flags));
123 EXTENSION(
void __releasebuffer__(PyObject *self, Py_buffer *view)
const);
130 typedef typename PointerToArrayBase<Element>::To To;
155 INLINE iterator begin()
const;
156 INLINE iterator end()
const;
157 INLINE
typename PointerToArray<Element>::reverse_iterator rbegin()
const;
158 INLINE
typename PointerToArray<Element>::reverse_iterator rend()
const;
162 INLINE size_type size()
const;
163 INLINE size_type max_size()
const;
164 INLINE
bool empty()
const;
169 INLINE
void reserve(size_type n);
170 INLINE
void resize(size_type n);
171 INLINE size_type capacity()
const;
172 INLINE reference front()
const;
173 INLINE reference back()
const;
174 INLINE iterator insert(iterator position,
const Element &x);
175 INLINE
void insert(iterator position, size_type n,
const Element &x);
183 INLINE
void erase(iterator position);
184 INLINE
void erase(iterator first, iterator last);
186#if !defined(WIN32_VC) && !defined (WIN64_VC)
187 INLINE reference operator [](size_type n)
const;
188 INLINE reference operator [](
int n)
const;
191 INLINE
void push_back(
const Element &x);
192 INLINE
void pop_back();
195 INLINE
operator Element *()
const;
196 INLINE Element *
p()
const;
201 INLINE
const Element &
get_element(size_type n)
const;
202 INLINE
void set_element(size_type n,
const Element &value);
203 INLINE std::string
get_data()
const;
204 INLINE
void set_data(
const std::string &data);
206 INLINE
void set_subdata(size_type n, size_type
count,
const std::string &data);
218 INLINE
void ref()
const;
219 INLINE
bool unref()
const;
225 INLINE
size_t count(
const Element &)
const;
253template <
class Element>
269 INLINE size_type size()
const;
270 INLINE
const Element &
get_element(size_type n)
const;
271 EXTENSION(
const Element &__getitem__(size_type n)
const);
272 EXTENSION(PyObject *
get_data()
const);
277 INLINE
size_t count(
const Element &)
const;
280 EXTENSION(PyObject *__reduce__(PyObject *self)
const);
282 EXTENSION(
int __getbuffer__(PyObject *self, Py_buffer *view,
int flags)
const);
283 EXTENSION(
void __releasebuffer__(PyObject *self, Py_buffer *view)
const);
290 typedef typename PointerToArrayBase<Element>::To To;
296#if defined(WIN32_VC) || defined(WIN64_VC)
315 INLINE iterator begin()
const;
316 INLINE iterator end()
const;
317 INLINE
typename ConstPointerToArray<Element>::reverse_iterator rbegin()
const;
318 INLINE
typename ConstPointerToArray<Element>::reverse_iterator rend()
const;
323 INLINE size_type size()
const;
324 INLINE size_type max_size()
const;
325 INLINE
bool empty()
const;
330 INLINE size_type capacity()
const;
331 INLINE reference front()
const;
332 INLINE reference back()
const;
334#if !defined(WIN32_VC) && !defined(WIN64_VC)
335 INLINE reference operator [](size_type n)
const;
336 INLINE reference operator [](
int n)
const;
339 INLINE
operator const Element *()
const;
340 INLINE
const Element *
p()
const;
346 INLINE
const Element &
get_element(size_type n)
const;
347 INLINE std::string
get_data()
const;
351 INLINE
void ref()
const;
352 INLINE
bool unref()
const;
358 INLINE
size_t count(
const Element &)
const;
388#define PTA(type) PointerToArray< type >
389#define CPTA(type) ConstPointerToArray< type >
Similar to PointerToArray, except that its contents may not be modified.
int get_ref_count() const
Returns the reference count of the underlying vector.
std::string get_data() const
This method exists mainly to access the data of the array easily from a high-level language such as P...
bool node_unref() const
Decrements the node_ref of the underlying vector.
const Element * p() const
Function p() is similar to the function from ConstPointerTo.
void clear()
To empty the PTA, use the clear() method, since assignment to NULL is problematic (given the ambiguit...
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 P...
const ReferenceCountedVector< Element > * v0() const
To access the internal ReferenceCountedVector object, for very low-level fiddling.
size_t count(const Element &) const
Counts the frequency at which the given element occurs in the vector.
void node_ref() const
Increments the node_ref of the underlying vector.
int get_node_ref_count() const
Returns the node_ref 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 functionalit...
bool unref() const
Decrements the reference count of the underlying vector.
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 ...
PointerToArray< Element > cast_non_const() const
Casts away the constness of the CPTA(Element), and returns an equivalent PTA(Element).
void ref() const
Increments the reference count of the underlying vector.
This is the base class for PointerToArray and ConstPointerToArray.
A special kind of PointerTo that stores an array of the indicated element type, instead of a single e...
void set_data(const std::string &data)
This method exists mainly to access the data of the array easily from a high-level language such as P...
size_t count(const Element &) const
Counts the frequency at which the given element occurs in the vector.
pvector< Element > & v() const
To access the vector itself, for more direct fiddling with some of the vector's esoteric functionalit...
void set_void_ptr(void *p)
Sets this PTA to point to the pointer passed in.
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 P...
int get_ref_count() const
Returns the reference count of the underlying vector.
static PointerToArray< Element > empty_array(size_type n, TypeHandle type_handle=get_type_handle(Element))
Return an empty array of size n.
void set_subdata(size_type n, size_type count, const std::string &data)
This method exists mainly to access the data of the array easily from a high-level language such as P...
ReferenceCountedVector< Element > * v0() const
To access the internal ReferenceCountedVector object, for very low-level fiddling.
int get_node_ref_count() const
Returns the node_ref of the underlying vector.
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 ...
void clear()
To empty the PTA, use the clear() method, since assignment to NULL is problematic (given the ambiguit...
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 ...
void * get_void_ptr() const
Returns the reference to memory where the vector is stored.
void ref() const
Increments the reference count of the underlying vector.
void make_empty()
Empties the array pointed to.
bool unref() const
Decrements the reference count of the underlying vector.
Element * p() const
Function p() is similar to the function from PointerTo.
bool node_unref() const
Decrements the node_ref of the underlying vector.
void node_ref() const
Increments the node_ref of the underlying vector.
std::string get_data() const
This method exists mainly to access the data of the array easily from a high-level language such as P...
This defines the object that is actually stored and reference-counted internally by a PointerToArray.
TypeHandle is the identifier used to differentiate C++ class types.
This is our own Panda specialization on the default STL vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.