From 19fd9dc403610e913bb8bed37ba3d57123fac0bf Mon Sep 17 00:00:00 2001 From: hyzboy Date: Wed, 20 Mar 2024 19:50:42 +0800 Subject: [PATCH] added SerialsPool<> --- datatype/DataBlockTest.cpp | 47 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/datatype/DataBlockTest.cpp b/datatype/DataBlockTest.cpp index f089937..02762b9 100644 --- a/datatype/DataBlockTest.cpp +++ b/datatype/DataBlockTest.cpp @@ -7,6 +7,53 @@ using namespace std; using namespace hgl; +template class SerialsPool +{ + T MaxCount; ///<最大数量 + T *Serials; ///<序列数据 + T *EndPointer,*AccessPointer; ///<结束指针,访问指针 + +public: + + Serials(const T &count) + { + MaxCount=count; + Serials=new T[MaxCount]; + EndPointer=Serials+MaxCount; + AccessPointer=EndPointer; + + for(T i=0;i=EndPointer) + return(false); + + *AccessPointer=s; + ++AccessPointer; + + return(true); + } +};//template class Serials + /** * 数据块管理器 */