home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1996 November
/
VPR9611B.ISO
/
vabasic
/
ntclnt.exe
/
DISK8
/
data.8
/
datab
/
INCLUDE
/
EXTEND.HH
< prev
next >
Wrap
Text File
|
1996-07-29
|
5KB
|
184 lines
//----------------------------------------------------------------
// $Source: /rcs/crcs/general/extend.hh,v $
// Checked in by: $Author: philip $
// $Date: 1996/07/03 18:27:03 $ $Revision: 1.14 $
//----------------------------------------------------------------
// Copyright(c) 1992, Visual Edge Software Ltd.
//
// ALL RIGHTS RESERVED. This notice is intended as a precaution
// against inadvertent publication, and shall not be deemed to
// consitute 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 file contains the definition of the VeLibrary base
// class. To use libraries include libmgr.hh instead
// of using VeCreateLibrary directly
//----------------------------------------------------------------------
#ifndef EXTEND_HH
#define EXTEND_HH
#include <visedge.hh>
#include <libload.hh>
#include <vstring.hh>
#include <pathlist.hh>
#include <libmgr.hh>
#include <vthread.hh> //For VeRefCount
VCLASS VeExtension;
typedef unsigned short VTExtensionID;
typedef void (*VTEnumExtension)(void *context, VeExtension *);
#define kVCurrentMajorVersion 1
#define kVCurrentMinorVersion 0
#define kVOlderVersionExtension ((VTExtensionID)0)
#define kVOtherVersionExtension ((VTExtensionID)1)
#define kVLoadAdapterExtension ((VTExtensionID)2)
#define kVRuntimeExtension ((VTExtensionID)3)
#define kVDesignExtension ((VTExtensionID)4)
#define kVProjectExtension ((VTExtensionID)5)
#define kVSupervisorExtension ((VTExtensionID)6)
#define kVErrorHandlerExtension ((VTExtensionID)7)
#define kVRuntimeNameExtension ((VTExtensionID)8)
#define kVSaveExecutableExtension ((VTExtensionID)9)
#define kVLoadExecutableExtension ((VTExtensionID)10)
VCLASS VeExtension : public VeDllBasedClass
{
public:
VOPERDECL VeExtension();
VeString Name() { return itsName; }
VVIRTUALDECL(unsigned short) MajorVersion() = 0;
VVIRTUALDECL(unsigned short) MinorVersion() = 0;
VVIRTUALDECL(unsigned short) ExtensionMajorVersion() = 0;
VVIRTUALDECL(unsigned short) ExtensionMinorVersion() = 0;
VVIRTUALDECL(void *) GetExtension(VTExtensionID) = 0;
protected:
virtual VOPERDECL ~VeExtension();
private:
void ReleaseLibrary();
VeString itsName;
VeRefCount itsRefCount;
VeLibrary *itsLibrary;
friend class VeExtensionManager;
};
#ifdef NOTEMPLATES
# ifndef VTExtensionListDefined
# define VTExtensionListDefined
# define CLASSNAME VTExtensionList
# define ENTRYTYPE VeExtension*
# include <mst/varray.mst>
# endif
#else
#include <vdic.hh>
typedef VeArray<VeExtension*> VTExtensionList;
#endif // NOTEMPLATES
VCLASS VeExtensionManager;
class VeExtensionManager : public VeDllBasedClass
{
public:
VOPERDECL VeExtensionManager();
VVIRTUALDECL(unsigned long) Acquire();
VVIRTUALDECL(unsigned long) Release();
VVIRTUALDECL(VeExtension *) LoadExtension(const char *name);
VVIRTUALDECL(void) UnloadExtension(VeExtension *extension);
VVIRTUALDECL(void *) FindExtension(VTExtensionID id);
VVIRTUALDECL(bool_t) ForEachExtension(VTExtensionID id,
VTEnumExtension enumerator,
void *context);
VINLINEDECL(VePathList) Path();
VINLINEDECL(void) SetPath(VePathList newPath);
VINLINEDECL(void) AddPath(const char *path);
VINLINEDECL(VeLibraryMgr *) LibraryManager();
VINLINEDECL(VTExtensionList) Extensions();
protected:
virtual VOPERDECL ~VeExtensionManager();
VVIRTUALDECL(void) InstallExtension(const char *name,
VeExtension *extension);
private:
VeRefCount itsRefCount;
VTExtensionList itsExtensions;
VeLibraryMgr *itsLibraryMgr;
};
VINLINEDEF(VePathList) VeExtensionManager::Path()
{
return itsLibraryMgr->Path();
}
VINLINEDEF(void) VeExtensionManager::SetPath(VePathList newPath)
{
itsLibraryMgr->SetPath(newPath);
}
VINLINEDEF(void) VeExtensionManager::AddPath(const char *path)
{
itsLibraryMgr->AddPath(path);
}
VINLINEDEF(VeLibraryMgr *) VeExtensionManager::LibraryManager()
{
return itsLibraryMgr;
}
VINLINEDEF(VTExtensionList) VeExtensionManager::Extensions()
{
return itsExtensions;
}
extern "C"
{
VFUNCDECL(bool_t) VeValidVersion(VeExtension *);
typedef VeExtension * (* VTLibraryExtension)( unsigned short major,
unsigned short minor);
//------------------------------------------------------------------
// VeLibraryExtension should be defined inside the library
// The extension is loaded through this call
//------------------------------------------------------------------
VFUNCDECL(VeExtension *) VeLibraryExtension( unsigned short major,
unsigned short minor);
}
#endif // EXTEND_HH