44 const unsigned int nBytesOther = other.
fSize;
45 char *temp =
new char[nBytesOther];
55 const unsigned int nBytesOther = other.
fSize;
56 char *temp =
new char[nBytesOther];
65 std::string msg(
"TPZContBufferedStream: Cannot read ");
67 msg.append(
" bytes; there are only ");
69 msg.append(
" available.");
73 memcpy(dest,
fFirst, nBytes);
83 const size_t &nBytes)
const {
85 std::string msg(
"TPZContBufferedStream: Cannot read ");
87 msg.append(
" bytes; there are only ");
89 msg.append(
" available.");
94 memcpy(dest,
fFirst, nBytes);
98 const size_t &nBytes) {
100 const size_t oldSize =
fSize;
101 const size_t newAllocatedBytes =
102 oldSize * 1.1 + nBytes +
104 char *temp =
new char[newAllocatedBytes];
106 memcpy(temp + oldSize, source, nBytes);
111 fSize = oldSize + nBytes;
114 memcpy(
fLast + 1, source, nBytes);
121 std::cout <<
"fSize=" <<
fSize << std::endl;
122 double *temp =
new double[
fSize / 8];
124 for (
unsigned int i = 0; i <
fSize / 8; ++i) {
125 std::cout << temp[i] <<
" ";
128 std::cout << std::endl;
132 WriteData<int>(p, howMany);
136 WriteData<unsigned int>(p, howMany);
140 WriteData<uint64_t>(p, howMany);
144 WriteData<int64_t>(p, howMany);
148 WriteData<float>(p, howMany);
152 WriteData<double>(p, howMany);
156 WriteData<unsigned char>(p, howMany);
160 WriteData<char>(p, howMany);
164 WriteData<std::complex<float>>(p, howMany);
168 WriteData<std::complex<double>>(p, howMany);
174 WriteData<TFad<1,REAL>>(p, howMany);
178 WriteData<TFad<6,REAL>>(p, howMany);
182 WriteData<TFad<8,REAL>>(p, howMany);
186 WriteData<TFad<9,REAL>>(p, howMany);
190 WriteData<TFad<10,REAL>>(p, howMany);
194 WriteData<TFad<14,REAL>>(p, howMany);
198 WriteData<Fad<float>>(p, howMany);
202 WriteData<Fad<double>>(p, howMany);
208 ReadData<int>(p, howMany);
212 ReadData<unsigned int>(p, howMany);
216 ReadData<uint64_t>(p, howMany);
220 ReadData<int64_t>(p, howMany);
224 ReadData<float>(p, howMany);
228 ReadData<double>(p, howMany);
232 ReadData<unsigned char>(p, howMany);
236 ReadData<char>(p, howMany);
240 ReadData<std::complex<float>>(p, howMany);
244 ReadData<std::complex<double>>(p, howMany);
250 ReadData<TFad<1,REAL>>(p, howMany);
254 ReadData<TFad<6,REAL>>(p, howMany);
258 ReadData<TFad<8,REAL>>(p, howMany);
262 ReadData<TFad<9,REAL>>(p, howMany);
266 ReadData<TFad<10,REAL>>(p, howMany);
270 ReadData<TFad<14,REAL>>(p, howMany);
274 ReadData<Fad<float>>(p, howMany);
278 ReadData<Fad<double>>(p, howMany);
TPZContBufferedStream & operator=(const TPZContBufferedStream &other)
Assingment operator.
Class for creating a bidirectional circular buffer.
virtual void Read(int *p, int howMany=1)
virtual void Write(const int *p, int howMany=1)
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...
virtual void ReadFromBuffer(char *dest, const size_t &nBytes)
Reads from buffer.
#define DebugStop()
Returns a message to user put a breakpoint in.
~TPZContBufferedStream()
Destroys the object.
virtual void ConstReadFromBuffer(char *dest, const size_t &nBytes) const
Reads from buffer WITHOUT consuming it.
void Print()
Prints buffer info and data.
virtual void WriteToBuffer(const char *source, const size_t &nBytes)
Writes to buffer.
TPZContBufferedStream()
Creates a buffer.
string to_string(const string &value)
Defines the interface for saving and reading data. Persistency.
static const size_t MIN_SIZE_INCREMENT
virtual TPZContBufferedStream & operator<<(TPZContBufferedStream &other)
It reads all data in a buffer, consuming it.
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...
#define PZError
Defines the output device to error messages and the DebugStop() function.