Go to the documentation of this file.
75 constexpr
static int min_size(
int n)
94 inline void minCapacity
96 const std::streamsize
n,
97 const std::streamsize cur = 0
100 const auto newEnd =
n + cur;
101 if (newEnd > storage_.size())
105 (storage_.size() + block_)
106 - (storage_.size() % block_)
109 while (newCapacity < newEnd)
111 newCapacity += block_;
120 storage_.
resize(newCapacity);
129 const auto prev = block_;
130 block_ = min_size(i);
134 minCapacity(0, tellp());
139 virtual int overflow(
int c = EOF)
144 minCapacity(block_, tellp());
154 virtual std::streamsize xsputn(
const char*
s, std::streamsize
n)
157 minCapacity(
n, tellp());
159 std::streamsize
count = 0;
160 while (
count <
n && pptr() < epptr())
162 *(pptr()) = *(
s +
count++);
170 void init_pbuffer(
const std::streamsize
n)
182 dynbuf(
size_t nbytes = 512)
186 init_pbuffer(min_size(nbytes));
192 storage_(std::move(buffer))
194 init_pbuffer(block_);
198 template<
int SizeMin>
201 storage_(std::move(buffer))
203 init_pbuffer(block_);
212 return storage_.size();
217 inline void sync_pbuffer()
219 resetp(storage_.data(), storage_.size());
232 const auto cur = tellp();
242 const auto cur = tellp();
244 storage_.swap(other);
250 template<
int SizeMin>
253 const auto cur = tellp();
255 storage_.swap(other);
288 buf_(std::move(buffer)),
293 template<
int SizeMin>
296 buf_(std::move(buffer)),
305 os <<
"put=" <<
buf_.tellp()
306 <<
"/" <<
buf_.capacity()
307 <<
" block=" <<
buf_.block_;
334 inline label
size()
const
340 inline void reserve(
const std::streamsize
n)
343 const auto cur =
buf_.tellp();
353 return buf_.setBlockSize(
n);
363 template<
int SizeMin>
385 buf_.pubseekpos(0, std::ios_base::out);
442 template<
int SizeMin>
468 #ifdef Foam_IOstream_extras
503 template<
int SizeMin>
506 DynamicList<char,SizeMin>&& buffer,
void resize(const label len)
void reserve(const std::streamsize n)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
void resize(const label len)
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects.
void printBufInfo(Ostream &os) const
streamFormat format() const noexcept
static const versionNumber currentVersion
An output stream that writes to a List and manages the List storage. Similar to OStringStream but wit...
OListStreamAllocator(size_t nbytes=512)
const UList< char > list() const
void setCapacity(const label len)
OListStream(IOstreamOption streamOpt=IOstreamOption())
OSstream(const OSstream &)=default
The IOstreamOption is a simple container for options an IOstream can normally have.
Generic output stream using a standard (STL) stream.
versionNumber version() const noexcept
constexpr const T & max(const T &a, const T &b)
OBJstream os(runTime.globalPath()/outputName)
OListStreamAllocator(DynamicList< char, SizeMin > &&buffer)
virtual void print(Ostream &os) const
unsigned int count(const UList< bool > &bools, const bool val=true)
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void swap(DynamicList< char, SizeMin > &other)
const dimensionedScalar c
OListStreamAllocator(List< char > &&buffer)
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
void swap(List< char > &other)