home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 November
/
VPR9611B.ISO
/
vabasic
/
ntclnt.exe
/
DISK8
/
data.8
/
datab
/
INCLUDE
/
REFPNTR.HH
< prev
next >
Wrap
Text File
|
1996-07-29
|
3KB
|
201 lines
/*****************************************************************************
*** $Source: /rcs/crcs/general/refpntr.hh,v $
*** Checked int by: $Author: dan $
*** $Date: 1996/07/14 05:05:25 $
*** $Revision: 1.8 $
*****************************************************************************
*** ***
*** 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 con- ***
*** stitute 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. ***
*** ***
*****************************************************************************/
#ifndef REFPNTR_HH
#define REFPNTR_HH
#include <dllclass.hh>
#include <refcnt.hh>
class VeBaseReference : public VeDllBasedClass
{
public:
VeBaseReference()
{
itsObject = 0;
}
VeBaseReference(VeRefPrimary *obj)
{
itsObject = obj;
if(itsObject)
itsObject->Acquire();
}
VeBaseReference(const VeBaseReference &ref)
{
itsObject = ref.itsObject;
if(itsObject)
itsObject->Acquire();
}
~VeBaseReference()
{
if(itsObject)
itsObject->Release();
}
VeBaseReference& operator= (VeRefPrimary *obj)
{
if(obj)
obj->Acquire();
if(itsObject)
itsObject->Release();
itsObject = obj;
return *this;
}
VeBaseReference& operator= (const VeBaseReference ©)
{
if(copy.itsObject)
copy.itsObject->Acquire();
if(itsObject)
itsObject->Release();
itsObject = copy.itsObject;
return *this;
}
bool_t operator== (VeRefPrimary *obj)
{
return itsObject == obj;
}
bool_t operator!= (VeRefPrimary *obj)
{
return itsObject != obj;
}
operator VeRefPrimary *() const
{
return itsObject;
}
VeRefPrimary* operator->()
{
return itsObject;
}
bool_t IsValid() const
{
if(itsObject)
return TRUE;
else
return FALSE;
}
protected:
VeRefPrimary *itsObject;
};
class VeBaseObjReference : public VeDllBasedClass
{
public:
VeBaseObjReference()
{
itsObject = 0;
}
VeBaseObjReference(VeRefObject *obj)
{
itsObject = obj;
if(itsObject)
itsObject->Acquire();
}
VeBaseObjReference(const VeBaseObjReference &ref)
{
itsObject = ref.itsObject;
if(itsObject)
itsObject->Acquire();
}
~VeBaseObjReference()
{
if(itsObject)
itsObject->Release();
}
VeBaseObjReference& operator= (VeRefObject *obj)
{
if(obj)
obj->Acquire();
if(itsObject)
itsObject->Release();
itsObject = obj;
return *this;
}
VeBaseObjReference& operator= (const VeBaseObjReference ©)
{
if(copy.itsObject)
copy.itsObject->Acquire();
if(itsObject)
itsObject->Release();
itsObject = copy.itsObject;
return *this;
}
bool_t operator== (VeRefObject *obj)
{
return itsObject == obj;
}
bool_t operator!= (VeRefObject *obj)
{
return itsObject != obj;
}
operator VeRefObject *() const
{
return itsObject;
}
VeRefObject* operator->()
{
return itsObject;
}
bool_t IsValid() const
{
if(itsObject)
return TRUE;
else
return FALSE;
}
protected:
VeRefObject *itsObject;
};
#endif // REFPNTR_HH