Go to the documentation of this file.
35 #ifndef memoryStreamBuffer_H
36 #define memoryStreamBuffer_H
39 #include <type_traits>
65 std::ios_base::seekdir way,
66 std::ios_base::openmode which = std::ios_base::in|std::ios_base::out
69 const bool testin = which & std::ios_base::in;
70 const bool testout = which & std::ios_base::out;
72 if (way == std::ios_base::beg)
76 setg(eback(), eback(), egptr());
81 setp(pbase(), epptr());
85 else if (way == std::ios_base::cur)
100 setg(eback(), eback(), egptr());
101 gbump(egptr() - eback() - off);
105 setp(pbase(), epptr());
106 pbump(epptr() - pbase() - off);
112 return (gptr() - eback());
116 return (pptr() - pbase());
127 std::ios_base::openmode which = std::ios_base::in|std::ios_base::out
130 return seekoff(
pos, std::ios_base::beg, which);
135 inline std::streamsize
tellg()
const
137 return (gptr() - eback());
141 inline std::streamsize
tellp()
const
143 return (pptr() - pbase());
170 virtual std::streamsize
xsgetn(
char*
s, std::streamsize
n)
172 std::streamsize
count = 0;
174 while (
count <
n && gptr() < egptr())
176 *(
s +
count++) = *(gptr());
187 in(
char*
s, std::streamsize
n)
194 inline void resetg(
char*
s, std::streamsize
n)
202 setg(
nullptr,
nullptr,
nullptr);
210 inline std::streamsize
capacity()
const
212 return (egptr() - eback());
230 os <<
"get=" << (gptr() - eback())
231 <<
"/" << (egptr() - eback());
251 virtual std::streamsize
xsputn(
const char*
s, std::streamsize
n)
253 std::streamsize
count = 0;
254 while (
count <
n && pptr() < epptr())
256 *(pptr()) = *(
s +
count++);
267 out(
char*
s, std::streamsize
n)
274 inline void resetp(
char*
s, std::streamsize
n)
282 setp(
nullptr,
nullptr);
290 inline std::streamsize
capacity()
const
292 return (epptr() - pbase());
310 os <<
"put=" << (pptr() - pbase())
311 <<
"/" << (epptr() - pbase());
const UList< char > list() const
Const UList access to the characters written (shallow copy).
in(char *s, std::streamsize n)
Construct for character array (can be nullptr) and number of bytes.
in()=default
Default construct.
std::streamsize capacity() const
The buffer capacity.
void printBufInfo(Ostream &os) const
Some information about the input buffer position/capacity.
out()=default
Default construct.
const UList< char > list() const
Const UList access to the input characters (shallow copy).
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))
UList< char > list()
Non-const UList access to the characters written (shallow copy).
UList< char > list()
Non-const UList access to the input characters (shallow copy).
void resetp(char *s, std::streamsize n)
Reset for character array (can be nullptr) and number of bytes.
std::streamsize capacity() const
The buffer capacity.
std::streamsize tellp() const
virtual std::streampos seekoff(std::streamoff off, std::ios_base::seekdir way, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out)
Set position pointer to relative position.
An input streambuf for memory access.
virtual std::streamsize xsgetn(char *s, std::streamsize n)
Get sequence of characters.
void resetg(char *s, std::streamsize n)
Reset for character array (can be nullptr) and number of bytes.
An output streambuf for memory access.
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
virtual std::streampos seekpos(std::streampos pos, std::ios_base::openmode which=std::ios_base::in|std::ios_base::out)
Set position pointer to absolute position.
void printBufInfo(Ostream &os) const
Some information about the output buffer position/capacity.
virtual std::streamsize xsputn(const char *s, std::streamsize n)
Put sequence of characters.
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
std::streamsize tellg() const
out(char *s, std::streamsize n)
Construct for character array (can be nullptr) and number of bytes.
dimensionedScalar pos(const dimensionedScalar &ds)