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