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(
int __getbuffer__(PyObject *
self, Py_buffer *view,
int flags));
121 EXTENSION(
void __releasebuffer__(PyObject *
self, Py_buffer *view)
const);
126 typedef typename PointerToArrayBase<Element>::To To;
151 INLINE iterator begin()
const;
152 INLINE iterator end()
const;
153 INLINE
typename PointerToArray<Element>::reverse_iterator rbegin()
const;
154 INLINE
typename PointerToArray<Element>::reverse_iterator rend()
const;
158 INLINE size_type size()
const;
159 INLINE size_type max_size()
const;
160 INLINE
bool empty()
const;
165 INLINE
void reserve(size_type n);
166 INLINE
void resize(size_type n);
167 INLINE size_type capacity()
const;
168 INLINE reference front()
const;
169 INLINE reference back()
const;
170 INLINE iterator insert(iterator position,
const Element &x);
171 INLINE
void insert(iterator position, size_type n,
const Element &x);
179 INLINE
void erase(iterator position);
180 INLINE
void erase(iterator first, iterator last);
182 #if !defined(WIN32_VC) && !defined (WIN64_VC) 183 INLINE reference operator [](size_type n)
const;
184 INLINE reference operator [](
int n)
const;
187 INLINE
void push_back(
const Element &x);
188 INLINE
void pop_back();
191 INLINE
operator Element *()
const;
192 INLINE Element *
p()
const;
197 INLINE
const Element &
get_element(size_type n)
const;
198 INLINE
void set_element(size_type n,
const Element &value);
199 INLINE std::string
get_data()
const;
200 INLINE
void set_data(
const std::string &data);
202 INLINE
void set_subdata(size_type n, size_type
count,
const std::string &data);
214 INLINE
void ref()
const;
215 INLINE
bool unref()
const;
221 INLINE
size_t count(
const Element &)
const;
249 template <
class Element>
265 INLINE size_type size()
const;
266 INLINE
const Element &
get_element(size_type n)
const;
267 EXTENSION(
const Element &__getitem__(size_type n)
const);
268 EXTENSION(PyObject *
get_data()
const);
273 INLINE
size_t count(
const Element &)
const;
276 EXTENSION(
int __getbuffer__(PyObject *
self, Py_buffer *view,
int flags)
const);
277 EXTENSION(
void __releasebuffer__(PyObject *
self, Py_buffer *view)
const);
282 typedef typename PointerToArrayBase<Element>::To To;
288 #if defined(WIN32_VC) || defined(WIN64_VC) 307 INLINE iterator begin()
const;
308 INLINE iterator end()
const;
309 INLINE
typename ConstPointerToArray<Element>::reverse_iterator rbegin()
const;
310 INLINE
typename ConstPointerToArray<Element>::reverse_iterator rend()
const;
315 INLINE size_type size()
const;
316 INLINE size_type max_size()
const;
317 INLINE
bool empty()
const;
322 INLINE size_type capacity()
const;
323 INLINE reference front()
const;
324 INLINE reference back()
const;
326 #if !defined(WIN32_VC) && !defined(WIN64_VC) 327 INLINE reference operator [](size_type n)
const;
328 INLINE reference operator [](
int n)
const;
331 INLINE
operator const Element *()
const;
332 INLINE
const Element *
p()
const;
338 INLINE
const Element &
get_element(size_type n)
const;
339 INLINE std::string
get_data()
const;
343 INLINE
void ref()
const;
344 INLINE
bool unref()
const;
350 INLINE
size_t count(
const Element &)
const;
380 #define PTA(type) PointerToArray< type > 381 #define CPTA(type) ConstPointerToArray< type > 385 #endif // HAVE_POINTERTOARRAY_H Element * p() const
Function p() is similar to the function from PointerTo.
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...
int get_node_ref_count() const
Returns the node_ref of the underlying vector.
void clear()
To empty the PTA, use the clear() method, since assignment to NULL is problematic (given the ambiguit...
void node_ref() const
Increments the node_ref of the underlying vector.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void * get_void_ptr() const
Returns the reference to memory where the vector is stored.
int get_ref_count() const
Returns 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 ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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 ...
bool node_unref() const
Decrements the node_ref of the underlying vector.
A special kind of PointerTo that stores an array of the indicated element type, instead of a single e...
static PointerToArray< Element > empty_array(size_type n, TypeHandle type_handle=get_type_handle(Element))
Return an empty array of size n.
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...
ReferenceCountedVector< Element > * v0() const
To access the internal ReferenceCountedVector object, for very low-level fiddling.
This is our own Panda specialization on the default STL vector.
void make_empty()
Empties the array pointed to.
void set_void_ptr(void *p)
Sets this PTA to point to the pointer passed in.
void ref() const
Increments the reference count of the underlying vector.
PointerToArray< Element > cast_non_const() const
Casts away the constness of the CPTA(Element), and returns an equivalent PTA(Element).
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...
const pvector< Element > & v() const
To access the vector itself, for more direct fiddling with some of the vector's esoteric functionalit...
const Element * p() const
Function p() is similar to the function from ConstPointerTo.
pvector< Element > & v() const
To access the vector itself, for more direct fiddling with some of the vector's esoteric functionalit...
void node_ref() const
Increments the node_ref of the underlying vector.
bool unref() const
Decrements the reference count of the underlying vector.
This is the base class for PointerToArray and ConstPointerToArray.
void clear()
To empty the PTA, use the clear() method, since assignment to NULL is problematic (given the ambiguit...
int get_ref_count() const
Returns the reference count of the underlying vector.
int get_node_ref_count() const
Returns the node_ref 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 P...
const ReferenceCountedVector< Element > * v0() const
To access the internal ReferenceCountedVector object, for very low-level fiddling.
TypeHandle is the identifier used to differentiate C++ class types.
size_t count(const Element &) const
Counts the frequency at which the given element occurs in the vector.
This defines the object that is actually stored and reference-counted internally by a PointerToArray.
size_t count(const Element &) const
Counts the frequency at which the given element occurs in the 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 P...
void ref() const
Increments the reference count of the underlying vector.
Similar to PointerToArray, except that its contents may not be modified.
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 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...
bool node_unref() const
Decrements the node_ref of the underlying vector.
bool unref() const
Decrements the reference count of the underlying vector.