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

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