Panda3D
pointerToArrayBase.I
1 // Filename: pointerToArrayBase.I
2 // Created by: drose (30Oct06)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: ReferenceCountedVector::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 template<class Element>
23 ReferenceCountedVector(TypeHandle type_handle) : pvector<Element>(type_handle) {
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: ReferenceCountedVector::Copy Constructor
28 // Access: Public
29 // Description:
30 ////////////////////////////////////////////////////////////////////
31 template<class Element>
34  NodeReferenceCount(copy),
35  pvector<Element>(copy)
36 {
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: ReferenceCountedVector::empty_array constructor
41 // Access: Public
42 // Description: Creates an array of initial_size elements.
43 ////////////////////////////////////////////////////////////////////
44 template<class Element>
46 ReferenceCountedVector(TYPENAME ReferenceCountedVector<Element>::size_type initial_size, TypeHandle type_handle) :
47  pvector<Element>(initial_size, type_handle)
48 {
49 }
50 
51 ////////////////////////////////////////////////////////////////////
52 // Function: ReferenceCountedVector::Destructor
53 // Access: Public
54 // Description:
55 ////////////////////////////////////////////////////////////////////
56 template<class Element>
59 }
60 
61 ////////////////////////////////////////////////////////////////////
62 // Function: ReferenceCountedVector::size
63 // Access: Public
64 // Description:
65 ////////////////////////////////////////////////////////////////////
66 template<class Element>
67 INLINE TYPENAME ReferenceCountedVector<Element>::size_type ReferenceCountedVector<Element>::
68 size() const {
69  return pvector<Element>::size();
70 }
71 
72 ////////////////////////////////////////////////////////////////////
73 // Function: ReferenceCountedVector::insert
74 // Access: Public
75 // Description:
76 ////////////////////////////////////////////////////////////////////
77 template<class Element>
78 INLINE TYPENAME ReferenceCountedVector<Element>::iterator ReferenceCountedVector<Element>::
79 insert(iterator position, const Element &x) {
80  return pvector<Element>::insert(position, x);
81 }
82 
83 ////////////////////////////////////////////////////////////////////
84 // Function: ReferenceCountedVector::insert
85 // Access: Public
86 // Description:
87 ////////////////////////////////////////////////////////////////////
88 template<class Element>
90 insert(iterator position, size_type n, const Element &x) {
91  pvector<Element>::insert(position, n, x);
92 }
93 
94 ////////////////////////////////////////////////////////////////////
95 // Function: ReferenceCountedVector::erase
96 // Access: Public
97 // Description:
98 ////////////////////////////////////////////////////////////////////
99 template<class Element>
101 erase(iterator position) {
102  pvector<Element>::erase(position);
103 }
104 
105 ////////////////////////////////////////////////////////////////////
106 // Function: ReferenceCountedVector::erase
107 // Access: Public
108 // Description:
109 ////////////////////////////////////////////////////////////////////
110 template<class Element>
112 erase(iterator first, iterator last) {
113  pvector<Element>::erase(first, last);
114 }
115 
116 ////////////////////////////////////////////////////////////////////
117 // Function: ReferenceCountedVector::pop_back
118 // Access: Public
119 // Description:
120 ////////////////////////////////////////////////////////////////////
121 template<class Element>
123 pop_back() {
125 }
126 
127 ////////////////////////////////////////////////////////////////////
128 // Function: ReferenceCountedVector::clear
129 // Access: Public
130 // Description:
131 ////////////////////////////////////////////////////////////////////
132 template<class Element>
134 clear() {
136 }
137 
138 ////////////////////////////////////////////////////////////////////
139 // Function: PointerToArrayBase::Constructor
140 // Access: Protected
141 // Description:
142 ////////////////////////////////////////////////////////////////////
143 template<class Element>
146  PointerToBase<ReferenceCountedVector<Element> >(ptr)
147 {
148 }
149 
150 ////////////////////////////////////////////////////////////////////
151 // Function: PointerToArrayBase::Copy Constructor
152 // Access: Protected
153 // Description:
154 ////////////////////////////////////////////////////////////////////
155 template<class Element>
158  PointerToBase<ReferenceCountedVector<Element> >(copy)
159 {
160 }
161 
162 #ifdef USE_MOVE_SEMANTICS
163 ////////////////////////////////////////////////////////////////////
164 // Function: PointerToArrayBase::Move Constructor
165 // Access: Protected
166 // Description:
167 ////////////////////////////////////////////////////////////////////
168 template<class Element>
172 {
173 }
174 #endif // USE_MOVE_SEMANTICS
175 
176 ////////////////////////////////////////////////////////////////////
177 // Function: PointerToArrayBase::Destructor
178 // Access: Published
179 // Description:
180 ////////////////////////////////////////////////////////////////////
181 template<class Element>
184 }
185 
This is the base class for PointerTo and ConstPointerTo.
Definition: pointerToBase.h:32
This class specializes ReferenceCount to add an additional counter, called node_ref_count, for the purposes of counting the number of times the object is referenced by a "node", whatever that may mean in context.
This is our own Panda specialization on the default STL vector.
Definition: pvector.h:39
This is the base class for PointerToArray and ConstPointerToArray.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85
This defines the object that is actually stored and reference-counted internally by a PointerToArray...