35 #ifndef Foam_memoryStreamBuffer_H 36 #define Foam_memoryStreamBuffer_H 39 #include <type_traits> 62 std::ios_base::seekdir way,
63 std::ios_base::openmode which = std::ios_base::in|std::ios_base::out
66 const bool testin = which & std::ios_base::in;
67 const bool testout = which & std::ios_base::out;
69 if (way == std::ios_base::beg)
73 setg(eback(), eback(), egptr());
78 setp(pbase(), epptr());
82 else if (way == std::ios_base::cur)
97 setg(eback(), eback(), egptr());
98 gbump(egptr() - eback() - off);
102 setp(pbase(), epptr());
103 pbump(epptr() - pbase() - off);
109 return (gptr() - eback());
113 return (pptr() - pbase());
124 std::ios_base::openmode which = std::ios_base::in|std::ios_base::out
127 return seekoff(
pos, std::ios_base::beg, which);
132 inline std::streamsize
tellg()
const 134 return (gptr() - eback());
138 inline std::streamsize
tellp()
const 140 return (pptr() - pbase());
167 virtual std::streamsize
xsgetn(
char*
s, std::streamsize
n)
169 std::streamsize
count = 0;
171 while (
count <
n && gptr() < egptr())
173 *(
s +
count++) = *(gptr());
184 in(
char*
s, std::streamsize
n)
191 inline void resetg(
char*
s, std::streamsize
n)
199 setg(
nullptr,
nullptr,
nullptr);
207 inline std::streamsize
capacity()
const 209 return (egptr() - eback());
227 os <<
"get=" << (gptr() - eback())
228 <<
"/" << (egptr() - eback());
248 virtual std::streamsize
xsputn(
const char*
s, std::streamsize
n)
250 std::streamsize
count = 0;
251 while (
count <
n && pptr() < epptr())
253 *(pptr()) = *(
s +
count++);
271 inline void resetp(
char*
s, std::streamsize
n)
279 setp(
nullptr,
nullptr);
287 inline std::streamsize
capacity()
const 289 return (epptr() - pbase());
293 inline const UList<char>
list()
const 295 return UList<char>(pbase(), (pptr() - pbase()));
307 os <<
"put=" << (pptr() - pbase())
308 <<
"/" << (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.