29 #ifndef _UCOMMON_CONTAINERS_H_
30 #define _UCOMMON_CONTAINERS_H_
32 #ifndef _UCOMMON_CONFIG_H_
36 #ifndef _UCOMMON_PROTOCOLS_H_
40 #ifndef _UCOMMON_LINKED_H_
44 #ifndef _UCOMMON_MEMORY_H_
48 #ifndef _UCOMMON_THREAD_H_
99 size_t bufsize, objsize;
100 caddr_t buf, head, tail;
101 unsigned objcount,
limit;
109 Buffer(
size_t typesize,
size_t count);
135 void put(
void *data);
158 void copy(
void *data);
175 void *peek(
unsigned item);
177 virtual void *invalid(
void)
const;
190 unsigned count(
void);
405 for(
unsigned i = 0; i < size; ++i)
406 array[i].enlist(&freelist);
413 {
return static_cast<T *
>(LinkedAllocator::get());};
416 {
return static_cast<T *
>(LinkedAllocator::get(timeout));};
442 Buffer(sizeof(T), capacity) {};
450 {
return static_cast<T*
>(
get());};
458 {
return static_cast<T*
>(
get(timeout));};
465 inline void put(T *
object)
475 {
return put(
object, timeout);};
492 {
return copy(
object, timeout);};
500 inline const T&
at(
unsigned item)
501 {
return static_cast<const T&
>(Buffer::peek(item));};
510 {
return static_cast<T&
>(Buffer::peek(item));};
512 inline T* operator()(
unsigned offset = 0)
513 {
return static_cast<T*
>(Buffer::peek(offset));}
541 inline bool remove(T *object)
542 {
return Stack::remove(
object);};
553 {
return Stack::push(
object);};
563 {
return static_cast<T *
>(Stack::pull(timeout));};
572 {
return static_cast<const T *
>(Stack::peek(timeout));};
574 inline T* operator()(
unsigned offset = 0)
575 {
return static_cast<T*
>(Stack::get(offset));}
583 inline const T&
at(
unsigned offset = 0)
584 {
return static_cast<const T&
>(Stack::get(offset));};
593 {
return static_cast<T&
>(Stack::get(offset));};
622 inline bool remove(T *object)
623 {
return Queue::remove(
object);};
634 {
return Queue::post(
object);};
644 {
return static_cast<T *
>(Queue::fifo(timeout));};
654 {
return static_cast<T *
>(Queue::lifo(timeout));};
662 inline const T&
at(
unsigned offset = 0)
663 {
return static_cast<const T&
>(Queue::get(offset));};
672 {
return static_cast<T&
>(Queue::get(offset));};
674 inline T* operator()(
unsigned offset = 0)
675 {
return static_cast<T*
>(Queue::get(offset));}
The conditional is a common base for other thread synchronizing classes.
Linked allocator template to gather linked objects.
A thread-safe buffer for serializing and streaming class data.
Queue fifo_t
Convenience type for using thread-safe object fifo (queue).
Various miscellaneous platform specific headers and defines.
queueof(mempager *memory, size_t size=0)
Create templated queue of typed objects.
const T & at(unsigned offset=0)
Examine past item in the stack.
const T & at(unsigned offset=0)
Examine past item in the queue.
T * pull(timeout_t timeout=0)
Get and remove last typed object posted to the stack.
A managed private heap for small allocations.
Common base class for all objects that can be formed into a linked list.
A linked object base class for ordered objects.
bufferof(unsigned capacity)
Create a buffer to hold a series of typed objects.
bool push(T *object, timeout_t timeout=0)
Push a typed object into the stack by it's pointer.
void put(T *object)
Put (copy) a typed object into the buffer.
const T * peek(timeout_t timeout=0)
Examine last typed object posted to the stack.
void copy(T *object)
Copy the next typed object from the buffer.
const T & operator[](unsigned offset)
Examine past item in the stack.
A common base class for all managed objects.
void release(SharedAccess &object)
Convenience function to unlock shared object through it's protocol.
Linked objects, lists, templates, and containers.
An index container for maintaining an ordered list of objects.
T &() limit(T &value, T &low, T &high)
Convenience macro to range restrict values.
A templated typed class for thread-safe stack of object pointers.
bool put(T *object, timeout_t timeout)
Put (copy) an object into the buffer.
unsigned count(void) const
Count of objects this list manages.
Stack stack_t
Convenience type for using thread-safe object stacks.
T * lifo(timeout_t timeout=0)
Get and remove last typed object posted to the queue.
Thread classes and sychronization objects.
const T & at(unsigned item)
Examine past item in the buffer.
Mempager managed type factory for pager pool objects.
ObjectProtocol * copy(ObjectProtocol *object)
Convenience function to access object copy.
unsigned long timeout_t
Typedef for millisecond timer values.
A templated typed class for thread-safe queue of object pointers.
Linked allocator helper for linked_allocator template.
Manage a thread-safe stack of objects through reference pointers.
T & operator[](unsigned offset)
Examine past item in the queue.
stackof(mempager *memory, size_t size=0)
Create templated stack of typed objects.
A templated typed class for buffering of objects.
Abstract interfaces and support.
T & operator[](unsigned item)
Examine past item in the buffer.
Private heaps, pools, and associations.
bool post(T *object, timeout_t timeout=0)
Post a typed object into the queue by it's pointer.
T * fifo(timeout_t timeout=0)
Get and remove first typed object posted to the queue.
Manage a thread-safe queue of objects through reference pointers.