From 34af922d766585efdc8b7e2b69fd67eb88528ab3 Mon Sep 17 00:00:00 2001 From: Steve Reinhardt Date: Wed, 8 Oct 2003 22:12:01 -0700 Subject: [PATCH] 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 --- base/fifo_buffer.cc | 2 +- base/fifo_buffer.hh | 25 +++++++++---------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/base/fifo_buffer.cc b/base/fifo_buffer.cc index d0b59e832..c702d2999 100644 --- a/base/fifo_buffer.cc +++ b/base/fifo_buffer.cc @@ -30,7 +30,7 @@ template void -FifoBuffer::dump(void) +FifoBuffer::dump() { if (buffer->count() > 0) for (iterator i=buffer->tail(); i.notnull(); i=i.prev()) 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 FifoBuffer { +class FifoBuffer +{ public: typedef typename res_list::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; } }; -- 2.30.2