27 #ifndef _UCOMMON_REUSE_H_ 28 #define _UCOMMON_REUSE_H_ 30 #ifndef _UCOMMON_THREAD_H_ 36 typedef unsigned short vectorsize_t;
49 unsigned count,
limit, used;
56 ArrayReuse(
size_t objsize,
unsigned c,
void *memory);
65 bool avail(
void)
const;
82 unsigned limit, count;
91 bool avail(
void)
const;
129 inline operator bool()
const {
146 return static_cast<T*>(ArrayReuse::request());
155 return static_cast<T*>(ArrayReuse::get());
164 return init<T>(static_cast<T*>(ArrayReuse::get()));
173 inline T*
get(timeout_t timeout) {
174 return static_cast<T*>(ArrayReuse::get(timeout));
184 return init<T>(static_cast<T*>(ArrayReuse::get(timeout)));
200 inline operator T*() {
241 inline operator bool()
const {
242 return PagerReuse::avail();
250 return !PagerReuse::avail();
259 return static_cast<T*>(PagerReuse::get());
269 return init<T>(static_cast<T*>(PagerReuse::get()));
278 inline T *
get(timeout_t timeout) {
279 return static_cast<T*>(PagerReuse::get(timeout));
290 return init<T>(static_cast<T*>(PagerReuse::get(timeout)));
298 return static_cast<T*>(PagerReuse::request());
323 inline operator T*() {
A mempager source of reusable objects.
Class for resource bound memory pools between threads.
array_reuse(unsigned count)
Create private heap of reusable objects of specified type.
T * create(void)
Get a typed object from the pager heap.
Mempager managed type factory for pager pool objects.
A reusable private pool of reusable types.
bool operator!() const
Test if the entire heap has been allocated.
T * create(timeout_t timeout)
Create a typed object from the heap.
bool operator!() const
Test if no objects are available for reuse or the pager.
T * get(timeout_t timeout)
Get a typed object from the heap.
void release(T *object)
Release (return) a typed object back to the pager heap for re-use.
void release(T *object)
Release (return) a typed object back to the heap for re-use.
T &() limit(T &value, T &low, T &high)
Convenience macro to range restrict values.
T * request(void)
Request immediately next available typed object from the pager heap.
array_reuse(unsigned count, void *memory)
Create reusable objects of specific type in preallocated memory.
Thread classes and sychronization objects.
T * operator *()
Get a typed object from the pager heap by type casting reference.
void release(ReusableObject *object)
Release resuable object.
A managed private heap for small allocations.
Reusable objects for forming private heaps.
An array of reusable objects.
T * get(void)
Get a typed object from the pager heap.
T * create(timeout_t timeout)
Create a typed object from the heap.
Common namespace for all ucommon objects.
T * get(timeout_t timeout)
Get a typed object from the heap.
T * request(void)
Request immediately next available typed object from the heap.
T * create(void)
Create a typed object from the heap.
An array of reusable types.
paged_reuse(mempager *pager, unsigned count)
Create a managed reusable typed object pool.
A redirection base class for the memory protocol.
T * operator *()
Get a typed object from the heap by pointer reference.
T * get(void)
Get a typed object from the heap.