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_
100 caddr_t buf, head, tail;
101 unsigned count, limit;
109 Buffer(
size_t size,
size_t count);
120 unsigned getSize(
void);
126 unsigned getCount(
void);
147 void put(
void *data);
170 void copy(
void *data);
187 void *peek(
unsigned item);
294 size_t getCount(
void);
313 {
return queue.
post(
object, timeout);};
322 {
return queue.
fifo(timeout);};
331 {
return queue.
lifo(timeout);};
425 size_t getCount(
void);
444 {
return stack.
push(
object, timeout);};
453 {
return stack.
pull(timeout);};
483 for(
unsigned i = 0; i < size; ++i)
484 array[i].enlist(&freelist);
491 {
return static_cast<T *
>(LinkedAllocator::get());};
494 {
return static_cast<T *
>(LinkedAllocator::get(timeout));};
520 Buffer(sizeof(T), count) {};
528 {
return static_cast<T*
>(
get());};
536 {
return static_cast<T*
>(
get(timeout));};
543 inline void put(T *
object)
553 {
return put(
object, timeout);};
570 {
return copy(
object, timeout);};
578 inline T *peek(
unsigned item)
579 {
return static_cast<T *
>(Buffer::peek(item));};
587 inline T *operator[](
unsigned item)
588 {
return static_cast<T *
>(queue::peek(item));};
617 inline bool remove(T *object)
647 inline T *peek(
unsigned offset = 0)
648 {
return static_cast<T *
>(stack::peek(offset));};
656 inline T *operator[](
unsigned offset)
657 {
return static_cast<T *
>(stack::peek(offset));};
686 inline bool remove(T *object)
698 {
return queue::post(
object);};
708 {
return static_cast<T *
>(queue::fifo(timeout));};
718 {
return static_cast<T *
>(queue::lifo(timeout));};
726 inline T *peek(
unsigned offset = 0)
727 {
return static_cast<T *
>(queue::peek(offset));};
735 inline T *operator[](
unsigned offset)
736 {
return static_cast<T *
>(queue::peek(offset));};
756 {stack.
push(
object);}
765 {
return stack.
pull(timeout);}
790 {
return fifo.
fifo(timeout);}
798 {fifo.remove(
object);}