home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 November
/
VPR9611B.ISO
/
vabasic
/
ntclnt.exe
/
DISK8
/
data.8
/
datab
/
INCLUDE
/
VOBJREF.HH
< prev
next >
Wrap
Text File
|
1996-07-29
|
2KB
|
77 lines
//------------------------------------------------------------------------
// $Source: /rcs/crcs/general/vobjref.hh,v $
// Checked in by: $Author: alaind $
// $Date: 1996/04/17 17:52:34 $ $Revision: 1.3 $
//------------------------------------------------------------------------
// Copyright(c) 1993, 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: A VeObjectRef is used to pass an object with its class
// name. Using the class name, class information can
// be obtained from the class registry.
// Instances of this class can be passed by value very
// efficiently.
// VeObjectRef maintains a reference-counted internal
// representation that is shared among objects.
//------------------------------------------------------------------------
#ifndef VOBJREF_HH
#define VOBJREF_HH
#include <visedge.hh>
#include <dllclass.hh>
#include <vthread.hh> //For VeRefCount
VCLASS VobType;
VCLASS VeObjectRef : public VeDllBasedClass
{
public:
VOPERDECL VeObjectRef(void *object, VobType *type = 0);
VOPERDECL VeObjectRef(const VeObjectRef &);
VOPERDECL VeObjectRef();
VOPERDECL ~VeObjectRef();
VMETHODDECL(void *) Object() const;
VMETHODDECL(VobType *) Type() const;
VMETHODDECL(void) Set(void *object, VobType *type = 0);
VMETHODDECL(VeObjectRef &) operator= (const VeObjectRef&);
protected:
private:
//-----------------------------------------------------
// The actual data is shared as often as possible.
//-----------------------------------------------------
struct ObjectData {
ObjectData() : type(0), object(0) {}
VeRefCount refcount;
VobType *type;
void *object;
} * itsRep;
};
#ifdef NOTEMPLATES
# ifndef VTObjectRefListDefined
# define VTObjectRefListDefined
# define CLASSNAME VTObjectRefList
# define ENTRYTYPE VeObjectRef*
# include <mst/varray.mst>
# endif
#else
# include <varray.hh>
typedef VeArray<VeObjectRef*> VTObjectRefList;
#endif
#endif //VOBJREF_HH