From 540c2343a44b823c0060ab9ab1bdc4d55f01e66d Mon Sep 17 00:00:00 2001 From: Josh Blum Date: Sun, 16 Dec 2012 11:41:26 -0800 Subject: work ont he circ buffer impl --- include/gras/buffer_queue.hpp | 38 ++++++++++++++++++++++++++++++++++---- 1 file changed, 34 insertions(+), 4 deletions(-) (limited to 'include/gras') diff --git a/include/gras/buffer_queue.hpp b/include/gras/buffer_queue.hpp index 5125555..da8de41 100644 --- a/include/gras/buffer_queue.hpp +++ b/include/gras/buffer_queue.hpp @@ -18,11 +18,41 @@ typedef boost::shared_ptr BufferQueueSptr; struct BufferQueue { - //! Create a buffer queue using the pool allocator - GRAS_API static BufferQueueSptr make_pool(const SBufferConfig &config, const size_t num_buffs); + /*! + * Create a buffer queue object using the pool allocator. + * A pool of buffers contains individual buffer allocations. + * + * The config param is used to pass information + * about per-buffer size, affinity, and token. + * + * \param config used to alloc one buffer + * \param num_buffs alloc this many buffs + * \return a new buffer queue sptr + */ + GRAS_API static BufferQueueSptr make_pool( + const SBufferConfig &config, + const size_t num_buffs + ); - //! Create a buffer queue using the circular buffer allocator - GRAS_API static BufferQueueSptr make_circ(const SBufferConfig &config); + /*! + * Create a buffer queue object using the circular allocator. + * The circular allocator contains one large double-mapped buffer. + * This buffer is virtually mapped so that buff[n+len] = buff[n]. + * + * Pieces of this buffer can be passed around in smaller chunks. + * The number of chunks is dictated by num_buffs, + * the size of the chunks is dictated by config.length. + * The size of the circular buffer will be num_buffs*config.length + * + * \param config used to alloc one buffer + * \param num_buffs this many smaller chunks + * + * \return a new buffer queue sptr + */ + GRAS_API static BufferQueueSptr make_circ( + const SBufferConfig &config, + const size_t num_buffs + ); //! Get a reference to the buffer at the front of the queue virtual SBuffer &front(void) = 0; -- cgit