added ActiveMemoryBlockManager::GetOrCreate
This commit is contained in:
parent
cf1e0340f4
commit
56d98d65e2
@ -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();
|
||||
|
@ -181,6 +181,20 @@ namespace hgl
|
||||
return(true);
|
||||
}
|
||||
|
||||
bool ActiveMemoryBlockManager::GetOrCreate(int *da,const int count)
|
||||
{
|
||||
if(!da||count<=0)return(false);
|
||||
|
||||
if(GetIdleCount()<count)
|
||||
CreateIdle(nullptr,count-GetIdleCount());
|
||||
|
||||
if(!Get(da,count))
|
||||
return(false);
|
||||
|
||||
ReallocDataBlock();
|
||||
return(true);
|
||||
}
|
||||
|
||||
int ActiveMemoryBlockManager::Release(int *id,const int count)
|
||||
{
|
||||
return aim.Release(id,count);
|
||||
|
Loading…
x
Reference in New Issue
Block a user