commit 2025-10-06 23:26 edit ZCppMain/ZtCSimList.H
This commit is contained in:
@ -1228,17 +1228,10 @@ namespace ZNsMain
|
||||
{ DeleteAll(); }
|
||||
if(rhs.ml_LinkSize== 0 ){return *this;}
|
||||
|
||||
#if(_CODE_NEW_)
|
||||
CopyLink(rhs.mp_HeadLink, rhs.ml_LinkSize-1, *this); return *this;
|
||||
#else
|
||||
ZtCSimList VO_StoreList;
|
||||
CopyLink
|
||||
(rhs.mp_HeadLink, rhs.ml_LinkSize-1, *this);
|
||||
|
||||
JoinHead ///////////////////////////
|
||||
(
|
||||
CopyLink(rhs.mp_HeadLink, rhs.ml_LinkSize-1, VO_StoreList)
|
||||
);
|
||||
return *this; //////////////////////
|
||||
#endif
|
||||
return *this;
|
||||
}/*
|
||||
ZtCSimList& operator=(const ZtCSimList& rhs)*/
|
||||
|
||||
@ -1257,46 +1250,15 @@ namespace ZNsMain
|
||||
|
||||
TType& operator[](TTypSize AL_Index)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)
|
||||
{
|
||||
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 TType& ZtCSimList::TType& operator[](TTypSize AL_Index)"<<std::endl;
|
||||
fileout<<" Parameter is Bad AL_Index"<<std::endl;
|
||||
fileout.close();
|
||||
|
||||
exit(1);
|
||||
}/*
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return GetLinkPtr(AL_Index)->mo_DataObjt;
|
||||
}/*
|
||||
TType& operator[](TTypSize AL_Index)*/
|
||||
|
||||
const TType& operator[](TTypSize AL_Index) const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)
|
||||
{
|
||||
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 const TType& ZtCSimList::TType& operator[](TTypSize AL_Index) const"<<std::endl;
|
||||
fileout<<" Parameter is Bad AL_Index"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return GetLinkPtr(AL_Index)->mo_DataObjt;
|
||||
}
|
||||
//const TType& operator[](TTypSize AL_Index) const
|
||||
}/*
|
||||
const TType& operator[](TTypSize AL_Index) const*/
|
||||
|
||||
|
||||
operator TType&(){return AddTailDef()->mo_DataObjt;}
|
||||
@ -1313,14 +1275,11 @@ namespace ZNsMain
|
||||
{
|
||||
ZCLink* VP_AddLink = GetCFreeHeap().SendFreeOut() ;
|
||||
|
||||
#if(_CODE_NEW_)
|
||||
if(TypeMoveObj::ZEUseMoveObj>0) ////////////////////
|
||||
{
|
||||
TypeMoveObj::Exec(VP_AddLink->mo_DataObjt, AR_Type);
|
||||
}
|
||||
else ///////////////////////////////////////////////
|
||||
#endif
|
||||
VP_AddLink->mo_DataObjt= AR_Type ;
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
if(++ml_LinkSize==1) // ml_LinkSize==0
|
||||
{
|
||||
@ -1339,43 +1298,43 @@ namespace ZNsMain
|
||||
}/*
|
||||
void AddHead(TypeArg AR_Type)*/
|
||||
|
||||
ZCLink* AddHeadDef()
|
||||
ZCLink& AddHeadDef()
|
||||
{
|
||||
ZCLink* VP_AddLink=GetCFreeHeap().SendFreeOut();
|
||||
|
||||
if(++ml_LinkSize==1) // ml_LinkSize==0
|
||||
{
|
||||
mp_HeadLink =
|
||||
mp_TailLink = VP_AddLink ;
|
||||
mp_HeadLink = mp_TailLink = VP_AddLink ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ZCLink::JoinLink(VP_AddLink, mp_HeadLink);
|
||||
ZCLink::JoinLink
|
||||
(VP_AddLink, mp_HeadLink);
|
||||
|
||||
mp_HeadLink = VP_AddLink ;
|
||||
}
|
||||
ZCLink::MakeRing(mp_HeadLink, mp_TailLink);
|
||||
|
||||
ZCLink::MakeRing
|
||||
(mp_HeadLink, mp_TailLink);
|
||||
|
||||
return *VP_AddLink;
|
||||
}/*
|
||||
ZCLink* AddHeadDef()*/
|
||||
ZCLink& AddHeadDef()*/
|
||||
|
||||
|
||||
void AddTail(TypeArg AR_Type)
|
||||
{
|
||||
ZCLink* VP_AddLink = GetCFreeHeap().SendFreeOut();
|
||||
|
||||
#if(_CODE_NEW_)
|
||||
if(TypeMoveObj::ZEUseMoveObj>0) ////////////////////
|
||||
if(TypeMoveObj::ZEUseMoveObj>0) //::::::::::::::::
|
||||
{
|
||||
TypeMoveObj::Exec(VP_AddLink->mo_DataObjt, AR_Type);
|
||||
}
|
||||
else ///////////////////////////////////////////////
|
||||
#endif
|
||||
VP_AddLink->mo_DataObjt= AR_Type ;
|
||||
/*::::::::::::::::::::::::::::::::::::::::::::::*/
|
||||
|
||||
if(++ml_LinkSize==1) // ml_LinkSize==0
|
||||
{
|
||||
mp_HeadLink =
|
||||
mp_TailLink = VP_AddLink ;
|
||||
mp_HeadLink = mp_TailLink = VP_AddLink ;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -1395,16 +1354,20 @@ namespace ZNsMain
|
||||
|
||||
if(++ml_LinkSize==1) // ml_LinkSize==0
|
||||
{
|
||||
mp_HeadLink =
|
||||
mp_TailLink = VP_AddLink ;
|
||||
mp_HeadLink = mp_TailLink = VP_AddLink ;
|
||||
}
|
||||
else
|
||||
{
|
||||
ZCLink::JoinLink(mp_TailLink, VP_AddLink);
|
||||
ZCLink::JoinLink
|
||||
(mp_TailLink, VP_AddLink);
|
||||
|
||||
mp_TailLink = VP_AddLink ;
|
||||
}
|
||||
ZCLink::MakeRing(mp_HeadLink, mp_TailLink);
|
||||
|
||||
ZCLink::MakeRing
|
||||
(mp_HeadLink, mp_TailLink);
|
||||
|
||||
return *VP_AddLink;
|
||||
}/*
|
||||
ZCLink* AddTailDef()*/
|
||||
|
||||
@ -1473,42 +1436,12 @@ namespace ZNsMain
|
||||
|
||||
TType& GetHeadData()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(mp_HeadLink==0)
|
||||
{
|
||||
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 TType& ZtCSimList::GetHeadData()"<<std::endl;
|
||||
fileout<<" mp_HeadLink Pointer is NULL"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
if(mp_HeadLink==0)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return mp_HeadLink->mo_DataObjt;
|
||||
}/*
|
||||
TType& GetHeadData()*/
|
||||
|
||||
const TType& GetHeadData() const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(mp_HeadLink==0)
|
||||
{
|
||||
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 const TType& ZtCSimList::GetHeadData() const"<<std::endl;
|
||||
fileout<<" mp_HeadLink Pointer is NULL"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
if(mp_HeadLink==0)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return mp_HeadLink->mo_DataObjt;
|
||||
}/*
|
||||
const TType& GetHeadData() const*/
|
||||
@ -1516,42 +1449,12 @@ namespace ZNsMain
|
||||
|
||||
TType& GetTailData()
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(mp_TailLink==0)
|
||||
{
|
||||
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 const TType& ZtCSimList::GetTailData() const"<<std::endl;
|
||||
fileout<<" mp_TailLink Pointer is NULL"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
if(mp_TailLink==0)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return mp_TailLink->mo_DataObjt ;
|
||||
}/*
|
||||
TType& GetTailData()*/
|
||||
|
||||
const TType& GetTailData() const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(mp_TailLink==0)
|
||||
{
|
||||
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 const TType& ZtCSimList::GetTailData() const"<<std::endl;
|
||||
fileout<<" mp_TailLink Pointer is NULL"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
if(mp_TailLink==0)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return mp_TailLink->mo_DataObjt ;
|
||||
}/*
|
||||
const TType& GetTailData() const*/
|
||||
@ -1559,42 +1462,12 @@ namespace ZNsMain
|
||||
|
||||
TType& GetData(TTypSize AL_Index)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)
|
||||
{
|
||||
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 TType& ZtCSimList::GetData(TTypSize AL_Index)"<<std::endl;
|
||||
fileout<<" Parameter is Bad AL_Index"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return GetLinkPtr(AL_Index)->mo_DataObjt;
|
||||
}/*
|
||||
TType& GetData(TTypSize AL_Index)*/
|
||||
|
||||
TType GetData(TTypSize AL_Index) const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)
|
||||
{
|
||||
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 TType& ZtCSimList::GetData(TTypSize AL_Index)"<<std::endl;
|
||||
fileout<<" Parameter is Bad AL_Index"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return GetLinkPtr(AL_Index)->mo_DataObjt;
|
||||
}/*
|
||||
TType GetData(TTypSize AL_Index) const*/
|
||||
@ -1602,27 +1475,6 @@ namespace ZNsMain
|
||||
|
||||
void JoinHead(ZCLink* AP_Link)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(AP_Link==0)
|
||||
{
|
||||
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 JoinHead(ZCLink* AP_Link)' : Parameter is null pointer"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}
|
||||
else if(Find(AP_Link)!=0) // AP_Link 가 this 가 가리키는 연결리스트에 존재하는 링크인가.
|
||||
{
|
||||
std::fstream fileout("DEBUG.txt",std::ios::out | std::ios::app);
|
||||
fileout<<"Error In 'void JoinHead(ZCLink* AP_Link)' : The list that parameter link belongs to is now list"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
else if(Find(AP_Link)!=0)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
if(mp_HeadLink==0)
|
||||
{
|
||||
mp_HeadLink = mp_TailLink = AP_Link ;
|
||||
@ -1639,28 +1491,6 @@ namespace ZNsMain
|
||||
|
||||
void JoinTail(ZCLink* AP_Link)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(AP_Link==0)
|
||||
{
|
||||
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 JoinTail(ZCLink* AP_Link)' : Parameter is null pointer"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}
|
||||
else if(Find(AP_Link)!=0)
|
||||
{
|
||||
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 JoinTail(ZCLink* AP_Link)' : The list that parameter link belongs to is now list"<<std::endl;
|
||||
fileout.close();
|
||||
exit(1);
|
||||
}/*
|
||||
else if(Find(AP_Link)!=0)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
if(mp_HeadLink==0)
|
||||
{
|
||||
mp_HeadLink =
|
||||
@ -1778,11 +1608,16 @@ namespace ZNsMain
|
||||
|
||||
ZCLink* VP_NewHead= mp_HeadLink->
|
||||
GetNextPtr( AL_DelSize );
|
||||
GetCFreeHeap().RecvFreeIn
|
||||
(AL_DelSize, mp_HeadLink, VP_NewHead->mp_PrevLink);
|
||||
GetCFreeHeap().RecvFreeIn ////////////
|
||||
(
|
||||
AL_DelSize ,
|
||||
mp_HeadLink ,
|
||||
VP_NewHead->mp_PrevLink
|
||||
);
|
||||
//////////////////////////////////////
|
||||
|
||||
mp_HeadLink = VP_NewHead ;
|
||||
ml_LinkSize -= AL_DelSize ;
|
||||
mp_HeadLink = VP_NewHead ;
|
||||
ml_LinkSize -= AL_DelSize ;
|
||||
|
||||
ZCLink::MakeRing(mp_HeadLink, mp_TailLink);
|
||||
}/*
|
||||
@ -1816,20 +1651,6 @@ namespace ZNsMain
|
||||
|
||||
void Delete(ZCLink* AP_PrevLink, ZCLink* AP_CutLink)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if ( Find(AP_CutLink)==0 ||
|
||||
Find(AP_CutLink)!=Find(AP_PrevLink)+1
|
||||
)
|
||||
{
|
||||
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 Delete(ZCLink* AP_PrevLink, ZCLink* AP_CutLink)' : Parameter is Bad Pointer"<<std::endl;
|
||||
fileout.close();
|
||||
|
||||
exit(1);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
GetCFreeHeap().RecvFreeIn
|
||||
( CutLink(AP_PrevLink, AP_CutLink) );
|
||||
}/*
|
||||
@ -1837,21 +1658,6 @@ namespace ZNsMain
|
||||
|
||||
void Delete(ZCLink* AP_PrevLink, ZCLink* AP_CutLink, TTypSize AL_CutPos)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
if ( ml_LinkSize==0 ||
|
||||
Find(AP_CutLink) !=AL_CutPos ||
|
||||
Find(AP_PrevLink)!=(AL_CutPos-1)
|
||||
)
|
||||
{
|
||||
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 Delete(ZCLink* AP_PrevLink, ZCLink* AP_CutLink, TTypSize AL_CutPos)' : Parameter is Bad Pointer or Bad AL_Index"<<std::endl;
|
||||
fileout.close();
|
||||
|
||||
exit(1);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
GetCFreeHeap().RecvFreeIn
|
||||
( CutLink(AP_PrevLink, AP_CutLink, AL_CutPos) );
|
||||
}/*
|
||||
@ -1865,26 +1671,6 @@ namespace ZNsMain
|
||||
)
|
||||
/*###############################################*/
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if ( ml_LinkSize==0 ||
|
||||
AL_CutHeadPos>AL_CutTailPos ||
|
||||
Find(AP_CutHead)!=AL_CutHeadPos ||
|
||||
Find(AP_CutTail)!=AL_CutTailPos ||
|
||||
(AL_CutHeadPos!=1 && AP_CutHeadPrev->mp_NextLink!=AP_CutHead)
|
||||
)
|
||||
{
|
||||
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 Delete(ZCLink* AP_CutHeadPrev,ZCLink* AP_CutHead,TTypSize AL_CutHeadPos,ZCLink* AP_CutTail,TTypSize AL_CutTailPos)' : Parameter is Bad Pointer or Bad AL_Index"<<std::endl;
|
||||
fileout.close();
|
||||
|
||||
exit(1);
|
||||
}
|
||||
/*////////////////////////////////////////////////////////////////*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
ZtCSimList VO_StoreList;
|
||||
|
||||
CutLink /*==========================================*/
|
||||
@ -2007,21 +1793,6 @@ namespace ZNsMain
|
||||
|
||||
ZCLink* GetLinkPtr(TTypSize AL_Index)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)
|
||||
{
|
||||
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 'ZCLink* GetLinkPtr(TTypSize AL_Index)' : Parameter is Bad AL_Index(AL_Index="<<AL_Index<<")"<<std::endl;
|
||||
fileout.close();
|
||||
|
||||
exit(1);
|
||||
}/*
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return mp_HeadLink->GetNextPtr(AL_Index-1);
|
||||
}/*
|
||||
ZCLink* GetLinkPtr(TTypSize AL_Index)*/
|
||||
@ -2029,21 +1800,6 @@ namespace ZNsMain
|
||||
|
||||
const ZCLink* GetLinkPtr(TTypSize AL_Index) const
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)
|
||||
{
|
||||
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 'const ZCLink* GetLinkPtr(TTypSize AL_Index) const' : Parameter is Bad AL_Index(AL_Index="<<AL_Index<<")"<<std::endl;
|
||||
fileout.close();
|
||||
|
||||
exit(1);
|
||||
}/*
|
||||
if(AL_Index<1 || AL_Index>ml_LinkSize)*/
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
return mp_HeadLink->GetNextPtr(AL_Index-1);
|
||||
}/*
|
||||
const ZCLink* GetLinkPtr(TTypSize AL_Index) const*/
|
||||
@ -2070,11 +1826,8 @@ namespace ZNsMain
|
||||
{ return mo_FreeObjt.size(); }
|
||||
|
||||
|
||||
inline bool IsEmpty() const
|
||||
{
|
||||
return mp_HeadLink==0;
|
||||
}/*
|
||||
inline bool IsEmpty() const*/
|
||||
inline bool IsEmpty() const{ return mp_HeadLink==0; }
|
||||
inline bool empty () const{ return mp_HeadLink==0; }
|
||||
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user