94#ifndef Foam_CircularBuffer_H
95#define Foam_CircularBuffer_H
137 inline label toGlobal(
const label i)
const;
140 inline label size_one()
const noexcept;
143 inline label size_two()
const noexcept;
148 void doReserve(
const bool nocopy,
const label len);
151 template<
class OtherListType>
152 inline void copyList(
const OtherListType&
rhs);
256 const
T&
back() const;
264 inline
void reserve(const label len);
284 inline
bool contains(const
T& val) const;
296 label
find(const
T& val, label
pos = 0) const;
309 template<class... Args>
320 template<class... Args>
355 inline
T& operator[](const label i);
359 inline const
T& operator[](const label i) const;
368 inline
void operator=(const
T& val);
374 inline
void operator=(const
UList<
T>&
rhs);
377 template<class AnyAddr>
423 using iterator_category = std::forward_iterator_tag;
440 return (*container_)[iter_];
458 return iter_ ==
rhs.iter_;
463 return iter_ !=
rhs.iter_;
477 inline const_iterator
cend()
const
479 return const_iterator(
this, this->
size());
496 return rhs.readList(is);
505 return rhs.writeList(
os);
A simple forward const iterator for a circular buffer.
const_iterator operator++(int)
std::forward_iterator_tag iterator_category
const_iterator(const CircularBuffer< T > *buffer, label i)
const_iterator(const const_iterator &)=default
bool operator!=(const const_iterator &rhs) const
bool operator==(const const_iterator &rhs) const
const_iterator & operator=(const const_iterator &)=default
const_iterator & operator++()
reference operator*() const
A simple list of objects of type <T> that is intended to be used as a circular buffer (eg,...
label size_type
The type to represent the size of a buffer.
void pop_front(label n=1)
Shrink by moving the front of the buffer 1 or more times.
void clear() noexcept
Clear the addressed buffer, does not change allocation.
labelRange range_one() const noexcept
The addressing range covered by array_one().
T & emplace_front(Args &&... args)
Construct an element at the front of the buffer, return reference to the new element.
label difference_type
The difference between iterator objects.
void pop_back(label n=1)
Shrink by moving the end of the buffer 1 or more times.
T value_type
The value type the list contains.
constexpr CircularBuffer() noexcept
Default construct, empty buffer without allocation.
const_iterator begin() const
Return a const_iterator at begin of buffer.
void reverse()
Reverse the buffer order, swapping elements.
const_iterator cbegin() const
Return a const_iterator at begin of buffer.
T & emplace_back(Args &&... args)
Construct an element at the end of the buffer, return reference to the new element.
bool empty() const noexcept
Empty or exhausted buffer.
bool contains(const T &val) const
True if the value is contained in the list.
void reserve_nocopy(const label len)
Reserve allocation space for at least this size, allocating new space if required without retaining o...
T & back()
Access the last element (back). Requires !empty().
const T * const_pointer
The pointer type for const access to value_type items.
T * pointer
The pointer type for non-const access to value_type items.
void clearStorage()
Clear the buffer and delete storage.
Ostream & info(Ostream &os) const
Print information.
label push_uniq(const T &val)
Append an element if not already in the buffer.
label capacity() const noexcept
Size of the underlying storage.
label find(const T &val, label pos=0) const
Find index of the first occurrence of the value.
const_iterator cend() const
Return a const_iterator at end of buffer.
label size() const noexcept
The current number of buffer items.
T & reference
The type used for storing into value_type objects.
void push_back(const T &val)
Copy append an element to the end of the buffer.
T & front()
Access the first element (front). Requires !empty().
static constexpr label min_size() noexcept
Lower capacity limit.
SubList< T > array_two()
The contents of the second internal array.
List< T > list() const
Return a copy of the buffer flattened into a single List. Use sparingly!
void reserve(const label len)
Reserve allocation space for at least this size, allocating new space if required and retaining old c...
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write buffer contents with line-breaks in ASCII when length exceeds shortLen.
labelRange range_two() const noexcept
The addressing range covered by array_two().
void swap(CircularBuffer< T > &other)
Swap content, independent of sizing parameter.
label space() const noexcept
The nominal space available to fill. Subtract 1 for the number to append before re-balancing is neede...
void push_front(const T &val)
Copy prepend an element to the front of the buffer.
const_iterator end() const
Return a const_iterator at end of buffer.
Istream & readList(Istream &is)
Read buffer contents from Istream.
void operator=(const CircularBuffer< T > &list)
Copy construct.
SubList< T > array_one()
The contents of the first internal array.
const T & const_reference
The type used for reading from constant value_type objects.
Base for lists with indirect addressing, templated on the list contents type and the addressing type....
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
A non-owning sub-view of a List (allocated or unallocated storage).
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
A range or interval of labels defined by a start and a size.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
OBJstream os(runTime.globalPath()/outputName)
bool operator!=(const eddy &a, const eddy &b)
dimensionedScalar pos(const dimensionedScalar &ds)
void reverse(UList< T > &list, const label n)
Reverse the first n elements of the list.
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Istream & operator>>(Istream &, directionInfo &)
void rhs(fvMatrix< typename Expr::value_type > &m, const Expr &expression)
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
triangles reserve(surf.size())
Foam::argList args(argc, argv)