/simpletypesystem/trunk

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/simpletypesystem/trunk

« back to all changes in this revision

Viewing changes to libssts/RingBuffer.h

  • Committer: Gustav Hartvigsson
  • Date: 2015-10-10 20:47:43 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20151010204743-8zo3k1gip6apj1sl
* Working on RingBuffer and Stream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 * empty slots in an array, only permit indirect, non-indexed access.
25
25
 *
26
26
 <pre>
27
 
    [_|_|_|_|_|_|_|_|_|_| | | | ]
 
27
    [b|b|b|b|b|b|b|b|b|b| | | | ]
28
28
     ^                 ^
29
29
     start             end
30
 
 </pre>
31
 
 
32
 
 <pre>
33
 
    [ | | | | | |_|_|_|_| | | | ]
 
30
     front             back
 
31
 
 
32
 
 
33
 
 
34
    [ | | | | | |b|b|b|b| | | | ]
34
35
                 ^     ^
35
36
             start     end
36
 
 </pre>
37
 
 
38
 
 <pre>
39
 
    [_|_| | | | | | | |_|_|_|_|_]
 
37
             front     back
 
38
 
 
39
 
 
40
 
 
41
    [b|b| | | | | | | |b|b|b|b|b]
40
42
       ^               ^
41
43
     end             start
 
44
     back            front
42
45
 </pre>
43
46
 */
44
47
 
65
68
s_ring_buffer_free (SRingBuffer * self);
66
69
 
67
70
/**
68
 
 * Add data to the SRingBuffer.
69
 
 * 
70
 
 */
71
 
void
72
 
s_ring_buffer_push (SRingBuffer * self, sbyte data);
73
 
 
74
 
/**
75
 
 * 
76
 
 */
77
 
void
78
 
s_ring_buffer_push_front (SRingBuffer * self, sbyte);
79
 
 
 
71
 * determine 
 
72
 */
 
73
sboolean
 
74
s_ring_buffer_is_empty (SRingBuffer * self);
 
75
 
 
76
/**
 
77
 * Add data to the front of the ringbuffer.
 
78
 * 
 
79
 */
 
80
void
 
81
s_ring_buffer_push (SRingBuffer * self,
 
82
                    sbyte data);
 
83
 
 
84
/**
 
85
 * add an item to the back of the ringbuffer.
 
86
 */
 
87
void
 
88
s_ring_buffer_push_back (SRingBuffer * self,
 
89
                         sbyte data);
 
90
 
 
91
/**
 
92
 * Pop an item from the front of the array.
 
93
 */
80
94
sbyte
81
95
s_ring_buffer_pop (SRingBuffer * self);
82
96
 
83
97
/**
84
 
 * 
 
98
 * Pop the back of the array.
85
99
 */
86
100
sbyte
87
 
s_ring_buffer_pop_front (SRingBuffer * self);
 
101
s_ring_buffer_pop_back (SRingBuffer * self);
88
102
 
89
103
/**
90
104
 * Reallocate an SRingBuffer to a now size for the internal array.
93
107
 * @param len The new length.
94
108
 */
95
109
void
96
 
s_ring_buffer_realloc (SRingBuffer * self, size_t len);
 
110
s_ring_buffer_realloc (SRingBuffer * self,
 
111
                       size_t len);
97
112
 
98
113
/**
99
114
 * Get the current length of the ring buffer.