94 #ifndef Foam_CircularBuffer_H 95 #define Foam_CircularBuffer_H 113 Ostream& 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);
257 const
T&
back() const;
265 inline
void reserve(const label len);
285 inline
bool contains(const
T& val) const;
297 label
find(const
T& val, label
pos = 0) const;
310 template<class... Args>
321 template<class... Args>
360 inline const
T&
operator[](const label i) const;
378 template<class AnyAddr>
424 using iterator_category = std::forward_iterator_tag;
441 return (*container_)[iter_];
459 return iter_ == rhs.iter_;
464 return iter_ != rhs.iter_;
472 inline const_iterator
cbegin()
const 474 return const_iterator(
this, 0);
478 inline const_iterator
cend()
const 480 return const_iterator(
this, this->
size());
484 inline const_iterator
begin()
const {
return cbegin(); }
487 inline const_iterator
end()
const {
return cend(); }
495 Istream&
operator>>(Istream& is, CircularBuffer<T>& rhs)
497 return rhs.readList(is);
504 Ostream& operator<<(Ostream& os, const CircularBuffer<T>& rhs)
506 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.
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 List obtained as a section of another List.
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...
OBJstream os(runTime.globalPath()/outputName)
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.
A simple forward const iterator for a circular buffer.
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...