diff --git a/inc/hgl/type/DataChain.h b/inc/hgl/type/DataChain.h index 53b8a37..8cce2f2 100644 --- a/inc/hgl/type/DataChain.h +++ b/inc/hgl/type/DataChain.h @@ -84,9 +84,11 @@ namespace hgl public: - DataChain(const int mc); + DataChain(); virtual ~DataChain()=default; + bool Init(const int mc); ///<初始化数据链 + UserNode *Acquire(const int acquire_count); ///<请求一个数据区块 bool Release(UserNode *ud); ///<释放一个数据区块 };//class DataChain diff --git a/inc/hgl/type/DataStackPool.h b/inc/hgl/type/DataStackPool.h index 7a54740..b7e10a2 100644 --- a/inc/hgl/type/DataStackPool.h +++ b/inc/hgl/type/DataStackPool.h @@ -24,11 +24,19 @@ namespace hgl public: - DataStackPool(const int max_count):series(max_count) + DataStackPool() + { + data_array=nullptr; + end=nullptr; + } + + bool Init(const int max_count) { data_array=hgl_zero_new(max_count); end=data_array+max_count; + + series.Init(max_count); } ~DataStackPool() diff --git a/src/Type/DataChain.cpp b/src/Type/DataChain.cpp index ec60c27..0e4fe14 100644 --- a/src/Type/DataChain.cpp +++ b/src/Type/DataChain.cpp @@ -2,11 +2,21 @@ namespace hgl { - DataChain::DataChain(const int mc):series(mc),node_pool(mc),ud_pool(mc) + DataChain::DataChain() + { + max_count=0; + free_count=0; + } + + bool DataChain::Init(const int mc) { max_count=mc; free_count=mc; + series.Init(mc); + node_pool.Init(mc); + ud_pool.Init(mc); + ud_set.PreAlloc(mc); start=node_pool.Acquire();