Rev | Line | |
---|
[700] | 1 | #ifndef _BBCENTITYCLUSTERDATA_H |
---|
| 2 | #define _BBCENTITYCLUSTERDATA_H |
---|
| 3 | |
---|
| 4 | #include <BBCEntity.h> |
---|
| 5 | |
---|
| 6 | namespace BBC { |
---|
| 7 | |
---|
[721] | 8 | // Fordward declaration... |
---|
| 9 | class EntityClusterData; |
---|
| 10 | |
---|
| 11 | namespace boost
|
---|
| 12 | {
|
---|
| 13 | void intrusive_ptr_add_ref(EntityClusterData * p);
|
---|
| 14 | void intrusive_ptr_release(EntityClusterData * p);
|
---|
| 15 | }; |
---|
| 16 | |
---|
| 17 | class _BBCExport EntityClusterData |
---|
| 18 | { |
---|
| 19 | private:
|
---|
| 20 | long references;
|
---|
| 21 | friend void boost::intrusive_ptr_add_ref(EntityClusterData * p);
|
---|
| 22 | friend void boost::intrusive_ptr_release(EntityClusterData * p); |
---|
| 23 | |
---|
[700] | 24 | public: |
---|
| 25 | EntityClusterData(); |
---|
| 26 | |
---|
[721] | 27 | virtual ~EntityClusterData(); |
---|
[700] | 28 | |
---|
[721] | 29 | void setEntity(EntityPtr value); |
---|
[700] | 30 | |
---|
[721] | 31 | EntityPtr getEntity(); |
---|
[700] | 32 | |
---|
| 33 | protected: |
---|
[721] | 34 | EntityPtr mEntity; |
---|
[700] | 35 | |
---|
| 36 | }; |
---|
| 37 | |
---|
[721] | 38 | // class specific addref/release implementation
|
---|
| 39 | // the two function overloads must be in the boost namespace on most compilers:
|
---|
| 40 | namespace boost
|
---|
| 41 | {
|
---|
| 42 | inline void intrusive_ptr_add_ref(EntityClusterData * p)
|
---|
| 43 | {
|
---|
| 44 | // increment reference count of object *p
|
---|
| 45 | ++(p->references);
|
---|
| 46 | }
|
---|
| 47 |
|
---|
| 48 |
|
---|
| 49 |
|
---|
| 50 | inline void intrusive_ptr_release(EntityClusterData * p)
|
---|
| 51 | {
|
---|
| 52 | // decrement reference count, and delete object when reference count reaches 0
|
---|
| 53 | if (--(p->references) == 0)
|
---|
| 54 | delete p;
|
---|
| 55 | }
|
---|
| 56 | } // namespace boost
|
---|
| 57 |
|
---|
| 58 | typedef ::boost::intrusive_ptr<EntityClusterData> EntityClusterDataPtr; |
---|
| 59 | |
---|
[700] | 60 | } |
---|
| 61 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.