home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 November
/
VPR9611B.ISO
/
vabasic
/
ntclnt.exe
/
DISK8
/
data.8
/
datab
/
INCLUDE
/
REFCNT.HH
< prev
next >
Wrap
Text File
|
1996-07-29
|
2KB
|
88 lines
//-----------------------------------------------------------------------------
// $Source: /rcs/crcs/general/refcnt.hh,v $
// Checked in by $Author: alaind $
// $Date: 1996/04/17 17:53:11 $ $Revision: 1.5 $
//-----------------------------------------------------------------------------
// Copyright (c) 1994, Visual Edge Software Ltd.
//
// ALL RIGHTS RESERVED. This notice is intended as a precaution against
// inadvertent publication, and shall not be deemed to constitute an
// acknowledgment that publication has occurred nor to imply any waiver of
// confidentiality. The year included in the notice is the year of the
// creation of the work.
//-----------------------------------------------------------------------------
// DESCRIPTION:
// This class provides reference counting support for VePrimary objects.
//-----------------------------------------------------------------------------
#ifndef REFCNT_HH
#define REFCNT_HH
#include <visedge.hh>
#include <object.hh>
typedef long VTRefCount;
class VeRefPrimary : public VePrimary
{
public:
VOPERDECL VeRefPrimary();
VTRefCount Acquire()
{
++itsRefCount;
return itsRefCount.Value();
}
VTRefCount Release()
{
if(!itsRefCount.IsReferenced() ||
(--itsRefCount == FALSE))
return RefTransition();
else
return itsRefCount.Value();
}
protected:
virtual VOPERDECL ~VeRefPrimary();
VVIRTUALDECL(VTRefCount) RefTransition();
VeRefCount itsRefCount;
};
class VeRefObject : public VeObject
{
public:
RTTI_H(VeClass, VeObject);
VOPERDECL VeRefObject();
VTRefCount Acquire()
{
++itsRefCount;
return itsRefCount.Value();
}
VTRefCount Release()
{
if(!itsRefCount.IsReferenced() ||
(--itsRefCount == FALSE))
return RefTransition();
else
return itsRefCount.Value();
}
protected:
virtual VOPERDECL ~VeRefObject();
VVIRTUALDECL(VTRefCount) RefTransition();
VeRefCount itsRefCount;
};
#endif // REFCNT_HH