commit 2025-10-04 09:05 add IterElemLink() : ZCppMain/ZtCObjList.H
This commit is contained in:
@ -966,6 +966,23 @@ namespace ZNsMain
|
||||
const ZCLink* GetPrevPtr(TypeSize AL_Distance) const*/
|
||||
|
||||
|
||||
ZCLink& operator+(TypeSize AL_Distance)
|
||||
{
|
||||
if(AL_Distance>=0)
|
||||
return *GetNextPtr(AL_Distance);
|
||||
else return *GetPrevPtr(AL_Distance);
|
||||
}/*
|
||||
ZCLink& operator+(TypeSize AL_Distance)*/
|
||||
|
||||
const ZCLink& operator+(TypeSize AL_Distance) const
|
||||
{
|
||||
if(AL_Distance>=0)
|
||||
return *GetNextPtr(AL_Distance);
|
||||
else return *GetPrevPtr(AL_Distance);
|
||||
}/*
|
||||
const ZCLink& operator+(TypeSize AL_Distance) const*/
|
||||
|
||||
|
||||
public:
|
||||
};/*
|
||||
class ZCLink*/
|
||||
@ -1789,7 +1806,7 @@ namespace ZNsMain
|
||||
ZtCObjList& DeleteHead()*/
|
||||
|
||||
|
||||
void DeleteHead(TTypSize AL_DelSize)
|
||||
void DeleteHead(TypeSize AL_DelSize)
|
||||
{
|
||||
// AL_DelSize 개의 링크를 앞 부분에서 삭제
|
||||
|
||||
@ -1819,7 +1836,7 @@ namespace ZNsMain
|
||||
|
||||
ZCLink::MakeRing(mp_HeadLink, VP_TailLink);
|
||||
}/*
|
||||
void DeleteHead(TTypSize AL_DelSize)*/
|
||||
void DeleteHead(TypeSize AL_DelSize)*/
|
||||
|
||||
|
||||
ZtCObjList& DeleteTail()
|
||||
@ -1837,7 +1854,7 @@ namespace ZNsMain
|
||||
ZtCObjList& DeleteTail()*/
|
||||
|
||||
|
||||
void DeleteTail(TTypSize AL_DelSize)
|
||||
void DeleteTail(TypeSize AL_DelSize)
|
||||
{
|
||||
if(ml_LinkSize==0 || AL_DelSize<1){ return; }
|
||||
|
||||
@ -1864,7 +1881,7 @@ namespace ZNsMain
|
||||
|
||||
ZCLink::MakeRing(mp_HeadLink, VP_NewTail);
|
||||
}/*
|
||||
void DeleteTail(TTypSize AL_DelSize)*/
|
||||
void DeleteTail(TypeSize AL_DelSize)*/
|
||||
|
||||
|
||||
ZCLink* AddDefault(TypeSize AL_DefaultSize, TypeSize AL_AddPos)
|
||||
@ -2527,6 +2544,55 @@ namespace ZNsMain
|
||||
###############################################################################*/
|
||||
|
||||
|
||||
template<typename TFunctor> void IterElemLink ///////////////////////
|
||||
(
|
||||
ZCLink& AR_StdLink ,
|
||||
TypeSize AL_WorkDistance,
|
||||
TFunctor AO_Functor
|
||||
)
|
||||
/*#################################################################*/
|
||||
{
|
||||
/* AP_StdLink 부터 AL_WorkDistance 만큼 이동하면서
|
||||
* 각 ZCLink 에 대하여 AO_Functor() 함수를 수행한다.(총 수행 횟수는 (AL_WorkDistance)절대값+1)
|
||||
*/
|
||||
|
||||
ZCLink* VP_StdLink = &AR_StdLink;
|
||||
|
||||
if(AL_WorkDistance>=0)
|
||||
{
|
||||
for(TypeSize VL_Loop=0; VL_Loop<=AL_WorkDistance; ++VL_Loop)
|
||||
{
|
||||
ZtCTypeData<TFunctor>::
|
||||
GetObjRef(AO_Functor)(*VP_StdLink);
|
||||
|
||||
VP_StdLink = VP_StdLink->mp_NextLink ;
|
||||
}/*
|
||||
for(TypeSize VL_Loop=0; VL_Loop<=AL_WorkDistance; ++VL_Loop)*/
|
||||
}
|
||||
else // AL_WorkDistance<0
|
||||
{
|
||||
AL_WorkDistance = -AL_WorkDistance;
|
||||
|
||||
for(TypeSize VL_Loop=0; VL_Loop<=AL_WorkDistance; ++VL_Loop)
|
||||
{
|
||||
ZtCTypeData<TFunctor>::
|
||||
GetObjRef(AO_Functor)(*VP_StdLink);
|
||||
|
||||
VP_StdLink = VP_StdLink->mp_PrevLink ;
|
||||
}/*
|
||||
for(TypeSize VL_Loop=0; VL_Loop<=AL_WorkDistance; ++VL_Loop)*/
|
||||
}/*
|
||||
else // AL_WorkDistance<0*/
|
||||
}/*
|
||||
void IterElemLink ///////////////////////////////////////////////////
|
||||
(
|
||||
ZCLink& AR_StdLink ,
|
||||
TypeSize AL_WorkDistance,
|
||||
TFunctor AO_Functor
|
||||
)
|
||||
/*#################################################################*/
|
||||
|
||||
|
||||
|
||||
/*///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
@ -1930,13 +1930,13 @@ namespace ZNsMain
|
||||
|
||||
TTypSize Find(const ZCLink* AP_pSearchLink, TTypSize AL_FirstFindIndex=1) const
|
||||
{
|
||||
const bool CB_DoStop = ////////////
|
||||
const bool CB_DoStop = //////////////////////
|
||||
(
|
||||
mp_HeadLink ==0 ||
|
||||
AL_FirstFindIndex < 1 ||
|
||||
AL_FirstFindIndex > ml_LinkSize
|
||||
);
|
||||
if(CB_DoStop) {return 0;} /////////
|
||||
if(CB_DoStop) {return 0;} ///////////////////
|
||||
|
||||
|
||||
TTypSize VL_FindIndex = AL_FirstFindIndex ;
|
||||
@ -1949,7 +1949,7 @@ namespace ZNsMain
|
||||
{ return VL_FindIndex; }
|
||||
/*+++++++++++++++++++++++++++*/
|
||||
|
||||
if(VL_FindIndex==ml_LinkSize){return 0; }
|
||||
if(VL_FindIndex==ml_LinkSize){return 0;}
|
||||
|
||||
VP_TempLink = VP_TempLink->mp_NextLink;
|
||||
VL_FindIndex= VL_FindIndex + 1 ;
|
||||
@ -1960,11 +1960,13 @@ namespace ZNsMain
|
||||
|
||||
TTypSize Find(TypeArg AR_TypeArg, TTypSize AL_FirstFindIndex=1)
|
||||
{
|
||||
const bool CB_DoStop =
|
||||
const bool CB_DoStop = //////////////////////
|
||||
(
|
||||
mp_HeadLink==0 || AL_FirstFindIndex<1 || AL_FirstFindIndex>ml_LinkSize
|
||||
mp_HeadLink ==0 ||
|
||||
AL_FirstFindIndex< 1 ||
|
||||
AL_FirstFindIndex> ml_LinkSize
|
||||
);
|
||||
if(CB_DoStop) return 0;
|
||||
if(CB_DoStop) return 0; /////////////////////
|
||||
|
||||
|
||||
TTypSize VL_FindIndex = AL_FirstFindIndex ;
|
||||
@ -2153,10 +2155,10 @@ namespace ZNsMain
|
||||
*/
|
||||
|
||||
|
||||
template<typename TFunctor> void IterElemCut(TFunctor AO_Functor)
|
||||
template<typename TFunctor> void IterElemDel(TFunctor AO_Functor)
|
||||
{
|
||||
// 각 링크에 대하여 AO_Functor(ZCLink*) 함수를 실행한다.
|
||||
// 이 함수를 설계한 이유는 각 링크를 순회하면서 삭제할 수 있도록 하기 위해서다.
|
||||
// 각 링크를 순회하면서 삭제할 수 있게 한 것이다.
|
||||
|
||||
ZCLink* VP_TempPrev = 0 ;
|
||||
ZCLink* VP_TempLink = mp_HeadLink ;
|
||||
@ -2173,7 +2175,7 @@ namespace ZNsMain
|
||||
VP_TempLink = VP_TempLink->mp_NextLink;
|
||||
|
||||
const bool CB_IsTrue = ZtCTypeData<TFunctor>::
|
||||
GetObjRef(AO_Functor)( VP_TempBefore->mo_DataObjt );
|
||||
GetObjRef(AO_Functor)(**VP_TempBefore);
|
||||
|
||||
if(CB_IsTrue)
|
||||
{
|
||||
@ -2193,10 +2195,10 @@ namespace ZNsMain
|
||||
}/*
|
||||
__for1(TTypSize, VL_Loop, VL_Count)*/
|
||||
}/*
|
||||
template<typename TFunctor> void IterElemCut(TFunctor AO_Functor) */
|
||||
template<typename TFunctor> void IterElemDel(TFunctor AO_Functor) */
|
||||
|
||||
|
||||
template<typename TFunctor> void IterEleLink ////////////////////////
|
||||
template<typename TFunctor> void IterElemLink ///////////////////////
|
||||
(
|
||||
ZCLink* AP_StdLink ,
|
||||
TTypSize AL_WorkDistance,
|
||||
@ -2206,8 +2208,6 @@ namespace ZNsMain
|
||||
{
|
||||
/* AP_StdLink 부터 AL_WorkDistance 만큼 이동하면서
|
||||
* 각 ZCLink 에 대하여 AO_Functor() 함수를 수행한다.(총 수행 횟수는 (AL_WorkDistance)절대값+1)
|
||||
* AL_WorkDistance>=0 이면 다음으로 이동하고
|
||||
* AL_WorkDistance <0 이면 이전으로 이동한다.
|
||||
*/
|
||||
|
||||
#ifdef _DEBUG
|
||||
@ -2216,7 +2216,7 @@ namespace ZNsMain
|
||||
{
|
||||
std::fstream fileout("DEBUG.txt",std::ios::out | std::ios::app);
|
||||
fileout<<std::endl<<"File : "<<__FILE__<<std::endl<<"Line : "<<__LINE__<<std::endl;
|
||||
fileout<<"Error In 'void IterEleLink( ZCLink* AP_StdLink ,"<<std::endl;
|
||||
fileout<<"Error In 'void IterElemLink( ZCLink* AP_StdLink ,"<<std::endl;
|
||||
fileout<<" TTypSize AL_WorkDistance,"<<std::endl;
|
||||
fileout<<" TFunctor AO_Functor"<<std::endl;
|
||||
fileout<<" )' :"<<std::endl;
|
||||
@ -2237,7 +2237,7 @@ namespace ZNsMain
|
||||
}/*
|
||||
for(TTypSize VL_Loop=0; VL_Loop<=AL_WorkDistance; ++VL_Loop)*/
|
||||
}/*
|
||||
void IterEleLink ////////////////////////////////////////////////////
|
||||
void IterElemLink ///////////////////////////////////////////////////
|
||||
(
|
||||
ZCLink* AP_StdLink ,
|
||||
TTypSize AL_WorkDistance,
|
||||
|
Reference in New Issue
Block a user