applied coding style
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@14443 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -40,16 +40,22 @@
|
|||||||
possible to ensure that a shared resource is not deleted if something else
|
possible to ensure that a shared resource is not deleted if something else
|
||||||
needs it. How the dependency tracking is done largely depends on the child class.
|
needs it. How the dependency tracking is done largely depends on the child class.
|
||||||
*/
|
*/
|
||||||
class SharedObject
|
class SharedObject {
|
||||||
{
|
public:
|
||||||
public:
|
SharedObject()
|
||||||
SharedObject(void) { dependents=0; }
|
: fReferenceCount(0)
|
||||||
virtual ~SharedObject(void){}
|
{}
|
||||||
virtual void AddDependent(void) { dependents++; }
|
virtual ~SharedObject()
|
||||||
virtual void RemoveDependent(void) { dependents--; }
|
{}
|
||||||
virtual bool HasDependents(void) { return (dependents>0)?true:false; }
|
|
||||||
private:
|
virtual void AddDependent()
|
||||||
uint32 dependents;
|
{ fReferenceCount++; }
|
||||||
|
virtual void RemoveDependent()
|
||||||
|
{ fReferenceCount--; }
|
||||||
|
virtual bool HasDependents()
|
||||||
|
{ return (fReferenceCount > 0); }
|
||||||
|
private:
|
||||||
|
uint32 fReferenceCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Reference in New Issue
Block a user