diff --git a/inc/hgl/type/ActiveMemoryBlockManager.h b/inc/hgl/type/ActiveMemoryBlockManager.h index febd313..0bce2a1 100644 --- a/inc/hgl/type/ActiveMemoryBlockManager.h +++ b/inc/hgl/type/ActiveMemoryBlockManager.h @@ -52,6 +52,7 @@ namespace hgl int CreateIdle(int *da,const int count=1); bool Get(int *da,const int count=1); + bool GetOrCreate(int *da,const int count=1); int Release(int *id,const int count=1); int ReleaseAllActive(); diff --git a/src/Type/ActiveMemoryBlockManager.cpp b/src/Type/ActiveMemoryBlockManager.cpp index e73c77b..ab2393f 100644 --- a/src/Type/ActiveMemoryBlockManager.cpp +++ b/src/Type/ActiveMemoryBlockManager.cpp @@ -181,6 +181,20 @@ namespace hgl return(true); } + bool ActiveMemoryBlockManager::GetOrCreate(int *da,const int count) + { + if(!da||count<=0)return(false); + + if(GetIdleCount()