14 #ifndef POINTERTOARRAY_H
15 #define POINTERTOARRAY_H
64 #if (defined(WIN32_VC) || defined(WIN64_VC)) && !defined(__INTEL_COMPILER)
67 #pragma warning (disable : 4506)
70 template <
class Element>
86 template <
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);
128 typedef typename PointerToArrayBase<Element>::To To;
153 INLINE iterator begin()
const;
154 INLINE iterator end()
const;
155 INLINE
typename PointerToArray<Element>::reverse_iterator rbegin()
const;
156 INLINE
typename PointerToArray<Element>::reverse_iterator rend()
const;
160 INLINE size_type size()
const;
161 INLINE size_type max_size()
const;
162 INLINE
bool empty()
const;
167 INLINE
void reserve(size_type n);
168 INLINE
void resize(size_type n);
169 INLINE size_type capacity()
const;
170 INLINE reference front()
const;
171 INLINE reference back()
const;
172 INLINE iterator insert(iterator position,
const Element &x);
173 INLINE
void insert(iterator position, size_type n,
const Element &x);
181 INLINE
void erase(iterator position);
182 INLINE
void erase(iterator first, iterator last);
184 #if !defined(WIN32_VC) && !defined (WIN64_VC)
185 INLINE reference operator [](size_type n)
const;
186 INLINE reference operator [](
int n)
const;
189 INLINE
void push_back(
const Element &x);
190 INLINE
void pop_back();
193 INLINE
operator Element *()
const;
194 INLINE Element *
p()
const;
199 INLINE
const Element &
get_element(size_type n)
const;
200 INLINE
void set_element(size_type n,
const Element &value);
201 INLINE std::string
get_data()
const;
202 INLINE
void set_data(
const std::string &data);
204 INLINE
void set_subdata(size_type n, size_type
count,
const std::string &data);
216 INLINE
void ref()
const;
217 INLINE
bool unref()
const;
223 INLINE
size_t count(
const Element &)
const;
251 template <
class Element>
267 INLINE size_type size()
const;
268 INLINE
const Element &
get_element(size_type n)
const;
269 EXTENSION(
const Element &__getitem__(size_type n)
const);
270 EXTENSION(PyObject *
get_data()
const);
275 INLINE
size_t count(
const Element &)
const;
278 EXTENSION(PyObject *__reduce__(PyObject *
self)
const);
280 EXTENSION(
int __getbuffer__(PyObject *
self, Py_buffer *view,
int flags)
const);
281 EXTENSION(
void __releasebuffer__(PyObject *
self, Py_buffer *view)
const);
286 typedef typename PointerToArrayBase<Element>::To To;
292 #if defined(WIN32_VC) || defined(WIN64_VC)
311 INLINE iterator begin()
const;
312 INLINE iterator end()
const;
313 INLINE
typename ConstPointerToArray<Element>::reverse_iterator rbegin()
const;
314 INLINE
typename ConstPointerToArray<Element>::reverse_iterator rend()
const;
319 INLINE size_type size()
const;
320 INLINE size_type max_size()
const;
321 INLINE
bool empty()
const;
326 INLINE size_type capacity()
const;
327 INLINE reference front()
const;
328 INLINE reference back()
const;
330 #if !defined(WIN32_VC) && !defined(WIN64_VC)
331 INLINE reference operator [](size_type n)
const;
332 INLINE reference operator [](
int n)
const;
335 INLINE
operator const Element *()
const;
336 INLINE
const Element *
p()
const;
342 INLINE
const Element &
get_element(size_type n)
const;
343 INLINE std::string
get_data()
const;
347 INLINE
void ref()
const;
348 INLINE
bool unref()
const;
354 INLINE
size_t count(
const Element &)
const;
384 #define PTA(type) PointerToArray< type >
385 #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.