From cd42f26bfdac337755c30ccfc641fc5c967dce40 Mon Sep 17 00:00:00 2001 From: sauron Date: Sun, 5 Oct 2025 20:29:21 +0900 Subject: [PATCH] commit 2025-10-05 20:29 add ZCppMainTest/ZtCLinkList_000.cpp --- ZCppMain/ZMainHead.H | 33 +- ZCppMain/ZtCLinkList.H | 1411 +++++++++++++++++++++++++++++--------- ZCppMainTest/ZtCLinkList_000.cpp | 173 +++++ 3 files changed, 1283 insertions(+), 334 deletions(-) create mode 100644 ZCppMainTest/ZtCLinkList_000.cpp diff --git a/ZCppMain/ZMainHead.H b/ZCppMain/ZMainHead.H index 8b45053..e256291 100644 --- a/ZCppMain/ZMainHead.H +++ b/ZCppMain/ZMainHead.H @@ -4487,7 +4487,38 @@ namespace ZNsMain public : };/* - template class ZtCObjPtr */ + template + + class ZtCObjPtr + */ + + + template class ZtCObjOpt // C++ 17 에 추가된 optional 구현 + { + public : + typedef TType TypeData; + protected: + TypeData* mp_TypeData ; + public : + + ZtCObjOpt(TypeData& AR_CData) : mp_TypeData(&AR_CData ){} + ZtCObjOpt(TypeData* AP_CData) : mp_TypeData( AP_CData ){} + ZtCObjOpt(ZtCObjOpt& AR_Rhs ) : mp_TypeData(AR_Rhs.mp_TypeData){} + + TypeData* operator->(){return mp_TypeData;} + TypeData& operator* (){return *mp_TypeData;} + operator TypeData& (){return *mp_TypeData;} + + ZtCObjOpt& operator=(const ZtCObjOpt& rhs) + { mp_TypeData=rhs.mp_TypeData; return *this; } + + bool has_value() const{return mp_TypeData!=0;} + + TypeData& value() const{return *mp_TypeData ;} + + public : + };/* + template class ZtCObjOpt */ /*/////////////////////////////////////////////////////////// diff --git a/ZCppMain/ZtCLinkList.H b/ZCppMain/ZtCLinkList.H index c486f04..51b6556 100644 --- a/ZCppMain/ZtCLinkList.H +++ b/ZCppMain/ZtCLinkList.H @@ -1,8 +1,5 @@  -// is editing - - #ifndef __ZCPPMAIN__ZTCLINKLIST_H__ #define __ZCPPMAIN__ZTCLINKLIST_H__ @@ -13,353 +10,688 @@ namespace ZNsMain { - template - - class ZtCLinkList; + template ////////////////////////////////////////////////////////////////// + < + typename TCLink + , typename TTypSize + , typename TTypeCRTP + > + class ZtCLinkList; /*####################################################*/ - template - - class ZtCLink : public TTypBase + namespace ZNsIFaceEx { - public : + template - - friend class ZtCLinkList; - public : - typedef ZtCLink TypeThis ; - typedef TTypBase TypeBase ; - typedef TChild TypeChild; - protected: - ZtCLink* mp_NextLink; - ZtCLink* mp_PrevLink; - protected: - - void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink) + + class ZtCLink : public TTypBase { - AP_PrevLink->mp_NextLink=AP_NextLink; - AP_NextLink->mp_PrevLink=AP_PrevLink; - }/* - void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink)*/ + public : - void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink) - { - AP_HeadLink->mp_PrevLink=AP_TailLink; - AP_TailLink->mp_NextLink=AP_HeadLink; - }/* - void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink)*/ + template ////////////////////////////////////////////////////////////////// + < + typename TCLink + , typename TTypSize + , typename TTypeCRTP + > + friend class ZNsMain::ZtCLinkList; /*####################################*/ - /*protected:*/ - public : + public : + typedef ZtCLink TypeThis ; + typedef TTypBase TypeBase ; + typedef TChild TypeChild; + typedef ZTypLong TypeSize ; + protected: + ZtCLink* mp_NextLink; + ZtCLink* mp_PrevLink; + protected: - ZtCLink() - { - mp_NextLink=0; - mp_PrevLink=0; - }/* - ZtCLink()*/ + static void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink) + { + AP_PrevLink->mp_NextLink=AP_NextLink; + AP_NextLink->mp_PrevLink=AP_PrevLink; + }/* + static void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink)*/ - ZtCLink(const ZtCLink& rhs) - { - mp_NextLink=0; - mp_PrevLink=0; + static void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink) + { + AP_HeadLink->mp_PrevLink=AP_TailLink; + AP_TailLink->mp_NextLink=AP_HeadLink; + }/* + static void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink)*/ - *(TypeBase*)(this) = rhs ; - }/* - ZtCLink(const ZtCLink& rhs)*/ + /*protected:*/ + public : - ZtCLink& operator=(const ZtCLink& rhs) - { - static_cast(*this) = - static_cast( rhs ) ; + ZtCLink() + { + mp_NextLink=0; + mp_PrevLink=0; + }/* + ZtCLink()*/ - return *this; - }/* - ZtCLink& operator=(const ZtCLink& rhs)*/ + ZtCLink(const ZtCLink& rhs) + { + mp_NextLink=0 ; + mp_PrevLink=0 ; + + (*this) = rhs ; + }/* + ZtCLink(const ZtCLink& rhs)*/ + + ZtCLink(const TTypBase& rhs) + { + mp_NextLink=0 ; + mp_PrevLink=0 ; + + (*this) = rhs ; + }/* + ZtCLink(const TTypBase& rhs)*/ - ZtCLink* GetNextPtr(){return mp_NextLink;} - ZtCLink* GetPrevPtr(){return mp_PrevLink;} + ZtCLink& operator=(const ZtCLink& rhs) + { + (*this)() = rhs(); return *this; + }/* + ZtCLink& operator=(const ZtCLink& rhs)*/ - const ZtCLink* GetNextPtr() const{return mp_NextLink;} - const ZtCLink* GetPrevPtr() const{return mp_PrevLink;} + ZtCLink& operator=(const TypeBase& AR_CBase) + { + (*this)() = AR_CBase; return *this; + }/* + ZtCLink& operator=(const TypeBase& AR_CBase)*/ + + ZtCLink& operator=(TypeBase& AR_CBase) + { + (*this)() = AR_CBase; return *this; + }/* + ZtCLink& operator=(TypeBase& AR_CBase)*/ - ZtCLink* GetNextPtr(TypeSize AL_Distance) - { - TypeSize VL_LoopIndex=0 ; - ZtCLink* VP_TmpLink =this; - - while(VL_LoopIndex++ < AL_Distance) - VP_TmpLink = VP_TmpLink->mp_NextLink ; - - return VP_TmpLink; - }/* - ZtCLink* GetNextPtr(TypeSize AL_Distance)*/ - - ZtCLink* GetPrevPtr(TypeSize AL_Distance) - { - TypeSize VL_LoopIndex=0 ; - ZtCLink* VP_TmpLink =this; - - while(VL_LoopIndex++ < AL_Distance) - VP_TmpLink = VP_TmpLink->mp_PrevLink ; - - return VP_TmpLink; - }/* - ZtCLink* GetPrevPtr(TypeSize AL_Distance)*/ + TypeBase& operator()(){ return *static_cast(this); } - const ZtCLink* GetNextPtr(TypeSize AL_Distance) const - { - TypeSize VL_LoopIndex=0 ; - ZtCLink* VP_TmpLink =const_cast(this); + ZtCLink* GetNextPtr(){return mp_NextLink;} + ZtCLink* GetPrevPtr(){return mp_PrevLink;} - while(VL_LoopIndex++ < AL_Distance) - VP_TmpLink = VP_TmpLink->mp_NextLink ; - - return VP_TmpLink; - }/* - const ZtCLink* GetNextPtr(TypeSize AL_Distance) const*/ - - const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const - { - TypeSize VL_LoopIndex=0 ; - ZtCLink* VP_TmpLink = const_cast(this) ; - - while(VL_LoopIndex++ < AL_Distance) - VP_TmpLink = VP_TmpLink->mp_PrevLink ; - - return VP_TmpLink; - }/* - const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const*/ + const ZtCLink* GetNextPtr() const{return mp_NextLink;} + const ZtCLink* GetPrevPtr() const{return mp_PrevLink;} - ZtCLink& operator+(TypeSize AL_Distance) - { - if(AL_Distance>=0) - return *GetNextPtr(AL_Distance); - else return *GetPrevPtr(AL_Distance); - }/* - ZtCLink& operator+(TypeSize AL_Distance)*/ + ZtCLink* GetNextPtr(TypeSize AL_Distance) + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =this; - ZtCLink& operator-(TypeSize AL_Distance) - { - if(AL_Distance>=0) - return *GetPrevPtr(AL_Distance); - else return *GetNextPtr(AL_Distance); - }/* - ZtCLink& operator-(TypeSize AL_Distance)*/ + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_NextLink ; + + return VP_TmpLink; + }/* + ZtCLink* GetNextPtr(TypeSize AL_Distance)*/ + + ZtCLink* GetPrevPtr(TypeSize AL_Distance) + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =this; + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_PrevLink ; + + return VP_TmpLink; + }/* + ZtCLink* GetPrevPtr(TypeSize AL_Distance)*/ - const ZtCLink& operator+(TypeSize AL_Distance) const - { - if(AL_Distance>=0) - return *GetNextPtr(AL_Distance); - else return *GetPrevPtr(AL_Distance); - }/* - const ZtCLink& operator+(TypeSize AL_Distance) const*/ + const ZtCLink* GetNextPtr(TypeSize AL_Distance) const + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =const_cast(this); - const ZtCLink& operator-(TypeSize AL_Distance) const - { - if(AL_Distance>=0) - return *GetPrevPtr(AL_Distance); - else return *GetNextPtr(AL_Distance); - }/* - const ZtCLink& operator-(TypeSize AL_Distance) const*/ + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_NextLink ; - public : - };/* - template - - class ZtCLink : public TTypBase - */ + return VP_TmpLink; + }/* + const ZtCLink* GetNextPtr(TypeSize AL_Distance) const*/ - template - class ZtCLink : public TTypBase - { - public : + const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink = const_cast(this) ; + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_PrevLink ; + + return VP_TmpLink; + }/* + const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const*/ + + + ZtCLink& operator+(TypeSize AL_Distance) + { + if(AL_Distance>=0) + return *GetNextPtr(AL_Distance); + else return *GetPrevPtr(AL_Distance); + }/* + ZtCLink& operator+(TypeSize AL_Distance)*/ + + ZtCLink& operator-(TypeSize AL_Distance) + { + if(AL_Distance>=0) + return *GetPrevPtr(AL_Distance); + else return *GetNextPtr(AL_Distance); + }/* + ZtCLink& operator-(TypeSize AL_Distance)*/ + + + const ZtCLink& operator+(TypeSize AL_Distance) const + { + if(AL_Distance>=0) + return *GetNextPtr(AL_Distance); + else return *GetPrevPtr(AL_Distance); + }/* + const ZtCLink& operator+(TypeSize AL_Distance) const*/ + + const ZtCLink& operator-(TypeSize AL_Distance) const + { + if(AL_Distance>=0) + return *GetPrevPtr(AL_Distance); + else return *GetNextPtr(AL_Distance); + }/* + const ZtCLink& operator-(TypeSize AL_Distance) const*/ + + public : + };/* template - - friend class ZtCLinkList; - public : - typedef ZtCLink TypeThis ; - typedef TTypBase /*+++++++++++++*/ TypeBase ; - typedef ZCEmpty /*+++++++++++++*/ TypeChild; - protected: - ZtCLink* mp_NextLink; - ZtCLink* mp_PrevLink; - public : + + class ZtCLink : public TTypBase + */ - ZtCLink* GetNextPtr(){return mp_NextLink;} - ZtCLink* GetPrevPtr(){return mp_PrevLink;} - - void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink) + template + class ZtCLink : public TTypBase { - AP_PrevLink->mp_NextLink=AP_NextLink; - AP_NextLink->mp_PrevLink=AP_PrevLink; - }/* - void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink)*/ + public : + template ////////////////////////////////////////////////////////////////// + < + typename TCLink + , typename TTypSize + , typename TTypeCRTP + > + friend class ZNsMain::ZtCLinkList; /*####################################*/ + public : + typedef ZtCLink TypeThis ; + typedef TTypBase /*+++++++++++++*/ TypeBase ; + typedef ZCEmpty /*+++++++++++++*/ TypeChild; + typedef ZTypLong /*+++++++++++++*/ TypeSize ; + protected: + ZtCLink* mp_NextLink; + ZtCLink* mp_PrevLink; + public : - void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink) + static void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink) + { + AP_PrevLink->mp_NextLink=AP_NextLink; + AP_NextLink->mp_PrevLink=AP_PrevLink; + }/* + static void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink)*/ + + static void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink) + { + AP_HeadLink->mp_PrevLink=AP_TailLink; + AP_TailLink->mp_NextLink=AP_HeadLink; + }/* + static void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink)*/ + + /*protected:*/ + public : + + ZtCLink() + { + mp_NextLink=0; + mp_PrevLink=0; + }/* + ZtCLink()*/ + + ZtCLink(const TypeThis& rhs) + { + mp_NextLink =0 ; + mp_PrevLink =0 ; + + (*this)() = rhs(); + }/* + ZtCLink(const TypeThis& rhs)*/ + + TypeThis& operator=(const TypeThis& rhs) + { + (*this)() = rhs(); return *this; + }/* + TypeThis& operator=(const TypeThis& rhs)*/ + + TypeThis& operator=(const TypeBase& AR_CBase) + { + (*this)() = AR_CBase; return *this; + }/* + TypeThis& operator=(const TypeBase& AR_CBase)*/ + + TypeThis& operator=(TypeBase& AR_CBase) + { + (*this)() = AR_CBase; return *this; + }/* + TypeThis& operator=(TypeBase& AR_CBase)*/ + + + TypeBase& operator()(){ return *static_cast(this); } + + + ZtCLink* GetNextPtr(){return mp_NextLink;} + ZtCLink* GetPrevPtr(){return mp_PrevLink;} + + const ZtCLink* GetNextPtr() const{return mp_NextLink;} + const ZtCLink* GetPrevPtr() const{return mp_PrevLink;} + + + ZtCLink* GetNextPtr(TypeSize AL_Distance) + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =this; + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_NextLink ; + + return VP_TmpLink; + }/* + ZtCLink* GetNextPtr(TypeSize AL_Distance)*/ + + ZtCLink* GetPrevPtr(TypeSize AL_Distance) + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =this; + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_PrevLink ; + + return VP_TmpLink; + }/* + ZtCLink* GetPrevPtr(TypeSize AL_Distance)*/ + + + const ZtCLink* GetNextPtr(TypeSize AL_Distance) const + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =const_cast(this); + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_NextLink ; + + return VP_TmpLink; + }/* + const ZtCLink* GetNextPtr(TypeSize AL_Distance) const*/ + + const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink = const_cast(this) ; + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_PrevLink ; + + return VP_TmpLink; + }/* + const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const*/ + + + ZtCLink& operator+(TypeSize AL_Distance) + { + if(AL_Distance>=0) + return *GetNextPtr(AL_Distance); + else return *GetPrevPtr(AL_Distance); + }/* + ZtCLink& operator+(TypeSize AL_Distance)*/ + + ZtCLink& operator-(TypeSize AL_Distance) + { + if(AL_Distance>=0) + return *GetPrevPtr(AL_Distance); + else return *GetNextPtr(AL_Distance); + }/* + ZtCLink& operator-(TypeSize AL_Distance)*/ + + + const ZtCLink& operator+(TypeSize AL_Distance) const + { + if(AL_Distance>=0) + return *GetNextPtr(AL_Distance); + else return *GetPrevPtr(AL_Distance); + }/* + const ZtCLink& operator+(TypeSize AL_Distance) const*/ + + const ZtCLink& operator-(TypeSize AL_Distance) const + { + if(AL_Distance>=0) + return *GetPrevPtr(AL_Distance); + else return *GetNextPtr(AL_Distance); + }/* + const ZtCLink& operator-(TypeSize AL_Distance) const*/ + + public : + };/* + template + class ZtCLink : public TTypBase*/ + + + template class ZtCLink { - AP_HeadLink->mp_PrevLink=AP_TailLink; - AP_TailLink->mp_NextLink=AP_HeadLink; - }/* - void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink)*/ + public : + public : + template ////////////////////////////////////////////////////////////////// + < + typename TCLink + , typename TTypSize + , typename TTypeCRTP + > + friend class ZNsMain::ZtCLinkList; /*####################################*/ + public : + typedef ZtCLink TypeThis ; + typedef ZCEmpty /*+++++++++++*/ TypeBase ; + typedef TChild /*+++++++++++*/ TypeChild; + typedef ZTypLong /*++++++++++++*/ TypeSize ; + protected: + ZtCLink* mp_NextLink; + ZtCLink* mp_PrevLink; + protected: - /*protected:*/ - public : + static void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink) + { + AP_PrevLink->mp_NextLink=AP_NextLink; + AP_NextLink->mp_PrevLink=AP_PrevLink; + }/* + static void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink)*/ - ZtCLink() + static void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink) + { + AP_HeadLink->mp_PrevLink=AP_TailLink; + AP_TailLink->mp_NextLink=AP_HeadLink; + }/* + static void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink)*/ + + /*protected:*/ + public : + + ZtCLink() + { + mp_NextLink=0; + mp_PrevLink=0; + }/* + ZtCLink()*/ + + ZtCLink(const TypeThis& rhs) + { + mp_NextLink=0; + mp_PrevLink=0; + }/* + ZtCLink(const TypeThis& rhs)*/ + + TypeThis& operator=(const TypeThis& rhs) + { + return *this; + }/* + TypeThis& operator=(const TypeThis& rhs)*/ + + + TypeThis& operator()(){ return *this; } + + + ZtCLink* GetNextPtr(){return mp_NextLink;} + ZtCLink* GetPrevPtr(){return mp_PrevLink;} + + const ZtCLink* GetNextPtr() const{return mp_NextLink;} + const ZtCLink* GetPrevPtr() const{return mp_PrevLink;} + + + ZtCLink* GetNextPtr(TypeSize AL_Distance) + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =this; + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_NextLink ; + + return VP_TmpLink; + }/* + ZtCLink* GetNextPtr(TypeSize AL_Distance)*/ + + ZtCLink* GetPrevPtr(TypeSize AL_Distance) + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =this; + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_PrevLink ; + + return VP_TmpLink; + }/* + ZtCLink* GetPrevPtr(TypeSize AL_Distance)*/ + + + const ZtCLink* GetNextPtr(TypeSize AL_Distance) const + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =const_cast(this); + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_NextLink ; + + return VP_TmpLink; + }/* + const ZtCLink* GetNextPtr(TypeSize AL_Distance) const*/ + + const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink = const_cast(this) ; + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_PrevLink ; + + return VP_TmpLink; + }/* + const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const*/ + + + ZtCLink& operator+(TypeSize AL_Distance) + { + if(AL_Distance>=0) + return *GetNextPtr(AL_Distance); + else return *GetPrevPtr(AL_Distance); + }/* + ZtCLink& operator+(TypeSize AL_Distance)*/ + + ZtCLink& operator-(TypeSize AL_Distance) + { + if(AL_Distance>=0) + return *GetPrevPtr(AL_Distance); + else return *GetNextPtr(AL_Distance); + }/* + ZtCLink& operator-(TypeSize AL_Distance)*/ + + + const ZtCLink& operator+(TypeSize AL_Distance) const + { + if(AL_Distance>=0) + return *GetNextPtr(AL_Distance); + else return *GetPrevPtr(AL_Distance); + }/* + const ZtCLink& operator+(TypeSize AL_Distance) const*/ + + const ZtCLink& operator-(TypeSize AL_Distance) const + { + if(AL_Distance>=0) + return *GetPrevPtr(AL_Distance); + else return *GetNextPtr(AL_Distance); + }/* + const ZtCLink& operator-(TypeSize AL_Distance) const*/ + + public : + };/* + template class ZtCLink*/ + + + template<> class ZtCLink { - mp_NextLink=0; - mp_PrevLink=0; - }/* - ZtCLink()*/ + public : + public : + template ////////////////////////////////////////////////////////////////// + < + typename TCLink + , typename TTypSize + , typename TTypeCRTP + > + friend class ZNsMain::ZtCLinkList; /*####################################*/ + public : + typedef ZtCLink TypeThis ; + typedef ZCEmpty /*++++++++++++*/ TypeBase ; + typedef ZCEmpty /*++++++++++++*/ TypeChild; + typedef ZTypLong /*++++++++++++*/ TypeSize ; + protected: + ZtCLink* mp_NextLink; + ZtCLink* mp_PrevLink; + protected: - ZtCLink(const TypeThis& rhs) - { - mp_NextLink=0; - mp_PrevLink=0; + static void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink) + { + AP_PrevLink->mp_NextLink=AP_NextLink; + AP_NextLink->mp_PrevLink=AP_PrevLink; + }/* + static void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink)*/ - *(TypeBase*)(this) = rhs ; - }/* - ZtCLink(const TypeThis& rhs)*/ + static void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink) + { + AP_HeadLink->mp_PrevLink=AP_TailLink; + AP_TailLink->mp_NextLink=AP_HeadLink; + }/* + static void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink)*/ - TypeThis& operator=(const TypeThis& rhs) - { - static_cast(*this) = - static_cast( rhs ) ; + /*protected:*/ + public : - return *this; - }/* - TypeThis& operator=(const TypeThis& rhs)*/ + ZtCLink() + { + mp_NextLink=0; + mp_PrevLink=0; + }/* + ZtCLink()*/ - public : - };/* - template - class ZtCLink : public TTypBase*/ + ZtCLink(const TypeThis& rhs) + { + mp_NextLink=0; + mp_PrevLink=0; + }/* + ZtCLink(const TypeThis& rhs)*/ + + TypeThis& operator=(const TypeThis& rhs) + { + return *this; + }/* + TypeThis& operator=(const TypeThis& rhs)*/ - template class ZtCLink - { - public : - template - - friend class ZtCLinkList; - public : - typedef ZtCLink TypeThis ; - typedef ZCEmpty /*++++++++++++*/ TypeBase ; - typedef TChild /*++++++++++++*/ TypeChild; - protected: - ZtCLink* mp_NextLink; - ZtCLink* mp_PrevLink; - protected: + ZtCLink* GetNextPtr(){return mp_NextLink;} + ZtCLink* GetPrevPtr(){return mp_PrevLink;} - ZtCLink* GetNextPtr(){return mp_NextLink;} - ZtCLink* GetPrevPtr(){return mp_PrevLink;} - - void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink) - { - AP_PrevLink->mp_NextLink=AP_NextLink; - AP_NextLink->mp_PrevLink=AP_PrevLink; - }/* - void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink)*/ - - void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink) - { - AP_HeadLink->mp_PrevLink=AP_TailLink; - AP_TailLink->mp_NextLink=AP_HeadLink; - }/* - void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink)*/ - - /*protected:*/ - public : - - ZtCLink() - { - mp_NextLink=0; - mp_PrevLink=0; - }/* - ZtCLink()*/ - - ZtCLink(const TypeThis& rhs) - { - mp_NextLink=0; - mp_PrevLink=0; - }/* - ZtCLink(const TypeThis& rhs)*/ - - TypeThis& operator=(const TypeThis& rhs) - { - return *this; - }/* - TypeThis& operator=(const TypeThis& rhs)*/ - - public : - };/* - template class ZtCLink*/ + const ZtCLink* GetNextPtr() const{return mp_NextLink;} + const ZtCLink* GetPrevPtr() const{return mp_PrevLink;} - template<> class ZtCLink - { - public : - template - - friend class ZtCLinkList; - public : - typedef ZtCLink TypeThis ; - typedef ZCEmpty /*++++++++++++*/ TypeBase ; - typedef ZCEmpty /*++++++++++++*/ TypeChild; - protected: - ZtCLink* mp_NextLink; - ZtCLink* mp_PrevLink; - protected: + ZtCLink* GetNextPtr(TypeSize AL_Distance) + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =this; - ZtCLink* GetNextPtr(){return mp_NextLink;} - ZtCLink* GetPrevPtr(){return mp_PrevLink;} + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_NextLink ; - void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink) - { - AP_PrevLink->mp_NextLink=AP_NextLink; - AP_NextLink->mp_PrevLink=AP_PrevLink; - }/* - void JoinLink(ZtCLink* AP_PrevLink, ZtCLink* AP_NextLink)*/ + return VP_TmpLink; + }/* + ZtCLink* GetNextPtr(TypeSize AL_Distance)*/ - void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink) - { - AP_HeadLink->mp_PrevLink=AP_TailLink; - AP_TailLink->mp_NextLink=AP_HeadLink; - }/* - void MakeRing(ZtCLink* AP_HeadLink, ZtCLink* AP_TailLink)*/ + ZtCLink* GetPrevPtr(TypeSize AL_Distance) + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =this; - /*protected:*/ - public : + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_PrevLink ; - ZtCLink() - { - mp_NextLink=0; - mp_PrevLink=0; - }/* - ZtCLink()*/ + return VP_TmpLink; + }/* + ZtCLink* GetPrevPtr(TypeSize AL_Distance)*/ - ZtCLink(const TypeThis& rhs) - { - mp_NextLink=0; - mp_PrevLink=0; - }/* - ZtCLink(const TypeThis& rhs)*/ - TypeThis& operator=(const TypeThis& rhs) - { - return *this; - }/* - TypeThis& operator=(const TypeThis& rhs)*/ + const ZtCLink* GetNextPtr(TypeSize AL_Distance) const + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink =const_cast(this); - public : - };/* - template<> class ZtCLink*/ + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_NextLink ; + + return VP_TmpLink; + }/* + const ZtCLink* GetNextPtr(TypeSize AL_Distance) const*/ + + const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const + { + TypeSize VL_LoopIndex=0 ; + ZtCLink* VP_TmpLink = const_cast(this) ; + + while(VL_LoopIndex++ < AL_Distance) + VP_TmpLink = VP_TmpLink->mp_PrevLink ; + + return VP_TmpLink; + }/* + const ZtCLink* GetPrevPtr(TypeSize AL_Distance) const*/ + + + ZtCLink& operator+(TypeSize AL_Distance) + { + if(AL_Distance>=0) + return *GetNextPtr(AL_Distance); + else return *GetPrevPtr(AL_Distance); + }/* + ZtCLink& operator+(TypeSize AL_Distance)*/ + + ZtCLink& operator-(TypeSize AL_Distance) + { + if(AL_Distance>=0) + return *GetPrevPtr(AL_Distance); + else return *GetNextPtr(AL_Distance); + }/* + ZtCLink& operator-(TypeSize AL_Distance)*/ + + + const ZtCLink& operator+(TypeSize AL_Distance) const + { + if(AL_Distance>=0) + return *GetNextPtr(AL_Distance); + else return *GetPrevPtr(AL_Distance); + }/* + const ZtCLink& operator+(TypeSize AL_Distance) const*/ + + const ZtCLink& operator-(TypeSize AL_Distance) const + { + if(AL_Distance>=0) + return *GetPrevPtr(AL_Distance); + else return *GetNextPtr(AL_Distance); + }/* + const ZtCLink& operator-(TypeSize AL_Distance) const*/ + + public : + };/* + template<> class ZtCLink*/ + + }/* + namespace ZNsIFaceEx*/ @@ -373,7 +705,6 @@ namespace ZNsMain class ZtCLinkList /*#####################################################*/ { public : - typedef ZNsType::ZtCTypeNowCRTP /////////////////////////////////////// < ZtCLinkList, typename TTypeCRTP::TypeData, TTypeCRTP::ZEUseCRTP @@ -381,7 +712,8 @@ namespace ZNsMain ZCTypeNowCRTP ; /////////////////////////////////////////////////////// typedef typename ZCTypeNowCRTP::TypeData TypeChild; - + public : + typedef ZtCObjOpt ZCObjOpt; public : typedef TCLink ZCLink ; typedef TCLink TypeData; @@ -400,24 +732,226 @@ namespace ZNsMain private: - _VT_ ZCLink* NewLink() + ZCLink* NewLink() + { + return new ZCLink; + }/* + ZCLink* NewLink()*/ + + ZCLink* NewLink( ZCLink& AR_ArgData) + { return new ZCLink(AR_ArgData); } + + ZCLink* NewLink(const ZCLink& AR_ArgData) + { return new ZCLink(AR_ArgData); } + + void NewLink //////////////////////////////////////// + ( + TypeSize AL_NeedCnt , + ZCLink*& APR_HeadLink , + ZCLink*& APR_TailLink + ) + ///////////////////////////////////////////////////// + { + APR_HeadLink = new ZCLink; + + ZCLink* VP_MakeLink = 0 ; + ZCLink* VP_TailLink = APR_HeadLink; + + while(--AL_NeedCnt>0) // AL_NeedCnt - 1 번 순환 + { + // AL_NeedCnt - 1 번 순환 + + VP_MakeLink = new ZCLink; + + ZCLink::JoinLink + (VP_TailLink, VP_MakeLink); + VP_TailLink = VP_MakeLink ; + }/* + while(--AL_NeedCnt>0)*/ + + APR_TailLink = VP_TailLink; + }/* + void NewLink //////////////////////////////////////// + ( + TypeSize AL_NeedCnt , + ZCLink*& APR_HeadLink , + ZCLink*& APR_TailLink + ) + ///////////////////////////////////////////////////*/ + + + void NewLinkCopy ////////////////////////////////// + ( + ZCLink* AP_LinkOrgin, TypeSize AL_FarNum , + ZCLink*& APR_HeadCopy, ZCLink*& APR_TailCopy + ) + ///////////////////////////////////////////////////// + { + // 총 AL_FarNum+1 개의 링크가 만들어짊 + + ZCLink* VP_MakeLink = 0 ; + ZCLink* VP_TailLink = 0 ; + + VP_TailLink = VP_MakeLink = + new ZCLink(**AP_LinkOrgin) ; + + APR_HeadCopy = VP_MakeLink; + + while(--AL_FarNum >= 0) + { + AP_LinkOrgin= AP_LinkOrgin->GetNextPtr(); + VP_MakeLink = new ZCLink(**AP_LinkOrgin); + + ZCLink::JoinLink + (VP_TailLink, VP_MakeLink); + + VP_TailLink = VP_MakeLink; + }/* + while(--AL_FarNum >= 0)*/ + + APR_TailCopy=VP_TailLink; + }/* + void NewLinkCopy ////////////////////////////////// + ( + ZCLink* AP_LinkOrgin, TypeSize AL_FarNum , + ZCLink*& APR_HeadCopy, ZCLink*& APR_TailCopy + ) + ///////////////////////////////////////////////////*/ + + + void DelLink(ZCLink* AP_DelLink) + { + delete AP_DelLink; + }/* + void DelLink(ZCLink* AP_DelLink)*/ + + void DelLink ////////////////////////////////////////// + ( + TypeSize AL_CutCnt , + ZCLink* AP_CutHead, + ZCLink* AP_CutTail + ) + /////////////////////////////////////////////////////// + { + ZCLink* VP_DelLink = AP_CutHead; + + __for0(TypeSize, i, AL_CutCnt) + { + AP_CutHead = AP_CutHead->GetNextPtr() ; + + delete VP_DelLink; VP_DelLink=AP_CutHead; + }/* + __for0(TypeSize, i, AL_CutCnt)*/ + } + /////////////////////////////////////////////////////// + + /*private:*/ + private: + + _VT_ ZCLink* SendFreeOut() + { + if(TTypeCRTP::ZEUseCRTP<1) return NewLink(); + + return GetChildObj().SendFreeOut(); + }/* + _VT_ ZCLink* SendFreeOut()*/ + + _VT_ ZCLink* SendFreeOut(ZCLink& AR_ArgData) { if(TTypeCRTP::ZEUseCRTP<1) - { return new ZCLink; } + { return NewLink(AR_ArgData); } - return GetChildObj().NewLink(); + return GetChildObj().SendFreeOut(AR_ArgData); }/* - _VT_ ZCLink* NewLink()*/ + _VT_ ZCLink* SendFreeOut(ZCLink& AR_ArgData)*/ - _VT_ void DelLink(ZCLink* AP_DelLink) + _VT_ ZCLink* SendFreeOut(const ZCLink& AR_ArgData) { if(TTypeCRTP::ZEUseCRTP<1) - { return delete ZCLink; } + { return NewLink(AR_ArgData); } - return GetChildObj().DelLink(AP_DelLink); + return GetChildObj().SendFreeOut(AR_ArgData); }/* - _VT_ void DelLink(ZCLink* AP_DelLink)*/ + _VT_ ZCLink* SendFreeOut(const ZCLink& AR_ArgData)*/ + _VT_ void SendFreeOut + (TypeSize AL_NeedCnt, ZCLink*& APR_HeadLink, ZCLink*& APR_TailLink) + { + if(TTypeCRTP::ZEUseCRTP<1) + { + NewLink(AL_NeedCnt, APR_HeadLink, APR_TailLink); return; + }/* + if(TTypeCRTP::ZEUseCRTP<1)*/ + + return GetChildObj().SendFreeOut + (AL_NeedCnt, RR(APR_HeadLink), RR(APR_TailLink)); + }/* + _VT_ void SendFreeOut + (TypeSize AL_NeedCnt, ZCLink*& APR_HeadLink, ZCLink*& APR_TailLink) + */ + + _VT_ void SendFreeOutCopy /*///////////////////////*/ + ( + ZCLink* AP_LinkOrgin, TypeSize AL_FarNum , + ZCLink*& APR_HeadCopy, ZCLink*& APR_TailCopy + ) + ///////////////////////////////////////////////////// + { + // 총 AL_FarNum+1 개의 링크가 만들어짊 + + if(TTypeCRTP::ZEUseCRTP<1) + { + NewLinkCopy(AP_LinkOrgin, AL_FarNum, APR_HeadCopy, APR_TailCopy); return; + }/* + if(TTypeCRTP::ZEUseCRTP<1)*/ + + return GetChildObj().SendFreeOutCopy + (AP_LinkOrgin, AL_FarNum, RR(APR_HeadCopy), RR(APR_TailCopy)); + }/* + _VT_ void SendFreeOutCopy ///////////////////////// + ( + ZCLink* AP_LinkOrgin, TypeSize AL_FarNum , + ZCLink*& APR_HeadCopy, ZCLink*& APR_TailCopy + ) + ///////////////////////////////////////////////////*/ + + + _VT_ void RecvFreeIn(ZCLink* AP_DelLink) + { + if(TTypeCRTP::ZEUseCRTP<1) + { DelLink(AP_DelLink); return; } + + GetChildObj().RecvFreeIn(AP_DelLink); + }/* + _VT_ void RecvFreeIn(ZCLink* AP_DelLink)*/ + + _VT_ void RecvFreeIn ////////////////////////////////// + ( + TypeSize AL_CutCnt , + ZCLink* AP_CutHead, + ZCLink* AP_CutTail + ) + /////////////////////////////////////////////////////// + { + if(TTypeCRTP::ZEUseCRTP<1) + { + DelLink + (AL_CutCnt, AP_CutHead, AP_CutTail); + return; + }/* + if(TTypeCRTP::ZEUseCRTP<1)*/ + + GetChildObj().RecvFreeIn(AL_CutCnt, AP_CutHead, AP_CutTail); + }/* + _VT_ void RecvFreeIn ////////////////////////////////// + ( + TypeSize AL_CutCnt , + ZCLink* AP_CutHead, + ZCLink* AP_CutTail + ) + /////////////////////////////////////////////////////*/ + + /*private:*/ private: ZCLink& JoinAfter(ZCLink& AR_LinkNew, ZCLink* AP_LinkStd) @@ -482,7 +1016,7 @@ namespace ZNsMain ZCLink::JoinLink(mp_TailLink, &AR_LinkNew); ZCLink::MakeRing(mp_HeadLink, &AR_LinkNew); - mp_HeadLink=&AR_LinkNew; + mp_TailLink=&AR_LinkNew; }/* else*/ } @@ -527,13 +1061,14 @@ namespace ZNsMain mp_TailLink = VP_NewTail ; } - else ZCLink::JoinLink(AR_CutLink. mp_PrevLink, AR_CutLink.mp_NextLink); + else ZCLink::JoinLink + (AR_CutLink. mp_PrevLink, AR_CutLink.mp_NextLink); return (--ml_LinkSize, AR_CutLink); }/* ZCLink& CutLink(ZCLink& AR_CutLink)*/ - + /*private:*/ public : ZtCLinkList() @@ -561,84 +1096,294 @@ namespace ZNsMain ZtCLinkList& operator=(const ZtCLinkList& rhs) { + if(this==&rhs) return *this; + + if(rhs.size()<1) + { this->DeleteAll(); return *this; } + + TypeSize VL_MinusSize = this->size() - rhs.size() ; + + if (VL_MinusSize>0) + { + RecvFreeIn //////////////////////////////////////// + ( + VL_MinusSize, + mp_HeadLink , + mp_HeadLink->GetNextPrevPtr(VL_MinusSize-1) + ); + /////////////////////////////////////////////////// + + ml_LinkSize -= VL_MinusSize; + } + else if(VL_MinusSize<0) + { + ZCLink* VP_HeadLink=0; + ZCLink* VP_TailLink=0; + + SendFreeOut //////////////////////////////////////// + ( + -VL_MinusSize , + RR(VP_HeadLink) , + RR(VP_TailLink) + ); + /////////////////////////////////////////////////// + + if(ml_LinkSize>0) + { + ZCLink::JoinLink(mp_TailLink, VP_HeadLink); + ZCLink::MakeRing(mp_HeadLink, VP_TailLink); + + mp_TailLink = VP_TailLink ; + } + else + { + mp_HeadLink = VP_HeadLink ; + mp_TailLink = VP_TailLink ; + + ZCLink::MakeRing(mp_HeadLink, VP_TailLink); + }/* + else*/ + + ml_LinkSize += (-VL_MinusSize); + }/* + else if(VL_MinusSize<0)*/ + + + ZCLink* VP_RhsLink = rhs.mp_HeadLink ; + ZCLink* VP_LhsLink = mp_HeadLink ; + + __for0(TypeSize, i, rhs.size()) + { + **VP_LhsLink = **VP_RhsLink ; + + VP_RhsLink = VP_RhsLink->mp_NextLink; + VP_LhsLink = VP_LhsLink->mp_NextLink; + }/* + __for0(TypeSize, i, rhs.size())*/ + return *this; }/* ZtCLinkList& operator=(const ZtCLinkList& rhs)*/ + TypeSize GetSize(){return ml_LinkSize;} + TypeSize size (){return ml_LinkSize;} + + void DeleteAll() { if(ml_LinkSize<1) return; - ZCLink VP_DelLink = mp_HeadLink; + RecvFreeIn + (ml_LinkSize, mp_HeadLink, mp_TailLink); - __for0(TypeSize, i, ml_LinkSize) - { - mp_HeadLink = mp_HeadLink->mp_NextLink; - - DelLink(VP_DelLink); VP_DelLink = mp_HeadLink; - }/* - __for0(TypeSize, i, ml_LinkSize)*/ - - mp_HeadLink=0; - mp_TailLink=0; - ml_LinkSize=0; + mp_HeadLink =0 ; + mp_TailLink =0 ; + ml_LinkSize =0 ; }/* void DeleteAll()*/ void clear(){DeleteAll();} + ZCObjOpt GetHeadOpt(){ return ZCObjOpt(mp_HeadLink); } + ZCObjOpt GetTailOpt(){ return ZCObjOpt(mp_TailLink); } + + ZCObjOpt GetObjOpt(TypeSize AI_Index) + { + if(ml_LinkSize<1) return ZCObjOpt(0); + + return ZCObjOpt( (*mp_HeadLink)+(AI_Index-1) ); + }/* + ZCObjOpt GetObjOpt(TypeSize AI_Index)*/ + + ZCLink& AddHead(){ return JoinAfter (*NewLink(), 0); } ZCLink& AddTail(){ return JoinBefore(*NewLink(), 0); } - void DelHead() - { if(ml_LinkSize<1) return; DelLink( CutLink(mp_HeadLink) ); } - void DelTail() - { if(ml_LinkSize<1) return; DelLink( CutLink(mp_TailLink) ); } + void DeleteHead() + { if(ml_LinkSize<1) return; RecvFreeIn( &CutLink(mp_HeadLink) ); } + void DeleteTail() + { if(ml_LinkSize<1) return; RecvFreeIn( &CutLink(mp_TailLink) ); } void Delete(ZCLink& AR_DelLink) { - DelLink( &CutLink(AR_DelLink) ); + RecvFreeIn( &CutLink(AR_DelLink) ); }/* void Delete(ZCLink& AR_DelLink)*/ - void SendOutAfter (ZCLink& AR_CutLink, ZtCObjList& rhs, ZCLink* AP_StdLink) + void SendOutAfter (ZCLink& AR_CutLink, ZtCLinkList& rhs, ZCLink* AP_StdLink) { // AR_CutLink 를 잘라서 rhs 의 AP_StdLink 뒤에 연결한다. // AP_StdLink==0 이면, rhs 의 앞에 삽입한다. CutLink(AR_CutLink); rhs.JoinAfter (AR_CutLink, AP_StdLink); }/* - void SendOutAfter (ZCLink& AR_CutLink, ZtCObjList& rhs, ZCLink* AP_StdLink)*/ + void SendOutAfter (ZCLink& AR_CutLink, ZtCLinkList& rhs, ZCLink* AP_StdLink)*/ - void SendOutBefore(ZCLink& AR_CutLink, ZtCObjList& rhs, ZCLink* AP_StdLink) + void SendOutBefore(ZCLink& AR_CutLink, ZtCLinkList& rhs, ZCLink* AP_StdLink) { // AR_CutLink 를 잘라서 rhs 의 AP_StdLink 앞에 연결한다. // AP_StdLink==0 이면, rhs 의 뒤에 삽입한다. CutLink(AR_CutLink); rhs.JoinBefore(AR_CutLink, AP_StdLink); }/* - void SendOutBefore(ZCLink& AR_CutLink, ZtCObjList& rhs, ZCLink* AP_StdLink)*/ + void SendOutBefore(ZCLink& AR_CutLink, ZtCLinkList& rhs, ZCLink* AP_StdLink)*/ - void SendOutHead(ZCLink& AR_CutLink, ZtCObjList& rhs) + void SendOutHead(ZCLink& AR_CutLink, ZtCLinkList& rhs) { // AR_CutLink 를 잘라서 rhs 의 앞에 연결한다. SendOutAfter (AR_CutLink, rhs, 0); } - void SendOutTail(ZCLink& AR_CutLink, ZtCObjList& rhs) + void SendOutTail(ZCLink& AR_CutLink, ZtCLinkList& rhs) { // AR_CutLink 를 잘라서 rhs 의 뒤에 연결한다. SendOutBefore(AR_CutLink, rhs, 0); }/* - void SendOutTail(ZCLink& AR_CutLink, ZtCObjList& rhs)*/ + void SendOutTail(ZCLink& AR_CutLink, ZtCLinkList& rhs)*/ + template void IterElement(TFunctor AO_Functor) + { + ZCLink* VP_LoopLink=mp_HeadLink; + + __for0(TypeSize, i, ml_LinkSize) + { + ZtCTypeData:: + GetObjRef(AO_Functor)( *VP_LoopLink ); + + VP_LoopLink = VP_LoopLink->mp_NextLink ; + }/* + __for0(TypeSize, i, ml_LinkSize)*/ + }/* + template void IterElement(TFunctor AO_Functor) */ + + + template + void IterElement(TFunctor AO_Functor, TTypeHelp AO_TypeHelp) + { + typedef ZNsMain:: + ZtCCheckRef ZCCheckRef; + + ZCLink* VP_LoopLink=mp_HeadLink; + + __for0(TypeSize, i, ml_LinkSize) + { + ZtCTypeData::GetObjRef(AO_Functor) + ( + *VP_LoopLink, ZCCheckRef::PassData(AO_TypeHelp) + ); + VP_LoopLink = VP_LoopLink->mp_NextLink ; + }/* + __for0(TypeSize, i, ml_Size)*/ + }/* + template + void IterElement(TFunctor AO_Functor, TTypeHelp AO_TypeHelp) */ + + + template + < typename TFunctor , typename TTypeHelp1 , typename TTypeHelp2 > + void IterElement + ( TFunctor AO_Functor, TTypeHelp1 AO_TypeHelp1, TTypeHelp2 AO_TypeHelp2 ) + /*#############################################################################*/ + { + typedef ZNsMain::ZtCCheckRef ZCCheckRef1; + typedef ZNsMain::ZtCCheckRef ZCCheckRef2; + + ZCLink* VP_LoopLink=mp_HeadLink; + + __for0(TypeSize, i, ml_LinkSize) + { + ZtCTypeData::GetObjRef(AO_Functor) + ( + *VP_LoopLink + , ZCCheckRef1::PassData(AO_TypeHelp1) + , ZCCheckRef2::PassData(AO_TypeHelp2) + ); + //////////////////////////////////////////// + + VP_LoopLink = VP_LoopLink->mp_NextLink ; + }/* + __for0(TypeSize, i, ml_Size)*/ + }/* + template + < typename TFunctor , typename TTypeHelp1 , typename TTypeHelp2 > + void IterElement + ( TFunctor AO_Functor, TTypeHelp1 AO_TypeHelp1, TTypeHelp2 AO_TypeHelp2 ) + ###############################################################################*/ + + + template void IterElemRev(TFunctor AO_Functor) + { + ZCLink* VP_LoopLink=mp_TailLink; + + __for0(TypeSize, i, ml_LinkSize) + { + ZtCTypeData:: + GetObjRef(AO_Functor)(*VP_LoopLink); + + VP_LoopLink = VP_LoopLink->mp_PrevLink ; + }/* + __for0(TypeSize, i, ml_Size)*/ + }/* + template void IterElemRev(TFunctor AO_Functor) */ + + template + void IterElemRev(TFunctor AO_Functor, TTypeHelp AO_TypeHelp) + { + typedef ZNsMain:: + ZtCCheckRef ZCCheckRef; + + ZCLink* VP_LoopLink = mp_TailLink; + + __for0(TypeSize, i, ml_LinkSize) + { + ZtCTypeData::GetObjRef(AO_Functor) + ( + *VP_LoopLink, ZCCheckRef::PassData(AO_TypeHelp) + ); + VP_LoopLink = VP_LoopLink->mp_PrevLink ; + }/* + __for0(TypeSize, i, ml_Size)*/ + }/* + template + void IterElemRev(TFunctor AO_Functor, TTypeHelp AO_TypeHelp) */ + + + template + < typename TFunctor , typename TTypeHelp1 , typename TTypeHelp2 > + void IterElemRev + ( TFunctor AO_Functor, TTypeHelp1 AO_TypeHelp1, TTypeHelp2 AO_TypeHelp2 ) + /*#############################################################################*/ + { + typedef ZNsMain::ZtCCheckRef ZCCheckRef1; + typedef ZNsMain::ZtCCheckRef ZCCheckRef2; + + ZCLink* VP_LoopLink = mp_TailLink; + + __for0(TypeSize, i, ml_LinkSize) + { + ZtCTypeData::GetObjRef(AO_Functor) + ( + *VP_LoopLink + , ZCCheckRef1::PassData(AO_TypeHelp1) + , ZCCheckRef2::PassData(AO_TypeHelp2) + ); + VP_LoopLink = VP_LoopLink->mp_PrevLink ; + }/* + __for0(TypeSize, i, ml_Size)*/ + }/* + template + < typename TFunctor , typename TTypeHelp1 , typename TTypeHelp2 > + void IterElemRev + ( TFunctor AO_Functor, TTypeHelp1 AO_TypeHelp1, TTypeHelp2 AO_TypeHelp2 ) + ###############################################################################*/ + public : };/* template ////////////////////////////////////////////////////////////////// diff --git a/ZCppMainTest/ZtCLinkList_000.cpp b/ZCppMainTest/ZtCLinkList_000.cpp new file mode 100644 index 0000000..22c49aa --- /dev/null +++ b/ZCppMainTest/ZtCLinkList_000.cpp @@ -0,0 +1,173 @@ + + +#include +#include +#include "ZCppMain/ZtCLinkList.H" + + +using namespace std ; +using namespace ZNsMain ; + + +namespace ZNsMain +{ + + namespace ZNsExam + { + + template class ZtCExamCLinkList + { + public: + typedef ZNsIFaceEx::ZtCLink ZCLinkCStr ; + typedef ZtCLinkList ZCLinkStrList; + typedef ZCLinkStrList::ZCObjOpt ZCStrLinkOpt ; + public: + + static void ShowNode0(ZCLinkCStr& AR_CLink, ZTypLong& ARRI_CallCnt) + { + ++ARRI_CallCnt; + + cout< class ZtCExamCLinkList*/ + + }/* + namespace ZNsExam*/ + +}/* +namespace ZNsMain*/ + + +int main(int AI_ArgCnt, char* APP_ArgVal[]) +{ + return ZNsMain::ZNsExam:: + + ZtCExamCLinkList<>::Main(AI_ArgCnt, APP_ArgVal); +}/* +int main(int AI_ArgCnt, char* APP_ArgVal[])*/ + + +/*//////////////////////////////////////////////////////////////////////////////////////// + + cygwin + + // g++ -mno-cygwin -o ZtCLinkList_000.exe ZtCLinkList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 + // g++ -mno-cygwin -o ZtCLinkList_000_D.exe ZtCLinkList_000.cpp -I../../my_CPP/CPP_Main/ -I../../my_CPP/CPP_Std/ -D__CYGWIN32__ -D__VISUAL_CPP_VER__=200300 -D_DEBUG + + mingw + + g++.exe -o ZtCLinkList_000_mw.exe ZtCLinkList_000.cpp -I../ -lWs2_32 + g++.exe -o ZtCLinkList_000_mw_D.exe ZtCLinkList_000.cpp -I../ -lWs2_32 -D_DEBUG + + ./ZtCLinkList_000_mw.exe + ./ZtCLinkList_000_mw_D.exe + + + Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest + # date + Sun Aug 24 10:47:09 KST 2025 + + Administrator@q381-2673 UCRT64 /e/my_CPP/ZCpp/ZCppMainTest + # g++ --version + g++.exe (Rev2, Built by MSYS2 project) 13.2.0 + Copyright (C) 2023 Free Software Foundation, Inc. + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + + Linux + + g++ -std=c++98 -o ZtCLinkList_000.exe ZtCLinkList_000.cpp -I../ + g++ -std=c++98 -o ZtCLinkList_000_D.exe ZtCLinkList_000.cpp -I../ -D_DEBUG + + sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ gcc --version + gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0 + Copyright (C) 2019 Free Software Foundation, Inc. + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ date + Sun Aug 24 00:05:51 DST 2025 + + sauron@q381-2673:/mnt/e/my_CPP/ZCpp/ZCppMainTest$ cat /etc/os-release + NAME="Ubuntu" + VERSION="20.04.6 LTS (Focal Fossa)" + ID=ubuntu + ID_LIKE=debian + PRETTY_NAME="Ubuntu 20.04.6 LTS" + VERSION_ID="20.04" + HOME_URL="https://www.ubuntu.com/" + SUPPORT_URL="https://help.ubuntu.com/" + BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" + PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" + VERSION_CODENAME=focal + UBUNTU_CODENAME=focal + + + [sauron@q381-2657 ZCppMainTest]$ cat /etc/centos-release + CentOS Linux release 7.9.2009 (Core) + + [sauron@q381-2657 ZCppMainTest]$ g++ --version + g++ (GCC) 4.8.5 20150623 (Red Hat 4.8.5-44) + Copyright (C) 2015 Free Software Foundation, Inc. + This is free software; see the source for copying conditions. There is NO + warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + + + ./ZtCLinkList_000.exe + ./ZtCLinkList_000_D.exe + +////////////////////////////////////////////////////////////////////////////////////////*/