70 lines
2.3 KiB
C++
70 lines
2.3 KiB
C++
/* (c) Ubi Studios 1996*/
|
|
/* See Vincent Greco for any comment or question*/
|
|
|
|
#ifndef __LSTEDMOT_HPP__
|
|
#define __LSTEDMOT_HPP__
|
|
|
|
#include "LstDef2.h"
|
|
#include "CpaList.Hpp"
|
|
/*#include "ErrHie.h"*/
|
|
|
|
/*YOU MUST DEFINE Mod BEFORE INCLUDING THIS FILE*/
|
|
/* Example "#define Mod Hie" for hierarchy*/
|
|
|
|
/****************************************/
|
|
#ifndef CPA_EXPORT
|
|
#if defined(CPA_WANTS_IMPORT)
|
|
#define CPA_EXPORT __declspec(dllimport)
|
|
#elif defined(CPA_WANTS_EXPORT)
|
|
#define CPA_EXPORT __declspec(dllexport)
|
|
#else
|
|
#define CPA_EXPORT
|
|
#endif
|
|
#endif
|
|
/****************************************/
|
|
|
|
|
|
template<class tdxHandleToStruct>
|
|
class CPA_EdMot
|
|
{
|
|
private:
|
|
tdxHandleToStruct pStruct;
|
|
/* void NewStruct(void);*/
|
|
static tdxHandleToStruct (*m_p_fn_hCreate)(void);
|
|
static void (*m_p_fn_hCopy)(tdxHandleToStruct,tdxHandleToStruct);
|
|
static void (*m_p_fn_vDestroy)(tdxHandleToStruct);
|
|
protected:
|
|
virtual void SetStruct(tdxHandleToStruct pNewStruct){pStruct=pNewStruct;}
|
|
public:
|
|
static void Init(tdxHandleToStruct (*_p_fn_hCreate)(void),void (*_p_fn_hCopy)(tdxHandleToStruct,tdxHandleToStruct),void (*_p_fn_vDestroy)(tdxHandleToStruct))
|
|
{
|
|
m_p_fn_hCreate=_p_fn_hCreate;
|
|
m_p_fn_hCopy=_p_fn_hCopy;
|
|
m_p_fn_vDestroy=_p_fn_vDestroy;
|
|
}
|
|
/* IMPORTANT :*/
|
|
/* even if SetStruct() is virtual*/
|
|
/* the the SetStruct() called by the constructors of CPA_EdMot*/
|
|
/* is the one of CPA_EdMot itself,*/
|
|
/* so if you overload SetStruct(),*/
|
|
/* overload also the constructors*/
|
|
CPA_EdMot(void) {SetStruct((*m_p_fn_hCreate)());}
|
|
CPA_EdMot(long _lValue) {SetStruct((tdxHandleToStruct)_lValue);}
|
|
CPA_EdMot(tdxHandleToStruct _hValue) {SetStruct(_hValue);}
|
|
CPA_EdMot(const CPA_EdMot& C) {SetStruct((*m_p_fn_hCreate)()); (*m_p_fn_hCopy)(pStruct, C.pStruct);}
|
|
CPA_EdMot& operator=(const CPA_EdMot& C) {(*m_p_fn_hCopy)(pStruct, C.pStruct); return *this;}
|
|
virtual ~CPA_EdMot(void) {(*m_p_fn_vDestroy)(pStruct);}
|
|
|
|
public:
|
|
tdxHandleToStruct GetStruct(void) const {return pStruct;}
|
|
};
|
|
|
|
#define DeclareTemplateStatic(tdxHandleToStruct) \
|
|
tdxHandleToStruct (*CPA_EdMot<tdxHandleToStruct>::m_p_fn_hCreate)(void); \
|
|
void (*CPA_EdMot<tdxHandleToStruct>::m_p_fn_hCopy)(tdxHandleToStruct,tdxHandleToStruct); \
|
|
void (*CPA_EdMot<tdxHandleToStruct>::m_p_fn_vDestroy)(tdxHandleToStruct);
|
|
|
|
|
|
|
|
#endif /*__LSTEDMOT_HPP__*/
|