Open Model Railroad Network (OpenMRN)
Loading...
Searching...
No Matches
Bucket Class Reference

This is a struct for storing info about a specific size item in the DynamicPool. More...

#include <Buffer.hxx>

Inheritance diagram for Bucket:
Q Atomic

Public Member Functions

size_t size ()
 Get the size of the bucket.
 
QMemberexecutables ()
 Pull out any pending Executables.
 
- Public Member Functions inherited from Q
 Q ()
 Default Constructor.
 
 ~Q ()
 Default destructor.
 
Atomiclock ()
 
void insert (QMember *item, unsigned index=0)
 Add an item to the back of the queue.
 
void insert_locked (QMember *item, unsigned index=0)
 Add an item to the back of the queue.
 
QMembernext (unsigned index)
 Get an item from the front of the queue.
 
Result next ()
 Get an item from the front of the queue.
 
Result next_locked ()
 Get an item from the front of the queue.
 
size_t pending (unsigned index)
 Get the number of pending items in the queue.
 
size_t pending ()
 Get the number of pending items in the queue.
 
bool empty (unsigned index)
 Test if the queue is empty.
 
bool empty ()
 Test if the queue is empty.
 

Static Public Member Functions

static Bucketinit (int s,...)
 Allocate a Bucket array off of the heap initialized with sizes.
 
static void destroy (Bucket *bucket)
 destroy a bucket created with init.
 

Public Attributes

size_t allocCount_ {0}
 total entries allocated
 

Private Member Functions

 Bucket (size_t size)
 Constructor.
 
 ~Bucket ()
 Destructor.
 

Private Attributes

size_t size_
 size of entry
 
Q pending_
 list of anyone waiting for an item in the bucket
 

Detailed Description

This is a struct for storing info about a specific size item in the DynamicPool.

Definition at line 396 of file Buffer.hxx.

Constructor & Destructor Documentation

◆ Bucket()

Bucket::Bucket ( size_t  size)
inlineprivate

Constructor.

Definition at line 466 of file Buffer.hxx.

◆ ~Bucket()

Bucket::~Bucket ( )
inlineprivate

Destructor.

Definition at line 475 of file Buffer.hxx.

Member Function Documentation

◆ destroy()

static void Bucket::destroy ( Bucket bucket)
inlinestatic

destroy a bucket created with init.

Parameters
bucketBucket array to destroy

Definition at line 442 of file Buffer.hxx.

◆ executables()

QMember * Bucket::executables ( )
inline

Pull out any pending Executables.

Returns
next Qmember pending on an item in the bucket

Definition at line 458 of file Buffer.hxx.

◆ init()

static Bucket * Bucket::init ( int  s,
  ... 
)
inlinestatic

Allocate a Bucket array off of the heap initialized with sizes.

Parameters
ssize of first bucket
...'0' terminated list of additional buckets
Returns
array of allocated buckets.
Todo:
(Stuart Baker) fix such that sizes do not need to be in strict ascending order

Definition at line 406 of file Buffer.hxx.

◆ size()

size_t Bucket::size ( )
inline

Get the size of the bucket.

Returns
size of bucket

Definition at line 450 of file Buffer.hxx.

Member Data Documentation

◆ allocCount_

size_t Bucket::allocCount_ {0}

total entries allocated

Definition at line 481 of file Buffer.hxx.

◆ pending_

Q Bucket::pending_
private

list of anyone waiting for an item in the bucket

Definition at line 484 of file Buffer.hxx.

◆ size_

size_t Bucket::size_
private

size of entry

Definition at line 479 of file Buffer.hxx.


The documentation for this class was generated from the following file: