Line | |
---|
1 | #ifndef _BILLBOARDGROUP_H |
---|
2 | #define _BILLBOARDGROUP_H |
---|
3 | |
---|
4 | #include <BBCPrerequisites.h> |
---|
5 | |
---|
6 | namespace BBC { |
---|
7 | |
---|
8 | // Forward declarations
|
---|
9 | class BillboardGroup;
|
---|
10 |
|
---|
11 |
|
---|
12 | namespace boost
|
---|
13 | {
|
---|
14 | void intrusive_ptr_add_ref(BillboardGroup * p);
|
---|
15 | void intrusive_ptr_release(BillboardGroup * p);
|
---|
16 | }; |
---|
17 | |
---|
18 | class BillboardGroup |
---|
19 | { |
---|
20 | private:
|
---|
21 | long references;
|
---|
22 | friend void boost::intrusive_ptr_add_ref(BillboardGroup * p);
|
---|
23 | friend void boost::intrusive_ptr_release(BillboardGroup * p); |
---|
24 | |
---|
25 | protected: |
---|
26 | std::vector<unsigned int> mBillboardHandleList; |
---|
27 | |
---|
28 | public: |
---|
29 | |
---|
30 | BillboardGroup(); |
---|
31 | |
---|
32 | virtual ~BillboardGroup(); |
---|
33 | |
---|
34 | unsigned int getBillboardHandle(unsigned int iBillboard); |
---|
35 | |
---|
36 | void addBillboardHandle(unsigned int iBillboardHandle); |
---|
37 | |
---|
38 | unsigned int getNumBillboards(); |
---|
39 | |
---|
40 | }; |
---|
41 | |
---|
42 | // class specific addref/release implementation
|
---|
43 | // the two function overloads must be in the boost namespace on most compilers:
|
---|
44 | namespace boost
|
---|
45 | {
|
---|
46 | inline void intrusive_ptr_add_ref(BillboardGroup * p)
|
---|
47 | {
|
---|
48 | // increment reference count of object *p
|
---|
49 | ++(p->references);
|
---|
50 | }
|
---|
51 |
|
---|
52 |
|
---|
53 |
|
---|
54 | inline void intrusive_ptr_release(BillboardGroup * p)
|
---|
55 | {
|
---|
56 | // decrement reference count, and delete object when reference count reaches 0
|
---|
57 | if (--(p->references) == 0)
|
---|
58 | delete p;
|
---|
59 | }
|
---|
60 | } // namespace boost
|
---|
61 |
|
---|
62 | typedef ::boost::intrusive_ptr<BillboardGroup> BillboardGroupPtr;
|
---|
63 | |
---|
64 | } |
---|
65 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.