Isle
Loading...
Searching...
No Matches
lodlist.h
Go to the documentation of this file.
1#ifndef LODLIST_H
2#define LODLIST_H
3
4#include "assert.h"
5
6#include <stddef.h> // size_t
7
8class LODObject;
9
10// disable: identifier was truncated to '255' characters in the debug information
11#pragma warning(disable : 4786)
12
14//
15// LODListBase
16//
17// An LODListBase is an ordered list of LODObjects
18// where each successive object in the list has a more complex
19// geometric representation than the one preceeding it.
20//
21
22// VTABLE: LEGO1 0x100dbdc8
23// VTABLE: BETA10 0x101c3500
24// SIZE 0x10
32protected:
37 LODListBase(size_t capacity);
38
44 const LODObject* PushBack(const LODObject*);
49 const LODObject* PopBack();
50
51public:
55 virtual ~LODListBase();
61 const LODObject* operator[](int) const;
62
67 size_t Size() const;
68
73 size_t Capacity() const;
74
75 // SYNTHETIC: LEGO1 0x100a77b0
76 // SYNTHETIC: BETA10 0x1017b410
77 // LODListBase::`scalar deleting destructor'
78
79#ifdef _DEBUG
84 virtual void Dump(void (*pTracer)(const char*, ...)) const;
85#endif
86
87private:
88 // not implemented
90 LODListBase& operator=(const LODListBase&);
91
92private:
93 const LODObject** m_ppLODObject;
94 size_t m_capacity;
95 size_t m_size;
96};
97
99//
100// LODList
101//
102
109template <class T>
110class LODList : public LODListBase {
111public:
116 LODList(size_t capacity);
117
123 const T* operator[](int) const;
129 const T* PushBack(const T*);
134 const T* PopBack();
135};
136
138//
139// LODListBase implementation
140
141// FUNCTION: BETA10 0x1017b390
142inline LODListBase::LODListBase(size_t capacity)
143 : m_capacity(capacity), m_size(0), m_ppLODObject(new const LODObject*[capacity])
144{
145#ifdef _DEBUG
146 int i;
147
148 for (i = 0; i < (int) m_capacity; i++) {
149 m_ppLODObject[i] = 0;
150 }
151#endif
152}
153
154// FUNCTION: LEGO1 0x100a77e0
155// FUNCTION: BETA10 0x1017b450
157{
158 // all LODObject* should have been popped by client
159 assert(m_size == 0);
160
161 delete[] m_ppLODObject;
162}
163
164// FUNCTION: BETA10 0x1005c480
165inline size_t LODListBase::Size() const
166{
167 return m_size;
168}
169
170// FUNCTION: BETA10 0x10178b40
171inline size_t LODListBase::Capacity() const
172{
173 return m_capacity;
174}
175
176// FUNCTION: BETA10 0x1007b6a0
177inline const LODObject* LODListBase::operator[](int i) const
178{
179 assert((0 <= i) && (i < (int) m_size));
180
181 return m_ppLODObject[i];
182}
183
184// FUNCTION: BETA10 0x1007bb40
185inline const LODObject* LODListBase::PushBack(const LODObject* pLOD)
186{
187 assert(m_size < m_capacity);
188
189 m_ppLODObject[m_size++] = pLOD;
190 return pLOD;
191}
192
193// FUNCTION: BETA10 0x10178b60
195{
196 const LODObject* pLOD;
197
198 assert(m_size > 0);
199
200 pLOD = m_ppLODObject[--m_size];
201
202#ifdef _DEBUG
203 m_ppLODObject[m_size] = 0;
204#endif
205
206 return pLOD;
207}
208
209#ifdef _DEBUG
210// FUNCTION: BETA10 0x1017b4c0
211inline void LODListBase::Dump(void (*pTracer)(const char*, ...)) const
212{
213 int i;
214
215 pTracer("LODListBase<0x%x>: Capacity=%d, Size=%d\n", (void*) this, m_capacity, m_size);
216
217 for (i = 0; i < (int) m_size; i++) {
218 pTracer(" [%d]: LOD<0x%x>\n", i, m_ppLODObject[i]);
219 }
220
221 for (i = (int) m_size; i < (int) m_capacity; i++) {
222 assert(m_ppLODObject[i] == 0);
223 }
224}
225#endif
226
228//
229// LODList implementation
230
231template <class T>
232inline LODList<T>::LODList(size_t capacity) : LODListBase(capacity)
233{
234}
235
236template <class T>
237inline const T* LODList<T>::operator[](int i) const
238{
239 return static_cast<const T*>(LODListBase::operator[](i));
240}
241
242template <class T>
243inline const T* LODList<T>::PushBack(const T* pLOD)
244{
245 return static_cast<const T*>(LODListBase::PushBack(pLOD));
246}
247
248template <class T>
249inline const T* LODList<T>::PopBack()
250{
251 return static_cast<const T*>(LODListBase::PopBack());
252}
253
254// VTABLE: LEGO1 0x100dbdc0
255// VTABLE: BETA10 0x101c34f8
256// class LODList<ViewLOD>
257
258// SYNTHETIC: LEGO1 0x100a7740
259// SYNTHETIC: BETA10 0x1017b350
260// LODList<ViewLOD>::`scalar deleting destructor'
261
262// TEMPLATE: BETA10 0x10178b20
263// LODList<ViewLOD>::PopBack
264
265// TEMPLATE: BETA10 0x1017b2d0
266// LODList<ViewLOD>::LODList<ViewLOD>
267
268// TEMPLATE: LEGO1 0x100a8160
269// TEMPLATE: BETA10 0x1017b5d0
270// LODList<ViewLOD>::~LODList<ViewLOD>
271
272// TEMPLATE: BETA10 0x1007bae0
273// LODList<ViewLOD>::operator[]
274
275// re-enable: identifier was truncated to '255' characters in the debug information
276#pragma warning(default : 4786)
277
278#endif // LODLIST_H
[AI] Abstract base class for an ordered list of LODObject pointers, where each entry represents an in...
Definition: lodlist.h:31
virtual ~LODListBase()
[AI] Destructor.
Definition: lodlist.h:156
const LODObject * operator[](int) const
[AI] Returns a pointer to the LODObject at the given index.
Definition: lodlist.h:177
const LODObject * PopBack()
[AI] Removes and returns the last LODObject pointer from the list.
Definition: lodlist.h:194
const LODObject * PushBack(const LODObject *)
[AI] Adds a new LODObject pointer at the end of the list.
Definition: lodlist.h:185
size_t Size() const
[AI] Returns the current number of LODObject pointers contained.
Definition: lodlist.h:165
LODListBase(size_t capacity)
[AI] Constructs a new LODListBase with specified storage capacity.
Definition: lodlist.h:142
size_t Capacity() const
[AI] Returns the maximum number of LODObject pointers the list can hold.
Definition: lodlist.h:171
[AI] Type-safe extension of LODListBase, templated for any LODObject-derived type.
Definition: lodlist.h:110
const T * PushBack(const T *)
[AI] Typed append.
Definition: lodlist.h:243
const T * PopBack()
[AI] Typed remove.
Definition: lodlist.h:249
LODList(size_t capacity)
[AI] Constructs a type-safe LODList with given capacity.
Definition: lodlist.h:232
const T * operator[](int) const
[AI] Typed access to the LODObject at position i.
Definition: lodlist.h:237
[AI] Abstract base class for a Level-of-Detail (LOD) variant of a geometric object.
Definition: roi.h:97