From 66660bfb3c18f365625a6e28c3c0140c76f3ab61 Mon Sep 17 00:00:00 2001 From: sauron Date: Fri, 3 Oct 2025 23:48:53 +0900 Subject: [PATCH] commit 2025-10-03 23:48 add capacity() & size_free() in ZtCBaseList : ZCppMain/ZMainHead.H --- ZCppMain/ZMainHead.H | 61 ++++++++++------------------------------ ZCppMain/ZtCObjList.H | 6 +++- ZCppMain/ZtCSimList.H | 25 +++++----------- ZCppMainTest/ZtCBaseList_000.cpp | 31 ++++++++++++++++++++ 4 files changed, 58 insertions(+), 65 deletions(-) diff --git a/ZCppMain/ZMainHead.H b/ZCppMain/ZMainHead.H index 530b967..7418f7f 100644 --- a/ZCppMain/ZMainHead.H +++ b/ZCppMain/ZMainHead.H @@ -4,6 +4,7 @@ ■ unsigned 정수형은 가급적이면 쓰지 말자. 일반적으로 많이 쓰는 signed 정수와의 호환이 '약간' 거슬리고 있는데, 이 '약간' 이라도 왠지 찝찝하다. 2008-09-14 03:24:00 + ■ 해당 namespace 에서 필요한 상수는 그 namespace 안에서 상수전용 namespace ZNsConst 를 만들고 그 안에 둔다. @@ -4111,12 +4112,6 @@ namespace ZNsMain }/* _NP_ TypeSize size() const*/ - _NP_ TypeSize capacity() const - { - return GetAllHeapSize(); - }/* - _NP_ TypeSize capacity() const*/ - public: };/* template class ZtCBody*/ @@ -4283,31 +4278,14 @@ namespace ZNsMain }/* _NP_ TypeSize GetUseHeapSize() const*/ - _NP_ TypeSize GetAllHeapSize() const - { - return 0; - }/* - _NP_ TypeSize GetAllHeapSize() const*/ - _NP_ TypeSize size() const { return GetUseHeapSize(); }/* - _NP_ TypeSize GetHeapSize() const*/ - - _NP_ TypeSize capacity() const - { - return GetAllHeapSize(); - }/* - _NP_ TypeSize capacity() const*/ - - - _NP_ void ChangeCapacity(TypeSize AI_AddCut) - { - }/* - _NP_ void ChangeCapacity(TypeSize AI_AddCut)*/ + _NP_ TypeSize size() const*/ + public: };/* template class ZtCBody*/ @@ -4435,31 +4413,13 @@ namespace ZNsMain }/* _NP_ TypeSize GetUseHeapSize() const*/ - _NP_ TypeSize GetAllHeapSize() const - { - return 0; - }/* - _NP_ TypeSize GetAllHeapSize() const*/ - - _NP_ TypeSize size() const { return GetUseHeapSize(); }/* TypeSize size() const*/ - _NP_ TypeSize capacity() const - { - return GetAllHeapSize(); - }/* - _NP_ TypeSize capacity() const*/ - - - _NP_ void ChangeCapacity(TypeSize AI_AddCut) - { - }/* - _NP_ void ChangeCapacity(TypeSize AI_AddCut)*/ - + public: };/* template class ZtCBody*/ @@ -5800,9 +5760,9 @@ namespace ZNsMain TypeData& AddHead() - { return AddHeadLink(SendFreeOut())->mo_DataObjt; } + { return **AddHeadLink(SendFreeOut()); } TypeData& AddTail() - { return AddTailLink(SendFreeOut())->mo_DataObjt; } + { return **AddTailLink(SendFreeOut()); } TypeData& AddHead(TypeArg AO_ArgData) /*########################*/ @@ -6087,6 +6047,15 @@ namespace ZNsMain TypeSize size() const{ return ml_LinkSize; } TypeSize GetSize() const{ return ml_LinkSize; } + _VT_ TypeSize capacity () + { if(TTypeCRTP::ZEUseCRTP<1) return 0; + return GetChildObj().capacity (); + } + _VT_ TypeSize size_free() + { if(TTypeCRTP::ZEUseCRTP<1) return 0; + return GetChildObj().size_free(); + } + void push_front(TypeArg AO_ArgData){AddHead(AO_ArgData);} void push_back (TypeArg AO_ArgData){AddTail(AO_ArgData);} diff --git a/ZCppMain/ZtCObjList.H b/ZCppMain/ZtCObjList.H index a774434..e8c87c7 100644 --- a/ZCppMain/ZtCObjList.H +++ b/ZCppMain/ZtCObjList.H @@ -1413,10 +1413,14 @@ namespace ZNsMain TypeSize GetSize () const{return ml_LinkSize;} TypeSize size () const{return ml_LinkSize;} - TypeSize capacity() const{return size()+mo_FreeObjt.size();} + + TypeSize capacity() const + { return size()+mo_FreeObjt.size(); } TypeSize GetFreeSize() const { return mo_FreeObjt.size(); } + TypeSize size_free () const + { return mo_FreeObjt.size(); } ZCLink* GetHeadLinkPtr(){return mp_HeadLink;} diff --git a/ZCppMain/ZtCSimList.H b/ZCppMain/ZtCSimList.H index 586a2b4..c570eea 100644 --- a/ZCppMain/ZtCSimList.H +++ b/ZCppMain/ZtCSimList.H @@ -2055,28 +2055,17 @@ namespace ZNsMain inline TTypSize GetSize() const - { - return ml_LinkSize; - }/* - inline TTypSize GetSize() const*/ - - inline TTypSize size() const - { - return ml_LinkSize; - }/* - inline TTypSize size() const*/ + { return ml_LinkSize; } + inline TTypSize size () const + { return ml_LinkSize; } inline TTypSize capacity() const - { - return size()+mo_FreeObjt.size(); - }/* - inline TTypSize capacity() const*/ + { return size()+mo_FreeObjt.size(); } inline TypeSize GetFreeSize() const - { - return mo_FreeObjt.size(); - }/* - inline TypeSize GetFreeSize() const*/ + { return mo_FreeObjt.size(); } + inline TypeSize size_free () const + { return mo_FreeObjt.size(); } inline bool IsEmpty() const diff --git a/ZCppMainTest/ZtCBaseList_000.cpp b/ZCppMainTest/ZtCBaseList_000.cpp index 73b5ae9..1ee6eb5 100644 --- a/ZCppMainTest/ZtCBaseList_000.cpp +++ b/ZCppMainTest/ZtCBaseList_000.cpp @@ -113,6 +113,20 @@ namespace ZNsMain typedef typename ZCBaseList::ZCLink ZCLink; + public : + + _VT_ ZTypLong capacity() const + { + cout<<"** ZCBaseListEx10 : capacity()"<