commit 2025-10-04 22:55 is writing ZCppMain/ZtCLinkList.H
This commit is contained in:
313
ZCppMain/ZtCLinkList.H
Normal file
313
ZCppMain/ZtCLinkList.H
Normal file
@ -0,0 +1,313 @@
|
||||
|
||||
|
||||
#ifndef __ZCPPMAIN__ZMAINHEAD_H__
|
||||
#define __ZCPPMAIN__ZMAINHEAD_H__
|
||||
|
||||
|
||||
#include "ZCppMain/ZMainHead.H"
|
||||
|
||||
|
||||
namespace ZNsMain
|
||||
{
|
||||
|
||||
template
|
||||
<typename TCLink, typename TTypSize>
|
||||
class ZtCLinkList;
|
||||
|
||||
|
||||
template
|
||||
<typename TTypBase, typename TChild>
|
||||
class ZtCLink : public TTypBase
|
||||
{
|
||||
public :
|
||||
template
|
||||
<typename TCLink, typename TTypSize>
|
||||
friend class ZtCLinkList;
|
||||
public :
|
||||
typedef ZtCLink TypeThis ;
|
||||
typedef TTypBase TypeBase ;
|
||||
typedef TChild TypeChild;
|
||||
protected:
|
||||
ZtCLink* mp_NextLink;
|
||||
ZtCLink* mp_PrevLink;
|
||||
protected:
|
||||
|
||||
ZtCLink* GetNextLinkPtr(){return mp_NextLink;}
|
||||
ZtCLink* GetPrevLinkPtr(){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 ZtCLink& rhs)
|
||||
{
|
||||
mp_NextLink=0;
|
||||
mp_PrevLink=0;
|
||||
|
||||
*(TypeBase*)(this) = rhs ;
|
||||
}/*
|
||||
ZtCLink(const ZtCLink& rhs)*/
|
||||
|
||||
ZtCLink& operator=(const ZtCLink& rhs)
|
||||
{
|
||||
static_cast<TypeBase&>(*this) =
|
||||
static_cast<TypeBase&>( rhs ) ;
|
||||
|
||||
return *this;
|
||||
}/*
|
||||
ZtCLink& operator=(const ZtCLink& rhs)*/
|
||||
|
||||
public :
|
||||
};/*
|
||||
template
|
||||
<typename TTypBase, typename TChild>
|
||||
class ZtCLink : public TTypBase
|
||||
*/
|
||||
|
||||
template<typename TTypBase>
|
||||
class ZtCLink<TTypBase, ZCEmpty> : public TTypBase
|
||||
{
|
||||
public :
|
||||
template
|
||||
<typename TCLink, typename TTypSize>
|
||||
friend class ZtCLinkList;
|
||||
public :
|
||||
typedef ZtCLink<TTypBase, ZCEmpty> TypeThis ;
|
||||
typedef TTypBase /*+++++++++++++*/ TypeBase ;
|
||||
typedef ZCEmpty /*+++++++++++++*/ TypeChild;
|
||||
protected:
|
||||
ZtCLink* mp_NextLink;
|
||||
ZtCLink* mp_PrevLink;
|
||||
public :
|
||||
|
||||
ZtCLink* GetNextLinkPtr(){return mp_NextLink;}
|
||||
ZtCLink* GetPrevLinkPtr(){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<TTypBase, ZCEmpty>()
|
||||
{
|
||||
mp_NextLink=0;
|
||||
mp_PrevLink=0;
|
||||
}/*
|
||||
ZtCLink<TTypBase, ZCEmpty>()*/
|
||||
|
||||
ZtCLink<TTypBase, ZCEmpty>(const TypeThis& rhs)
|
||||
{
|
||||
mp_NextLink=0;
|
||||
mp_PrevLink=0;
|
||||
|
||||
*(TypeBase*)(this) = rhs ;
|
||||
}/*
|
||||
ZtCLink<TTypBase, ZCEmpty>(const TypeThis& rhs)*/
|
||||
|
||||
TypeThis& operator=(const TypeThis& rhs)
|
||||
{
|
||||
static_cast<TypeBase&>(*this) =
|
||||
static_cast<TypeBase&>( rhs ) ;
|
||||
|
||||
return *this;
|
||||
}/*
|
||||
TypeThis& operator=(const TypeThis& rhs)*/
|
||||
|
||||
public :
|
||||
};/*
|
||||
template<typename TTypBase>
|
||||
class ZtCLink<TTypBase, ZCEmpty> : public TTypBase*/
|
||||
|
||||
|
||||
template<typename TChild> class ZtCLink<ZCEmpty, TChild>
|
||||
{
|
||||
public :
|
||||
template
|
||||
<typename TCLink, typename TTypSize>
|
||||
friend class ZtCLinkList;
|
||||
public :
|
||||
typedef ZtCLink<ZCEmpty, TChild> TypeThis ;
|
||||
typedef ZCEmpty /*++++++++++++*/ TypeBase ;
|
||||
typedef TChild /*++++++++++++*/ TypeChild;
|
||||
protected:
|
||||
ZtCLink* mp_NextLink;
|
||||
ZtCLink* mp_PrevLink;
|
||||
protected:
|
||||
|
||||
ZtCLink* GetNextLinkPtr(){return mp_NextLink;}
|
||||
ZtCLink* GetPrevLinkPtr(){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<ZCEmpty, TChild>()
|
||||
{
|
||||
mp_NextLink=0;
|
||||
mp_PrevLink=0;
|
||||
}/*
|
||||
ZtCLink<ZCEmpty, TChild>()*/
|
||||
|
||||
ZtCLink<ZCEmpty, TChild>(const TypeThis& rhs)
|
||||
{
|
||||
mp_NextLink=0;
|
||||
mp_PrevLink=0;
|
||||
}/*
|
||||
ZtCLink<ZCEmpty, TChild>(const TypeThis& rhs)*/
|
||||
|
||||
TypeThis& operator=(const TypeThis& rhs)
|
||||
{
|
||||
return *this;
|
||||
}/*
|
||||
TypeThis& operator=(const TypeThis& rhs)*/
|
||||
|
||||
public :
|
||||
};/*
|
||||
template<typename TChild> class ZtCLink<ZCEmpty, TChild>*/
|
||||
|
||||
|
||||
template<> class ZtCLink<ZCEmpty, ZCEmpty>
|
||||
{
|
||||
public :
|
||||
template
|
||||
<typename TCLink, typename TTypSize>
|
||||
friend class ZtCLinkList;
|
||||
public :
|
||||
typedef ZtCLink<ZCEmpty, ZCEmpty> TypeThis ;
|
||||
typedef ZCEmpty /*++++++++++++*/ TypeBase ;
|
||||
typedef ZCEmpty /*++++++++++++*/ TypeChild;
|
||||
protected:
|
||||
ZtCLink* mp_NextLink;
|
||||
ZtCLink* mp_PrevLink;
|
||||
protected:
|
||||
|
||||
ZtCLink* GetNextLinkPtr(){return mp_NextLink;}
|
||||
ZtCLink* GetPrevLinkPtr(){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<ZCEmpty, ZCEmpty>()
|
||||
{
|
||||
mp_NextLink=0;
|
||||
mp_PrevLink=0;
|
||||
}/*
|
||||
ZtCLink<ZCEmpty, ZCEmpty>()*/
|
||||
|
||||
ZtCLink<ZCEmpty, ZCEmpty>(const TypeThis& rhs)
|
||||
{
|
||||
mp_NextLink=0;
|
||||
mp_PrevLink=0;
|
||||
}/*
|
||||
ZtCLink<ZCEmpty, ZCEmpty>(const TypeThis& rhs)*/
|
||||
|
||||
TypeThis& operator=(const TypeThis& rhs)
|
||||
{
|
||||
return *this;
|
||||
}/*
|
||||
TypeThis& operator=(const TypeThis& rhs)*/
|
||||
|
||||
public :
|
||||
};/*
|
||||
template<> class ZtCLink<ZCEmpty, ZCEmpty>*/
|
||||
|
||||
|
||||
|
||||
template
|
||||
<typename TCLink, typename TTypSize=ZTypLong>
|
||||
class ZtCLinkList
|
||||
{
|
||||
public :
|
||||
typedef TCLink ZCLink ;
|
||||
typedef TCLink TypeData;
|
||||
typedef TTypSize TypeSize;
|
||||
private:
|
||||
ZCLink* mp_HeadLink;
|
||||
ZCLink* mp_TailLink;
|
||||
TypeSize ml_LinkSize;
|
||||
private:
|
||||
|
||||
public :
|
||||
|
||||
ZtCLinkList()
|
||||
{
|
||||
mp_HeadLink=0;
|
||||
mp_TailLink=0;
|
||||
ml_LinkSize=0;
|
||||
}/*
|
||||
ZtCLinkList()*/
|
||||
|
||||
|
||||
// is adding codes
|
||||
|
||||
|
||||
public :
|
||||
};/*
|
||||
template
|
||||
<typename TCLink, typename TTypSize=ZTypLong>
|
||||
class ZtCLinkList*/
|
||||
|
||||
}/*
|
||||
namespace ZNsMain*/
|
||||
|
||||
|
||||
#endif //__ZCPPMAIN__ZMAINHEAD_H__
|
Reference in New Issue
Block a user