94#ifndef Foam_CircularBuffer_H
95#define Foam_CircularBuffer_H
107template<
class T>
class CircularBuffer;
110Istream&
operator>>(Istream& is, CircularBuffer<T>& rhs);
113Ostream&
operator<<(Ostream&
os,
const CircularBuffer<T>& rhs);
138 inline label toGlobal(
const label i)
const;
141 inline label size_one()
const noexcept;
144 inline label size_two()
const noexcept;
149 void doReserve(
const bool nocopy,
const label len);
152 template<
class OtherListType>
153 inline void copyList(
const OtherListType& rhs);
258 const
T&
last() const;
266 inline
void reserve(const label len);
289 label
find(const
T& val, label
pos = 0) const;
295 inline
bool found(const
T& val, label
pos = 0) const;
368 template<
class AnyAddr>
431 return (*container_)[iter_];
449 return iter_ == rhs.iter_;
454 return iter_ != rhs.iter_;
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()
label difference_type
The difference between iterator objects.
T & first()
Access the first element (front). Requires !empty().
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.
bool empty() const noexcept
Empty or exhausted buffer.
void reserve_nocopy(const label len)
const T * const_pointer
The pointer type for const access to value_type items.
void append(const T &val)
Copy append an element to the end of the buffer.
T * pointer
The pointer type for non-const access to value_type items.
void clearStorage()
Clear the buffer and delete storage.
label appendUniq(const T &val)
Append an element if not already in the buffer.
void append(T &&val)
Move append an element to the end of the buffer.
Ostream & info(Ostream &os) const
Print information.
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.
static constexpr label min_size() noexcept
Lower capacity limit.
SubList< T > array_two()
The contents of the first internal array.
void reserve(const label len)
Ostream & writeList(Ostream &os, const label shortLen=0) const
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
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.
T & operator[](const label i)
Non-const access to an element in the list.
T & last()
Access the last element (back). Requires !empty().
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 List obtained as a section of another List.
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)
dimensionedScalar pos(const dimensionedScalar &ds)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Istream & operator>>(Istream &, directionInfo &)