commit 2025-09-20 10:16 edit member fun of ZCAllocClass ZCppMain/ZMainHead.H
This commit is contained in:
@ -3252,25 +3252,35 @@ namespace ZNsMain
|
||||
|
||||
/////////////////////////////////////////////////////////////////*/
|
||||
|
||||
template<typename TType> class ZtCAllocClass :
|
||||
public ZCAllocator
|
||||
//////////////////////////////////////////////
|
||||
template<typename TType> class ZtCAllocClass : public ZCAllocator
|
||||
{
|
||||
public:
|
||||
#if(_CODE_OLD_)
|
||||
TType* NewMem (size_t AL_AllocSize){return (TType*)::malloc(AL_AllocSize) ;}
|
||||
TType* NewArrMem(size_t AL_AllocSize){return (TType*)::malloc(AL_AllocSize*sizeof(TType));}
|
||||
public:
|
||||
void DeleteMem(void* AP_Void){if(AP_Void!=0) ::free(AP_Void);}
|
||||
#else
|
||||
TType* InitMem (size_t AL_AllocSize){return (TType*)::malloc(AL_AllocSize) ;}
|
||||
TType* InitArrMem(size_t AL_AllocSize){return (TType*)::malloc(AL_AllocSize*sizeof(TType));}
|
||||
public:
|
||||
void FiniMem (void* AP_Void){if(AP_Void!=0) ::free(AP_Void);}
|
||||
#endif
|
||||
public:
|
||||
};/*
|
||||
template<typename TType> class ZtCAllocClass*/
|
||||
template<typename TType> class ZtCAllocClass : public ZCAllocator*/
|
||||
|
||||
|
||||
class ZCAllocClass : public ZCAllocator
|
||||
{
|
||||
public:
|
||||
#if(_CODE_OLD_)
|
||||
void* NewMem (size_t AL_AllocSize){return ::malloc(AL_AllocSize) ;}
|
||||
void DeleteMem(void* AP_Void ){if(AP_Void!=0) ::free(AP_Void);}
|
||||
#else
|
||||
void* InitMem (size_t AL_AllocSize){return ::malloc(AL_AllocSize) ;}
|
||||
void FiniMem (void* AP_Void ){if(AP_Void!=0) ::free(AP_Void);}
|
||||
#endif
|
||||
public:
|
||||
};/*
|
||||
class ZCAllocClass : public ZCAllocator*/
|
||||
@ -4296,7 +4306,7 @@ namespace ZNsMain
|
||||
ZtCObjNew()
|
||||
{
|
||||
mp_StTypeRefCnt = (StTypeRefCnt*)
|
||||
this->ZCAllocator::NewMem(sizeof(StTypeRefCnt));
|
||||
this->ZCAllocator::InitMem(sizeof(StTypeRefCnt));
|
||||
mp_StTypeRefCnt->MI_RefCount = 1 ;
|
||||
|
||||
new(&mp_StTypeRefCnt->MO_TypeData) TypeData;
|
||||
@ -4306,7 +4316,7 @@ namespace ZNsMain
|
||||
ZtCObjNew(const TypeData& AR_TypeData)
|
||||
{
|
||||
mp_StTypeRefCnt = (StTypeRefCnt*)
|
||||
this->ZCAllocator::NewMem(sizeof(StTypeRefCnt));
|
||||
this->ZCAllocator::InitMem(sizeof(StTypeRefCnt));
|
||||
mp_StTypeRefCnt->MI_RefCount = 1 ;
|
||||
|
||||
new(&mp_StTypeRefCnt->MO_TypeData) TypeData(AR_TypeData);
|
||||
@ -4317,7 +4327,7 @@ namespace ZNsMain
|
||||
ZtCObjNew(TTypeArg1& ArTTypeArg1, TTypeArg2& ArTTypeArg2)
|
||||
{
|
||||
mp_StTypeRefCnt = (StTypeRefCnt*)
|
||||
this->ZCAllocator::NewMem(sizeof(StTypeRefCnt));
|
||||
this->ZCAllocator::InitMem(sizeof(StTypeRefCnt));
|
||||
mp_StTypeRefCnt->MI_RefCount = 1 ;
|
||||
|
||||
new(&mp_StTypeRefCnt->MO_TypeData)
|
||||
@ -4336,7 +4346,7 @@ namespace ZNsMain
|
||||
~ZtCObjNew()
|
||||
{
|
||||
if(--mp_StTypeRefCnt->MI_RefCount <= 0)
|
||||
this->ZCAllocator::DeleteMem(mp_StTypeRefCnt);
|
||||
this->ZCAllocator::FiniMem(mp_StTypeRefCnt);
|
||||
}/*
|
||||
~ZtCObjNew()*/
|
||||
|
||||
|
Reference in New Issue
Block a user