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++);
274 inline void resetp(
char*
s, std::streamsize
n)
282 setp(
nullptr,
nullptr);
290 inline std::streamsize
capacity()
const 292 return (epptr() - pbase());
296 inline const UList<char>
list()
const 298 return UList<char>(pbase(), (pptr() - pbase()));
310 os <<
"put=" << (pptr() - pbase())
311 <<
"/" << (epptr() - pbase());
const UList< char > list() const
Const UList access to the characters written (shallow copy).
out()=default
Default construct.
void printBufInfo(Ostream &os) const
Some information about the input buffer position/capacity.
std::streamsize tellp() const
dimensionedScalar pos(const dimensionedScalar &ds)
unsigned int count(const UList< bool > &bools, const bool val=true)
Count number of 'true' entries.
std::streamsize capacity() const
The buffer capacity.
void resetp(char *s, std::streamsize n)
Reset for character array (can be nullptr) and number of bytes.
An output streambuf for memory access.
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.
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.
virtual std::streamsize xsgetn(char *s, std::streamsize n)
Get sequence of characters.
virtual std::streamsize xsputn(const char *s, std::streamsize n)
Put sequence of characters.
A 1D vector of objects of type <T>, where the size of the vector is known and can be used for subscri...
void resetg(char *s, std::streamsize n)
Reset for character array (can be nullptr) and number of bytes.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
constexpr auto end(C &c) -> decltype(c.end())
Return iterator to the end of the container c.
OBJstream os(runTime.globalPath()/outputName)
std::streamsize tellg() const
void printBufInfo(Ostream &os) const
Some information about the output buffer position/capacity.
in()=default
Default construct.
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))
const UList< char > list() const
Const UList access to the input characters (shallow copy).
std::streamsize capacity() const
The buffer capacity.