Changeset 721 for GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCEntityDistribution.h
- Timestamp:
- 03/31/06 17:29:32 (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Illum/IBRBillboardCloudTrees/OGRE/include/BBC/BBCEntityDistribution.h
r700 r721 6 6 namespace BBC { 7 7 8 class _BBCExport EntityDistribution { 8 // Forward declarations 9 class EntityDistribution; 10 11 12 namespace boost 13 { 14 void intrusive_ptr_add_ref(EntityDistribution * p); 15 void intrusive_ptr_release(EntityDistribution * p); 16 }; 17 18 class _BBCExport EntityDistribution 19 { 20 private: 21 long references; 22 friend void boost::intrusive_ptr_add_ref(EntityDistribution * p); 23 friend void boost::intrusive_ptr_release(EntityDistribution * p); 24 9 25 protected: 10 std::vector<Entity *> mEntityList;26 std::vector<EntityPtr> mEntityList; 11 27 12 28 public: 13 Entity* getEntity(unsigned int value);29 EntityDistribution(); 14 30 15 void addEntity(Entity *value); 31 virtual ~EntityDistribution(); 32 33 EntityPtr getEntity(unsigned int value); 34 35 void addEntity(EntityPtr value); 16 36 17 37 void removeEntity(unsigned int value); … … 20 40 }; 21 41 42 43 // class specific addref/release implementation 44 // the two function overloads must be in the boost namespace on most compilers: 45 namespace 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 63 typedef ::boost::intrusive_ptr<EntityDistribution> EntityDistributionPtr; 64 22 65 } 23 66 #endif
Note: See TracChangeset
for help on using the changeset viewer.