equal
deleted
inserted
replaced
94 m_pT = pT; // update m_pT to new value |
94 m_pT = pT; // update m_pT to new value |
95 if (pTold) pTold->Release(); // release old ptr if any |
95 if (pTold) pTold->Release(); // release old ptr if any |
96 } |
96 } |
97 } |
97 } |
98 |
98 |
|
99 /** Simple counted object. Use it as base of your struct/class if you want to use |
|
100 * basic reference counting. Your struct/class will destroy and free itself when |
|
101 * last reference to it is released (using Relese() method). The initial reference |
|
102 * count (when it is created) is zero (don't forget AddRef() at least one time if |
|
103 * not using CCountedPtr<T>. |
|
104 * |
|
105 * @see misc/countedobj.cpp for implementation. |
|
106 */ |
|
107 struct SimpleCountedObject { |
|
108 int32 m_ref_cnt; |
|
109 |
|
110 SimpleCountedObject() |
|
111 : m_ref_cnt(0) |
|
112 {} |
|
113 |
|
114 virtual ~SimpleCountedObject() |
|
115 {}; |
|
116 |
|
117 virtual int32 AddRef(); |
|
118 virtual int32 Release(); |
|
119 virtual void FinalRelease() {}; |
|
120 }; |
|
121 |
|
122 |
|
123 |
|
124 |
99 #endif /* 0 */ |
125 #endif /* 0 */ |
100 #endif /* COUNTEDPTR_HPP */ |
126 #endif /* COUNTEDPTR_HPP */ |