source: GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCEntityClusterData.h @ 721

Revision 721, 1.2 KB checked in by igarcia, 18 years ago (diff)
Line 
1#ifndef _BBCENTITYCLUSTERDATA_H
2#define _BBCENTITYCLUSTERDATA_H
3
4#include <BBCEntity.h>
5
6namespace BBC {
7
8// Fordward declaration...
9class EntityClusterData;
10
11namespace boost
12{
13    void intrusive_ptr_add_ref(EntityClusterData * p);
14    void intrusive_ptr_release(EntityClusterData * p);
15};
16
17class _BBCExport EntityClusterData
18{
19private:
20    long references;
21    friend void boost::intrusive_ptr_add_ref(EntityClusterData * p);
22    friend void boost::intrusive_ptr_release(EntityClusterData * p);
23
24  public:
25    EntityClusterData();
26
27    virtual ~EntityClusterData();
28
29        void setEntity(EntityPtr value);
30
31        EntityPtr getEntity();
32
33  protected:
34        EntityPtr mEntity;
35
36};
37
38// class specific addref/release implementation
39// the two function overloads must be in the boost namespace on most compilers:
40namespace 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
58typedef ::boost::intrusive_ptr<EntityClusterData> EntityClusterDataPtr;
59
60}
61#endif
Note: See TracBrowser for help on using the repository browser.