commit 2025-09-20 00:39 delete ZCHeapAllocList in ZCppMain/ZMainHead.H
This commit is contained in:
@ -4203,201 +4203,6 @@ namespace ZNsMain
|
||||
|
||||
|
||||
|
||||
// 자유 기억 공간을 총괄하는 단방향 연결 리스트
|
||||
|
||||
class ZCHeapAllocList
|
||||
{
|
||||
public:
|
||||
|
||||
class ZCLink
|
||||
{
|
||||
public:
|
||||
friend class ZCHeapAllocList;
|
||||
public:
|
||||
|
||||
ZCLink(ZCFreeAllocBase& ArCFreeAllocBase) :
|
||||
mr_AllocBase(ArCFreeAllocBase), mp_NextLink(0)
|
||||
{
|
||||
}/*
|
||||
ZCLink(ZCFreeAllocBase& ArCFreeAllocBase)*/
|
||||
|
||||
ZCLink* GetNextPtr()
|
||||
{
|
||||
return mp_NextLink;
|
||||
}/*
|
||||
ZCLink* GetNextPtr()*/
|
||||
|
||||
ZCLink* GetNextPtr(long AL_Distance)
|
||||
{
|
||||
ZCLink* VP_NowLink=this;
|
||||
|
||||
while(--AL_Distance>=0)
|
||||
VP_NowLink=VP_NowLink->mp_NextLink;
|
||||
|
||||
return VP_NowLink;
|
||||
}/*
|
||||
ZCLink* GetNextPtr(long AL_Distance)*/
|
||||
|
||||
ZCFreeAllocBase& GetData()
|
||||
{
|
||||
return mr_AllocBase;
|
||||
}/*
|
||||
ZCFreeAllocBase& GetData()*/
|
||||
|
||||
/*public :*/
|
||||
|
||||
private:
|
||||
ZCFreeAllocBase& mr_AllocBase;
|
||||
ZCLink* mp_NextLink ;
|
||||
private:
|
||||
};/*
|
||||
class ZCLink*/
|
||||
|
||||
|
||||
/*public :*/
|
||||
private:
|
||||
ZTypIntL ml_Size ;
|
||||
ZCLink* mp_HeadLink ;
|
||||
ZCLink* mp_TailLink ;
|
||||
private:
|
||||
|
||||
void AddLink(ZCLink* AP_NewLink)
|
||||
{
|
||||
if(ml_Size++ == 0)
|
||||
{
|
||||
mp_HeadLink= mp_TailLink=AP_NewLink ;
|
||||
mp_TailLink->mp_NextLink=mp_HeadLink;
|
||||
}
|
||||
else
|
||||
{
|
||||
mp_TailLink->mp_NextLink=AP_NewLink ;
|
||||
AP_NewLink ->mp_NextLink=mp_HeadLink;
|
||||
mp_TailLink=mp_TailLink->mp_NextLink;
|
||||
}/*
|
||||
else*/
|
||||
}/*
|
||||
void AddLink(ZCLink* AP_NewLink)*/
|
||||
|
||||
/*private:*/
|
||||
public :
|
||||
|
||||
ZCHeapAllocList()
|
||||
{
|
||||
ml_Size =0;
|
||||
mp_HeadLink =0;
|
||||
mp_TailLink =0;
|
||||
}/*
|
||||
ZCHeapAllocList()*/
|
||||
|
||||
template<typename TypeFreeAlloc> TypeFreeAlloc& AddFreeAlloc()
|
||||
{
|
||||
// TypeFreeAlloc 은 ZCFreeAllocBase 의 파생클래스여야 한다.
|
||||
|
||||
TypeFreeAlloc* VP_TypeFreeAlloc=new TypeFreeAlloc;
|
||||
|
||||
ZCLink* VP_NewLink=new ZCLink(*VP_TypeFreeAlloc);
|
||||
|
||||
AddLink(VP_NewLink); return *VP_TypeFreeAlloc;
|
||||
}/*
|
||||
template<typename TypeFreeAlloc> TypeFreeAlloc& AddFreeAlloc() */
|
||||
|
||||
void AddFreeAllocBase(ZCFreeAllocBase& ArCFreeAllocBase)
|
||||
{
|
||||
AddLink( new ZCLink(ArCFreeAllocBase) );
|
||||
}/*
|
||||
void AddFreeAllocBase(ZCFreeAllocBase& ArCFreeAllocBase)*/
|
||||
|
||||
|
||||
ZCFreeAllocBase& GetData(long AL_Index)
|
||||
{
|
||||
return mp_HeadLink->GetNextPtr(AL_Index-1)->mr_AllocBase;
|
||||
}/*
|
||||
ZCFreeAllocBase& GetData(long AL_Index)*/
|
||||
|
||||
ZCLink* GetHeadLink()
|
||||
{
|
||||
return mp_HeadLink;
|
||||
}/*
|
||||
ZCLink* GetHeadLink()*/
|
||||
|
||||
template<typename DeriveType> DeriveType& GetDataType(long AL_Index)
|
||||
{
|
||||
return static_cast<DeriveType&>( mp_HeadLink->GetNextPtr(AL_Index-1)->mr_AllocBase );
|
||||
}/*
|
||||
template<typename DeriveType> DeriveType& GetDataType(long AL_Index) */
|
||||
|
||||
|
||||
void FreeAll()
|
||||
{
|
||||
ZCLink* VP_Link=mp_HeadLink;
|
||||
|
||||
for(long i=1; i<=ml_Size; ++i)
|
||||
{
|
||||
VP_Link->mr_AllocBase.DeleteAllInHeap();
|
||||
VP_Link=VP_Link->mp_NextLink;
|
||||
}/*
|
||||
for(long i=1; i<=ml_Size; ++i)*/
|
||||
}/*
|
||||
void FreeAll()*/
|
||||
|
||||
|
||||
void DeleteAll()
|
||||
{
|
||||
ZCLink* VP_CutLink=0;
|
||||
|
||||
for(long i=1; i<=ml_Size; ++i)
|
||||
{
|
||||
VP_CutLink =mp_HeadLink;
|
||||
mp_HeadLink=mp_HeadLink->mp_NextLink;
|
||||
|
||||
delete VP_CutLink;
|
||||
}/*
|
||||
for(long i=1; i<=ml_Size; ++i)*/
|
||||
|
||||
ml_Size=0;
|
||||
}/*
|
||||
void DeleteAll()*/
|
||||
|
||||
|
||||
void ClearAll()
|
||||
{
|
||||
ZCLink* VP_CutLink=0;
|
||||
|
||||
for(long i=1; i<=ml_Size; ++i)
|
||||
{
|
||||
VP_CutLink =mp_HeadLink ;
|
||||
mp_HeadLink=mp_HeadLink->mp_NextLink;
|
||||
|
||||
VP_CutLink->
|
||||
mr_AllocBase.DeleteAllInHeap() ;
|
||||
|
||||
delete VP_CutLink;
|
||||
}/*
|
||||
for(long i=1; i<=ml_Size; ++i)*/
|
||||
|
||||
ml_Size=0;
|
||||
}/*
|
||||
void ClearAll()*/
|
||||
|
||||
ZTypIntL GetSize() const
|
||||
{
|
||||
return ml_Size;
|
||||
}/*
|
||||
ZTypIntL GetSize() const*/
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCHeapAllocList*/
|
||||
|
||||
|
||||
static ZCHeapAllocList& GetCHeapAllocList()
|
||||
{
|
||||
static ZCHeapAllocList SO_CHeapAllocList; return SO_CHeapAllocList;
|
||||
}/*
|
||||
static ZCHeapAllocList& GetCHeapAllocList()*/
|
||||
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////
|
||||
|
||||
■ 템플릿 인자를 정의할 때 참조로 하지 않은 경우에 object 의 크기가
|
||||
|
Reference in New Issue
Block a user