summaryrefslogtreecommitdiff
path: root/base/fifo_buffer.hh
diff options
context:
space:
mode:
authorSteve Reinhardt <stever@eecs.umich.edu>2003-10-08 22:12:01 -0700
committerSteve Reinhardt <stever@eecs.umich.edu>2003-10-08 22:12:01 -0700
commit34af922d766585efdc8b7e2b69fd67eb88528ab3 (patch)
tree98c2296d8711af11f19506803e814f53a13226da /base/fifo_buffer.hh
parentee3b92235f8628132f7cf05700563785d7256b55 (diff)
downloadgem5-34af922d766585efdc8b7e2b69fd67eb88528ab3.tar.xz
Really only need one set of fifo_buffer.hh,cc files (not two!). Merge the best of both.
base/fifo_buffer.cc: base/fifo_buffer.hh: style --HG-- extra : convert_revision : 829a36362dd8ba9ae92ca5e3f7381eb5b300c964
Diffstat (limited to 'base/fifo_buffer.hh')
-rw-r--r--base/fifo_buffer.hh25
1 files changed, 9 insertions, 16 deletions
diff --git a/base/fifo_buffer.hh b/base/fifo_buffer.hh
index 27b4973ac..75690d36c 100644
--- a/base/fifo_buffer.hh
+++ b/base/fifo_buffer.hh
@@ -37,7 +37,8 @@
// constructor and a dump() method
//
template<class T>
-class FifoBuffer {
+class FifoBuffer
+{
public:
typedef typename res_list<T>::iterator iterator;
@@ -59,23 +60,15 @@ class FifoBuffer {
buffer->add_head(item);
}
- iterator head(void) { return buffer->head(); }
- iterator tail(void) { return buffer->tail(); }
+ iterator head() { return buffer->head(); }
+ iterator tail() { return buffer->tail(); }
- unsigned count(void) {return buffer->count();}
- unsigned free_slots(void) {return buffer->num_free();}
+ unsigned count() {return buffer->count();}
+ unsigned free_slots() {return buffer->num_free();}
- T * peek(void)
- {
- if (count() > 0) {
- return tail().data_ptr();
- }
- else {
- return 0;
- }
- }
+ T *peek() { return (count() > 0) ? tail().data_ptr() : 0; }
- T remove(void)
+ T remove()
{
assert(buffer->count() > 0);
T rval = *buffer->tail();
@@ -83,7 +76,7 @@ class FifoBuffer {
return rval;
}
- void dump(void);
+ void dump();
~FifoBuffer() { delete buffer; }
};