NeoPZ
TPZChunkInTranslation.cpp
Go to the documentation of this file.
1 /*
2  * File: TPZChunkInTranslator.cpp
3  * Author: quinelato
4  *
5  * Created on September 18, 2017, 3:54 PM
6  */
7 
9 
10 TPZChunkInTranslation::TPZChunkInTranslation(const int64_t &objId, const int &classId, TPZStream &stream, const size_t &chunkSize, const std::map<std::string, uint64_t> &versionInfo) :
11 mObjId(objId),
12 mClassId(classId),
13 mNewVersion(versionInfo) {
14  this->ReadFromStream(stream, chunkSize);
15 }
16 
17 TPZChunkInTranslation::TPZChunkInTranslation(const int64_t &objId, const int &classId, const TPZContBufferedStream &oldStream, const std::map<std::string, uint64_t> &versionInfo) :
18 mOldStream(oldStream),
19 mObjId(objId),
20 mClassId(classId),
21 mOldVersion(versionInfo) {
22 }
23 
25 }
26 
28 }
29 
30 void TPZChunkInTranslation::ReadFromStream(TPZStream &stream, const size_t nBytes) {
31  char *temp = new char[nBytes];
32  stream.Read(temp, nBytes);
33  mNewStream.Write(temp, nBytes);
34  delete[] temp;
35 }
36 
38  return mObjId;
39 }
40 
42  return mClassId;
43 }
44 
Class for creating a bidirectional circular buffer.
virtual void Write(const int *p, int howMany=1)
std::map< std::string, uint64_t > mOldVersion
TPZStack< int64_t, 2 > mNewObjIds
TPZContBufferedStream mOldStream
TPZChunkInTranslation(const int64_t &objId, const int &classId, TPZStream &stream, const size_t &chunkSize, const std::map< std::string, uint64_t > &versionInfo)
void ReadFromStream(TPZStream &stream, const size_t nBytes)
std::map< std::string, uint64_t > mNewVersion
Defines the interface for saving and reading data. Persistency.
Definition: TPZStream.h:50
TPZContBufferedStream mNewStream
virtual void Read(bool &val)
Definition: TPZStream.cpp:91