ucommon

ucommon/containers.h File Reference

Threadsafe object containers. More...

#include <ucommon/platform.h>
#include <ucommon/protocols.h>
#include <ucommon/linked.h>
#include <ucommon/memory.h>
#include <ucommon/thread.h>
Include dependency graph for containers.h:

Go to the source code of this file.

Data Structures

class  Buffer
 A thread-safe buffer for serializing and streaming class data. More...
class  bufferof< T >
 A templated typed class for buffering of objects. More...
class  linked_allocator< T >
 Linked allocator template to gather linked objects. More...
class  LinkedAllocator
 Linked allocator helper for linked_allocator template. More...
class  queue
 Manage a thread-safe queue of objects through reference pointers. More...
class  queueof< T >
 A templated typed class for thread-safe queue of object pointers. More...
class  stack
 Manage a thread-safe stack of objects through reference pointers. More...
class  stackof< T >
 A templated typed class for thread-safe stack of object pointers. More...

Typedefs

typedef queue fifo_t
 Convenience type for using thread-safe object fifo (queue).
typedef stack stack_t
 Convenience type for using thread-safe object stacks.

Functions

Objectpull (stack_t &stack, timeout_t timeout=Timer::inf)
 Convenience function to pull an object from a stack.
Objectpull (fifo_t &fifo, timeout_t timeout=Timer::inf)
 Convenience function to pull an object from a fifo.
void push (stack_t &stack, Object *object)
 Convenience function to push an object onto a stack.
void push (fifo_t &fifo, Object *object)
 Convenience function to push an object onto a fifo.
void remove (stack_t &stack, Object *object)
 Convenience function to remove an object from a stack.
void remove (fifo_t &fifo, Object *object)
 Convenience function to remove an object from a fifo.

Detailed Description

Threadsafe object containers.

This is used to better define object containers and manipulating classes which can be presumed to be fully threadsafe and thread-aware. This has to be defined separately to assure correct order of preceeding headers as well as to better organize the library for clarity. Most of these classes and templates work with classes derived from Object and LinkedObject and make use of conditional for time constrained acquisition of managed objects.

Definition in file containers.h.


Function Documentation

Object* pull ( stack_t stack,
timeout_t  timeout = Timer::inf 
) [inline]

Convenience function to pull an object from a stack.

Parameters:
stackto pull from.
timeoutto wait to pull.
Returns:
object pulled.

Definition at line 678 of file containers.h.

Here is the call graph for this function:

Object* pull ( fifo_t fifo,
timeout_t  timeout = Timer::inf 
) [inline]

Convenience function to pull an object from a fifo.

Parameters:
fifoto pull from.
timeoutto wait to pull.
Returns:
object pulled.

Definition at line 703 of file containers.h.

Here is the call graph for this function:

void push ( stack_t stack,
Object object 
) [inline]

Convenience function to push an object onto a stack.

Parameters:
stackto push into.
objectto push.
Examples:
linked.cpp.

Definition at line 669 of file containers.h.

Here is the call graph for this function:

void push ( fifo_t fifo,
Object object 
) [inline]

Convenience function to push an object onto a fifo.

Parameters:
fifoto push into.
objectto push.

Definition at line 694 of file containers.h.

Here is the call graph for this function:

void remove ( stack_t stack,
Object object 
) [inline]

Convenience function to remove an object from a stack.

Parameters:
stackto remove from.
objectto remove.

Definition at line 686 of file containers.h.

Here is the call graph for this function:

void remove ( fifo_t fifo,
Object object 
) [inline]

Convenience function to remove an object from a fifo.

Parameters:
fifoto remove from.
objectto remove.

Definition at line 711 of file containers.h.