Click
Loading...
Searching...
No Matches
bufferpoolnode.hh
1/*
2 * bufferpoolnode.hh - Class used to manage a buffer obtained via a BufferPool
3 *
4 * Romain Gaillard.
5 */
6
7#ifndef MIDDLEBOX_BUFFERPOOLNODE_HH
8#define MIDDLEBOX_BUFFERPOOLNODE_HH
9
10#include <click/vector.hh>
11
12CLICK_DECLS
13
21{
22 friend class BufferPool;
23public:
27 BufferPoolNode(uint32_t initialSize);
28
32
38 unsigned char* getBuffer();
39
43 uint32_t getSize() const;
44
51 void resize(uint32_t newSize);
52
53private:
54 // We use a Vector as it provides a contiguous area of memory that can be resized at will
56 BufferPoolNode* nextNode;
57};
58
59CLICK_ENDDECLS
60
61#endif
Class used to provide a pool of buffers that can have a dynamic size and be resized at any moment.
Definition bufferpool.hh:25
Class used to manage a buffer obtained via a BufferPool.
Definition bufferpoolnode.hh:21
uint32_t getSize() const
Return the size of the buffer.
Definition bufferpoolnode.cc:29
void resize(uint32_t newSize)
Resize the buffer. This operation is efficient if the capacity of the buffer is greater than the requ...
Definition bufferpoolnode.cc:34
~BufferPoolNode()
Destruct a BufferPoolNode.
Definition bufferpoolnode.cc:19
unsigned char * getBuffer()
Return the actual buffer (the area of memory). Note that the size of the buffer is random,...
Definition bufferpoolnode.cc:24
Vector template.
Definition vector.hh:111
Click's vector container template.