82 #ifndef Foam_OSpanStream_H 83 #define Foam_OSpanStream_H 110 virtual public std::ios,
115 typedef std::ostream stream_type;
161 auto view() const -> decltype(buffer_type::
view())
180 buffer_type::pubseekpos(0, std::ios_base::out);
185 void reset(
char* buffer,
size_t nbytes)
192 void reset(std::string&
s)
194 s.resize(
s.capacity());
216 class OSpanStreamAllocator
296 template<
int SizeMin>
340 void reset(
char* buffer,
size_t nbytes)
347 void reset(std::string&
s)
label size() const
The current output size. Same as tellp(), output_pos()
auto str() const -> decltype(stream_.str())
For OStringStream compatibility, return buffer as string copy.
Generic output stream using a standard (STL) stream.
std::streamsize span_capacity() const
The put buffer capacity.
An allocator for holding Foam::ospanstream.
void syncState()
Set stream state to match that of the std::ostream.
void resize(const label len)
Alter addressable list size, allocating new space if required while recovering old content...
std::streampos output_pos() const
The current output position within the buffer (tellp)
std::streamsize capacity() const
The put buffer capacity.
A simple container for options an IOstream can normally have.
char * data_bytes() const
The span data (start of output characters)
std::string str() const
For ostringstream compatibility, return the buffer as string copy.
void rewind()
Rewind the stream, clearing any old errors.
virtual void rewind()
Rewind the stream, clearing any old errors.
label capacity() const noexcept
Size of the underlying storage.
std::streamsize capacity() const
The put buffer capacity.
constexpr IOstreamOption(streamFormat fmt=streamFormat::ASCII, compressionType comp=compressionType::UNCOMPRESSED) noexcept
Default construct (ASCII, UNCOMPRESSED, currentVersion) or construct with format, compression...
void reset(char *buffer, size_t nbytes)
Reset the put buffer area.
A 1D vector of objects of type <T> that resizes itself as necessary to accept the new objects...
UList< char > list() const
Span of the current output characters (is modifiable!)
Foam::ospanstream stream_
The stream.
std::streampos tellp() const
Position of the put buffer.
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...
void debug_info(Ostream &os) const
Some information about the output buffer position/capacity.
void reset(char *buffer, size_t nbytes)
Reset the put area.
OBJstream os(runTime.globalPath()/outputName)
std::streamsize span_tellp() const
The current buffer put position.
void resetp(char *s, std::streamsize n)
Reset put buffer with character data (can be nullptr) and count.
UList< char > list() const
Span of the current output characters (is modifiable!)
std::streampos output_pos() const
The current output position within the buffer (tellp)
auto view() const -> decltype(buffer_type::view())
A string_view (c++17) or span view (older c++) of buffer contents.
OSpanStream(IOstreamOption streamOpt=IOstreamOption())
Default construct (empty output)
versionNumber version() const noexcept
Get the stream version.
stdFoam::span< const char > view() const
std::streamsize size_bytes() const
The span size (size of output buffer)
OSpanStreamAllocator()=default
Default construct (empty)
An output streambuf for memory access.
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))
Similar to std::ostringstream, but with an externally managed output buffer which makes it most simil...
Similar to OStringStream but using an externally managed buffer for its output.
streamFormat format() const noexcept
Get the current stream format.
virtual void print(Ostream &os) const override
Print stream description to Ostream.
ospanstream()
Default construct - empty.
auto view() const -> decltype(stream_.view())
A string_view (c++17) or span view (older c++) of buffer contents.