From: Steve Reinhardt Date: Thu, 9 Oct 2003 05:12:01 +0000 (-0700) Subject: Really only need one set of fifo_buffer.hh,cc files (not two!). Merge the best of... X-Git-Tag: m5_1.0_beta1~76 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=34af922d766585efdc8b7e2b69fd67eb88528ab3;p=gem5.git 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 --- 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; } };