1 #ifndef TPZCIRCBUFFEREDSTREAM_H 2 #define TPZCIRCBUFFEREDSTREAM_H 77 virtual void Write(
const int *p,
int howMany);
78 virtual void Write(
const unsigned int *p,
int howMany);
79 virtual void Write(
const uint64_t *p,
int howMany);
80 virtual void Write(
const int64_t *p,
int howMany);
81 virtual void Write(
const float *p,
int howMany);
82 virtual void Write(
const double *p,
int howMany);
83 virtual void Write(
const unsigned char *p,
int howMany);
84 virtual void Write(
const char *p,
int howMany);
85 virtual void Write(
const std::complex<float> *p,
int howMany);
86 virtual void Write(
const std::complex<double> *p,
int howMany);
100 virtual void Read(
int *p,
int howMany);
101 virtual void Read(
unsigned int *p,
int howMany);
102 virtual void Read(uint64_t *p,
int howMany);
103 virtual void Read(int64_t *p,
int howMany);
104 virtual void Read(
float *p,
int howMany);
105 virtual void Read(
double *p,
int howMany);
106 virtual void Read(
long double *p,
int howMany);
107 virtual void Read(
unsigned char *p,
int howMany);
108 virtual void Read(
char *p,
int howMany);
109 virtual void Read(std::complex<float> *p,
int howMany);
110 virtual void Read(std::complex<double> *p,
int howMany);
140 virtual void ConstRead(
char *dest,
const size_t &nBytes)
const;
148 virtual void WriteToBuffer(
const char *source,
const size_t &nBytes);
169 template <
class T>
void ReadData(T *p,
int howMany);
171 template <
class T>
void WriteData(
const T *p,
int howMany);
176 template <
typename T>
178 ReadFromBuffer(reinterpret_cast<char *> (p), howMany *
sizeof (T));
181 template <
typename T>
183 WriteToBuffer(reinterpret_cast<const char *> (p), howMany *
sizeof (T));
228 #endif // TPZCIRCBUFFEREDSTREAM_H TPZCircBufferedStream()
Creates a bidirectional buffer.
void Print()
Prints buffer info and data.
virtual void ConstRead(char *dest, const size_t &nBytes) const
Reads from buffer WITHOUT consuming it. Unless it is still reading from its underlying stream...
void GetDataFromBuffer(char *dest) const
Get all buffer data to a char* in a contiguous manner. May be interesting if one needs to this data t...
virtual void ConstReadFromBuffer(char *dest, const size_t &nBytes) const
Reads from buffer WITHOUT consuming it.
~TPZCircBufferedStream()
Destroys the object.
virtual void Write(const bool val)
virtual void ReadFromBuffer(char *dest, const size_t &nBytes)
Reads from buffer.
Class for creating a bidirectional circular buffer.
void WriteData(const T *p, int howMany)
virtual void Read(int *p, int howMany)
virtual TPZCircBufferedStream & operator<<(TPZCircBufferedStream &other)
It reads all data in a buffer, consuming it.
virtual void WriteToBuffer(const char *source, const size_t &nBytes)
Writes to buffer.
static const size_t MIN_SIZE_INCREMENT
virtual void Write(const int *p, int howMany)
TPZCircBufferedStream & operator=(const TPZCircBufferedStream &other)
Assingment operator. Both buffers will have the same underlying stream, so this must be used with car...
Contains declaration of the abstract TPZStream class. TPZStream defines the interface for saving and ...
Defines the interface for saving and reading data. Persistency.
void ReadData(T *p, int howMany)
virtual void Read(bool &val)