45 os <<
"size=" << size() <<
'/' << capacity()
46 <<
" begin=" << begin_
65 end_ = elements.
size();
67 const label minLen = (end_ + min_size());
79 storage_ = std::move(elements);
92 const label len = this->size();
93 const auto list1 = this->array_one();
94 const auto list2 = this->array_two();
97 if (len != (list1.size() + list2.size()))
100 <<
"Size check failed"
105 if (
os.format() == IOstreamOption::BINARY && is_contiguous_v<T>)
109 os << nl << len << nl;
117 os.beginRawWrite(len*
sizeof(
T));
121 os.writeRaw(list1.cdata_bytes(), list1.size_bytes());
125 os.writeRaw(list2.cdata_bytes(), list2.size_bytes());
134 (len <= 1 || !shortLen)
145 os << len << token::BEGIN_LIST;
149 for (
const T& val : list1)
151 if (i++)
os << token::SPACE;
154 for (
const T& val : list2)
156 if (i++)
os << token::SPACE;
161 os << token::END_LIST;
168 os <<
nl << len <<
nl << token::BEGIN_LIST <<
nl;
171 for (
const T& val : list1)
175 for (
const T& val : list2)
181 os << token::END_LIST <<
nl;
constexpr CircularBuffer() noexcept
Default construct, empty buffer without allocation.
Ostream & info(Ostream &os) const
Print information.
label capacity() const noexcept
Size of the underlying storage.
label size() const noexcept
The current number of buffer items.
static constexpr label min_size() noexcept
Lower capacity limit.
SubList< T > array_two()
The contents of the second internal array.
Ostream & writeList(Ostream &os, const label shortLen=0) const
Write buffer contents with line-breaks in ASCII when length exceeds shortLen.
Istream & readList(Istream &is)
Read buffer contents from Istream.
SubList< T > array_one()
The contents of the first internal array.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
label capacity() const noexcept
Size of the underlying storage.
void resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content.
void setCapacity(const label len)
Alter the size of the underlying storage.
Istream & readList(Istream &is)
Read from Istream, discarding existing contents.
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
bool empty() const noexcept
True if List is empty (ie, size() is zero).
void size(const label n)
Older name for setAddressableSize.
@ BEGIN_LIST
Begin list [isseparator].
@ END_LIST
End list [isseparator].
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
OBJstream os(runTime.globalPath()/outputName)
errorManip< error > abort(error &err)
error FatalError
Error stream (stdout output on all processes), with additional 'FOAM FATAL ERROR' header text and sta...
constexpr bool is_contiguous_v
The is_contiguous value of Type (after stripping of qualifiers).
void T(FieldField< Field, Type > &f1, const FieldField< Field, Type > &f2)
constexpr char nl
The newline '\n' character (0x0a).
Can suppress additional line breaks separate ASCII data content when the data elements are primitives...