add ClearActive() in Pool template.

This commit is contained in:
hyzboy 2020-07-24 20:24:10 +08:00
parent b003585d43
commit eba0d78617
2 changed files with 12 additions and 0 deletions

View File

@ -139,6 +139,17 @@ namespace hgl
}
}
template<typename T>
void Pool<T>::ClearActive()
{
T *p=Active.GetData();
int ac=Active.GetCount();
Inactive.Push(p,ac);
Active.ClearData();
}
template<typename T>
void Pool<T>::ClearInactive()
{

View File

@ -58,6 +58,7 @@ namespace hgl
bool IsActive(const T &data)const{return Active.IsExist(data);}
bool IsInactive(const T &data)const{return Inactive.IsExist(data);}
virtual void ClearActive(); ///<清除所有活跃的
virtual void ClearInactive(); ///<清除所有空闲的
virtual void ClearAll(); ///<清除所有的
};//template<typename T> class Pool