PUMA Library Reference Manual
Loading...
Searching...
No Matches
Puma::BCList< Item, BUCKET_SIZE > Class Template Reference

#include <Puma/BCList.h>

+ Inheritance diagram for Puma::BCList< Item, BUCKET_SIZE >:

Description

template<class Item, int BUCKET_SIZE = 32>
class Puma::BCList< Item, BUCKET_SIZE >

List of fixed-size buckets.

A bucket is a fixed-size array that is filled sequentially. Each bucket is linked with the previous and next buckets forming a double linked list. Random access to list items is not supported.

Template Parameters
ItemThe list item type.
BUCKET_SIZEOptional size of each bucket. Defaults to 32.

Classes

class  Iterator
 Bucket list sequential iterator. More...
 

Public Member Functions

 BCList ()
 Construct an empty bucket list.
 
 ~BCList ()
 Destroy the bucket list.
 
Iterator begin ()
 Get an iterator pointing to the beginning of the list.
 
Iterator end () const
 Get an iterator pointing to the end of the list.
 
Iterator add (Item item)
 Add an item to the list.
 
void reset ()
 Reset the list.
 

Constructor & Destructor Documentation

◆ BCList()

template<class Item , int BUCKET_SIZE = 32>
Puma::BCList< Item, BUCKET_SIZE >::BCList ( )
inline

Construct an empty bucket list.

◆ ~BCList()

template<class Item , int BUCKET_SIZE = 32>
Puma::BCList< Item, BUCKET_SIZE >::~BCList ( )
inline

Destroy the bucket list.

Will not deleted the list items.

Member Function Documentation

◆ add()

template<class Item , int BUCKET_SIZE = 32>
Iterator Puma::BCList< Item, BUCKET_SIZE >::add ( Item item)
inline

Add an item to the list.

Parameters
itemThem item to add.
Returns
An iterator pointing to the new list item.

◆ begin()

template<class Item , int BUCKET_SIZE = 32>
Iterator Puma::BCList< Item, BUCKET_SIZE >::begin ( )
inline

Get an iterator pointing to the beginning of the list.

Returns
A new iterator pointing to the first list item.

◆ end()

template<class Item , int BUCKET_SIZE = 32>
Iterator Puma::BCList< Item, BUCKET_SIZE >::end ( ) const
inline

Get an iterator pointing to the end of the list.

This iterator does not point to the last list item. It is an empty iterator that is intended to be used for comparisons like this:

BCList<int>::Iterator idx = list.begin();
for (; idx != list.end(); ++idx) {
// do something
}
Bucket list sequential iterator.
Definition BCList.h:94
Returns
A new empty iterator.

◆ reset()

template<class Item , int BUCKET_SIZE = 32>
void Puma::BCList< Item, BUCKET_SIZE >::reset ( )
inline

Reset the list.

Will not delete the list items.