You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
406 B
30 lines
406 B
13 years ago
|
#ifndef OBJECT_POOL_HPP
|
||
|
#define OBJECT_POOL_HPP
|
||
|
|
||
|
#include "ConcurrentQueue.hpp"
|
||
|
|
||
|
template <typename T>
|
||
|
class ObjectPool
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
ObjectPool();
|
||
|
virtual ~ObjectPool();
|
||
|
|
||
|
void add(const T object);
|
||
|
void remove(const T object);
|
||
|
void clear();
|
||
|
|
||
|
T get();
|
||
|
virtual void reset(const T object) = 0;
|
||
|
void release(const T object);
|
||
|
|
||
|
|
||
|
private:
|
||
|
|
||
|
ConcurrentQueue<T> m_pool;
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif // OBJECT_POOL_HPP
|