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));}