Rev | Line | |
---|
[700] | 1 | #ifndef _BILLBOARDGROUP_H |
---|
| 2 | #define _BILLBOARDGROUP_H |
---|
| 3 | |
---|
[709] | 4 | #include <BBCPrerequisites.h> |
---|
[700] | 5 | |
---|
| 6 | namespace BBC { |
---|
| 7 | |
---|
[721] | 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 | |
---|
[700] | 25 | protected: |
---|
[709] | 26 | std::vector<unsigned int> mBillboardHandleList; |
---|
[700] | 27 | |
---|
| 28 | public: |
---|
[721] | 29 | |
---|
| 30 | BillboardGroup(); |
---|
| 31 | |
---|
| 32 | virtual ~BillboardGroup(); |
---|
| 33 | |
---|
[709] | 34 | unsigned int getBillboardHandle(unsigned int iBillboard); |
---|
[700] | 35 | |
---|
[709] | 36 | void addBillboardHandle(unsigned int iBillboardHandle); |
---|
[700] | 37 | |
---|
[709] | 38 | unsigned int getNumBillboards(); |
---|
| 39 | |
---|
[700] | 40 | }; |
---|
| 41 | |
---|
[721] | 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 | |
---|
[700] | 64 | } |
---|
| 65 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.