1 /*******************************************************************************
2 
3     Base class for a queue storing raw ubyte data.
4 
5     Copyright:
6         Copyright (c) 2009-2016 dunnhumby Germany GmbH.
7         All rights reserved.
8 
9     License:
10         Boost Software License Version 1.0. See LICENSE_BOOST.txt for details.
11         Alternatively, this file may be distributed under the terms of the Tango
12         3-Clause BSD License (see LICENSE_BSD.txt for details).
13 
14 *******************************************************************************/
15 
16 module ocean.util.container.queue.model.IByteQueue;
17 
18 
19 
20 
21 import ocean.util.container.queue.model.IQueueInfo;
22 
23 import ocean.meta.types.Qualifiers;
24 
25 
26 /*******************************************************************************
27 
28     Base class for a queue storing raw ubyte data.
29 
30 *******************************************************************************/
31 
32 public interface IByteQueue : IQueueInfo
33 {
34     /***************************************************************************
35 
36         Removes all items from the queue.
37 
38     ***************************************************************************/
39 
40     public void clear ( );
41 
42 
43     /***************************************************************************
44 
45         Reserves space for an item of <size> bytes on the queue but doesn't
46         fill the content. The caller is expected to fill in the content using
47         the returned slice.
48 
49         Params:
50             size = size of the space of the item that should be reserved
51 
52         Returns:
53             slice to the reserved space if it was successfully reserved,
54             else null
55 
56     ***************************************************************************/
57 
58     public void[] push ( size_t size );
59 
60 
61     /***************************************************************************
62 
63         Pushes an item into the queue.
64 
65         Params:
66             item = data item to push
67 
68         Returns:
69             true if the item was pushed successfully, false if it didn't fit
70 
71     ***************************************************************************/
72 
73     public bool push ( in void[] item );
74 
75 
76     /***************************************************************************
77 
78         Pops an item from the queue.
79 
80         Returns:
81             item popped from queue, may be null if queue is empty
82 
83     ***************************************************************************/
84 
85     public void[] pop ( );
86 
87 
88     /***************************************************************************
89 
90         Peek at the next item that would be popped from the queue.
91 
92         Returns:
93             item that would be popped from queue, may be null if queue is empty
94 
95     ***************************************************************************/
96 
97     public void[] peek ( );
98 }
99