NeoPZ
|
Class for creating a bidirectional circular buffer. More...
#include <TPZContBufferedStream.h>
Public Member Functions | |
TPZContBufferedStream () | |
Creates a buffer. More... | |
TPZContBufferedStream (const TPZContBufferedStream &readBuffer) | |
Copy constructor. More... | |
~TPZContBufferedStream () | |
Destroys the object. More... | |
TPZContBufferedStream & | operator= (const TPZContBufferedStream &other) |
Assingment operator. More... | |
virtual TPZContBufferedStream & | operator<< (TPZContBufferedStream &other) |
It reads all data in a buffer, consuming it. More... | |
virtual TPZContBufferedStream & | operator<< (const TPZContBufferedStream &other) |
It reads all data in a buffer WITHOUT consuming it. More... | |
void | Print () |
Prints buffer info and data. More... | |
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 to be serialized(i.e., for MPI) More... | |
void | clear () |
virtual void | Write (const int *p, int howMany=1) |
virtual void | Write (const unsigned int *p, int howMany=1) |
virtual void | Write (const uint64_t *p, int howMany=1) |
virtual void | Write (const int64_t *p, int howMany=1) |
virtual void | Write (const float *p, int howMany=1) |
virtual void | Write (const double *p, int howMany=1) |
virtual void | Write (const unsigned char *p, int howMany=1) |
virtual void | Write (const char *p, int howMany=1) |
virtual void | Write (const std::complex< float > *p, int howMany=1) |
virtual void | Write (const std::complex< double > *p, int howMany=1) |
virtual void | Read (int *p, int howMany=1) |
virtual void | Read (unsigned int *p, int howMany=1) |
virtual void | Read (uint64_t *p, int howMany=1) |
virtual void | Read (int64_t *p, int howMany=1) |
virtual void | Read (float *p, int howMany=1) |
virtual void | Read (double *p, int howMany=1) |
virtual void | Read (unsigned char *p, int howMany=1) |
virtual void | Read (char *p, int howMany=1) |
virtual void | Read (std::complex< float > *p, int howMany=1) |
virtual void | Read (std::complex< double > *p, int howMany=1) |
size_t | Size () const |
Public Member Functions inherited from TPZStream | |
TPZStream () | |
virtual | ~TPZStream () |
virtual void | Write (const bool val) |
virtual void | Write (const long double *p, int howMany=1) |
Writes howMany floating points at pointer location p. More... | |
virtual void | Write (const std::string *p, int howMany=1) |
virtual void | Write (const std::complex< long double > *p, int howMany=1) |
Writes howMany complex-long double at pointer location p. More... | |
void | Write (const TPZFlopCounter *p, int howMany=1) |
virtual void | Read (bool &val) |
virtual void | Read (long double *p, int howMany=1) |
virtual void | Read (std::string *p, int howMany=1) |
virtual void | Read (std::complex< long double > *p, int howMany=1) |
Reads howMany complex-long double from pointer location p. More... | |
void | Read (TPZFlopCounter *p, int howMany=1) |
template<class T , typename std::enable_if<(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Write (const TPZVec< T > &vec) |
template<class T , typename std::enable_if<!(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Write (const TPZVec< T > &vec) |
template<class T > | |
void | WritePointers (const TPZVec< TPZAutoPointer< T >> &vec) |
template<class T , typename std::enable_if<(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Write (const std::vector< T > &vec) |
template<class T , typename std::enable_if<!(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Write (const std::vector< T > &vec) |
void | Write (const TPZVec< TPZFlopCounter > &vec) |
template<class T , class U > | |
void | Write (const std::map< T, U > &vec) |
template<class T , typename std::enable_if<(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Write (const std::set< T > &vec) |
template<class T > | |
void | Read (TPZVec< T > &vec) |
template<class T , typename std::enable_if<!(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Read (TPZVec< T > &vec, void *context) |
template<class T , typename std::enable_if<(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Read (TPZVec< T > &vec, void *context) |
template<class T > | |
void | ReadPointers (TPZVec< TPZAutoPointer< T >> &vec) |
void | Read (TPZVec< TPZFlopCounter > &vec) |
template<class T , typename std::enable_if<!(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Read (std::vector< T > &vec, void *context) |
template<class T , typename std::enable_if<(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Read (std::vector< T > &vec, void *context) |
template<int N> | |
void | Read (TPZManVector< REAL, N > &vec) |
template<int N> | |
void | Read (TPZManVector< int64_t, N > &vec) |
template<class T , class U > | |
void | Read (std::map< T, U > &vec) |
template<class T , typename std::enable_if<(std::is_same< std::string, T >::value||is_arithmetic_pz< T >::value), int >::type * = nullptr> | |
void | Read (std::set< T > &vec) |
template<class T > | |
void | WritePointers (const TPZVec< T *> &vec) |
template<class T > | |
void | ReadPointers (TPZVec< T *> &vec) |
template<class T > | |
void | WritePointers (const std::map< int, TPZAutoPointer< T >> &vec) |
template<class T > | |
void | ReadPointers (std::map< int, TPZAutoPointer< T > > &vec) |
template<class T > | |
void | WritePointers (const std::map< int, T *> &vec) |
template<class T > | |
void | ReadPointers (std::map< int, T *> &vec) |
template<class T > | |
void | WritePointers (const std::set< T *> &vec) |
template<class T > | |
void | ReadPointers (std::set< T *> &vec) |
template<class T , int EXP> | |
void | WritePointers (const TPZChunkVector< T *, EXP > &vec) |
template<class T , int EXP> | |
void | ReadPointers (TPZChunkVector< T *, EXP > &vec) |
template<class T , int EXP> | |
void | WritePointers (const TPZAdmChunkVector< T *, EXP > &vec) |
template<class T , int EXP> | |
void | ReadPointers (TPZAdmChunkVector< T *, EXP > &vec) |
template<class T > | |
void | ReadPointers (std::map< int, TPZAutoPointer< T >> &map) |
Protected Member Functions | |
virtual void | ReadFromBuffer (char *dest, const size_t &nBytes) |
Reads from buffer. More... | |
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. In this situation there is no guarantee. More... | |
virtual void | WriteToBuffer (const char *source, const size_t &nBytes) |
Writes to buffer. More... | |
Private Member Functions | |
virtual void | ConstReadFromBuffer (char *dest, const size_t &nBytes) const |
Reads from buffer WITHOUT consuming it. More... | |
template<class T > | |
void | ReadData (T *p, int howMany) |
template<class T > | |
void | WriteData (const T *p, int howMany) |
Private Attributes | |
char * | fBuffer |
char * | fFirst |
char * | fLast |
size_t | fNAllocatedBytes |
size_t | fSize |
Static Private Attributes | |
static const size_t | MIN_SIZE_INCREMENT |
Class for creating a bidirectional circular buffer.
Definition at line 14 of file TPZContBufferedStream.h.
TPZContBufferedStream::TPZContBufferedStream | ( | ) |
Creates a buffer.
Definition at line 10 of file TPZContBufferedStream.cpp.
References fBuffer, fFirst, fLast, fNAllocatedBytes, fSize, and MIN_SIZE_INCREMENT.
TPZContBufferedStream::TPZContBufferedStream | ( | const TPZContBufferedStream & | readBuffer | ) |
Copy constructor.
[in] | readBuffer | The buffer to be copied. |
Definition at line 19 of file TPZContBufferedStream.cpp.
References operator=().
TPZContBufferedStream::~TPZContBufferedStream | ( | ) |
Destroys the object.
Definition at line 37 of file TPZContBufferedStream.cpp.
References fBuffer, and operator<<().
void TPZContBufferedStream::clear | ( | ) |
Definition at line 287 of file TPZContBufferedStream.cpp.
References fBuffer, fFirst, fLast, and fSize.
Referenced by TPZMatWithMemTranslator< TMEMTranslator >::UpdateFromV3().
|
protectedvirtual |
Reads from buffer WITHOUT consuming it. Unless it is still reading from its underlying stream. In this situation there is no guarantee.
dest | The destination | |
[in] | nBytes | How many bytes will be read |
Definition at line 78 of file TPZContBufferedStream.cpp.
References ConstReadFromBuffer().
Referenced by operator<<(), and Print().
|
privatevirtual |
Reads from buffer WITHOUT consuming it.
dest | The destination | |
[in] | nBytes | How many bytes will be read |
Definition at line 82 of file TPZContBufferedStream.cpp.
References DebugStop, fBuffer, fFirst, fNAllocatedBytes, fSize, PZError, and to_string().
Referenced by ConstRead(), and WriteToBuffer().
void TPZContBufferedStream::GetDataFromBuffer | ( | char * | dest | ) | const |
Get all buffer data to a char* in a contiguous manner. May be interesting if one needs to this data to be serialized(i.e., for MPI)
[in] | dest | Array where data will be stored. |
Definition at line 283 of file TPZContBufferedStream.cpp.
|
virtual |
It reads all data in a buffer, consuming it.
other | The other buffer |
Definition at line 42 of file TPZContBufferedStream.cpp.
References fSize, ReadFromBuffer(), and WriteToBuffer().
Referenced by ~TPZContBufferedStream().
|
virtual |
It reads all data in a buffer WITHOUT consuming it.
[in] | other | The other buffer |
Definition at line 54 of file TPZContBufferedStream.cpp.
References ConstRead(), fSize, and WriteToBuffer().
TPZContBufferedStream & TPZContBufferedStream::operator= | ( | const TPZContBufferedStream & | other | ) |
Assingment operator.
[in] | other | The other buffer |
Definition at line 25 of file TPZContBufferedStream.cpp.
References fBuffer, fFirst, fLast, fNAllocatedBytes, and fSize.
Referenced by TPZContBufferedStream().
void TPZContBufferedStream::Print | ( | ) |
Prints buffer info and data.
Definition at line 120 of file TPZContBufferedStream.cpp.
References ConstRead(), and fSize.
|
virtual |
Implements TPZStream.
Definition at line 207 of file TPZContBufferedStream.cpp.
Referenced by TPZPersistenceManager::OpenRead(), Read(), TPZPersistenceManager::TranslateNextPointer(), TPZPersistenceManager::TranslatePointers(), TPZYCSandlerDimaggioTranslator::UpdateAttributes(), TPZMaterialTranslator::UpdateAttributes(), TPZPlasticStepPVTranslator< YC_Translator, ER_Translator >::UpdateAttributes(), TPZPlasticStepTranslator< YC_t, TF_t, ER_t >::UpdateAttributes(), TPZMatElastoPlastic2DTranslator< TTranslator, TMEMTranslator >::UpdateAttributes(), TPZElastoPlasticMemTranslator::UpdateAttributes(), TPZPlasticStateTranslator< STATE >::UpdateAttributes(), TPZTensorTranslator< STATE >::UpdateAttributes(), TPZMatElastoPlasticTranslator< TTranslator, TMEMTranslator >::UpdateAttributes(), TPZMatWithMemTranslator< TMEMTranslator >::UpdateAttributes(), TPZNullMaterialTranslator::UpdateAttributes(), TPZElasticResponseTranslator::UpdateAttributes(), TPZYCMohrCoulombPVTranslator::UpdateAttributes(), TPZYCCamClayPVTranslator::UpdateAttributes(), TPZSandlerExtendedTranslator::UpdateAttributes(), TPZSandlerExtendedTranslator::UpdateAttributesV1(), TPZMatWithMemTranslator< TMEMTranslator >::UpdateAttributesV3(), TPZSandlerDimaggioTranslator< SANDLERDIMAGGIOPARENTTRANSLATOR >::UpdateFromV1(), TPZPlasticStateTranslator< STATE >::UpdateFromV1(), TPZElastoPlasticMemTranslator::UpdateFromV1(), TPZSandlerExtendedTranslator::UpdateFromV2(), and TPZMatWithMemTranslator< TMEMTranslator >::UpdateFromV3().
|
virtual |
Implements TPZStream.
Definition at line 211 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 215 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 219 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 223 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 227 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 231 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 235 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 239 of file TPZContBufferedStream.cpp.
|
virtual |
|
private |
Definition at line 177 of file TPZContBufferedStream.h.
References ReadFromBuffer().
Referenced by WriteData().
|
protectedvirtual |
Reads from buffer.
dest | The destination | |
[in] | nBytes | How many bytes will be read |
Definition at line 63 of file TPZContBufferedStream.cpp.
References DebugStop, fFirst, fSize, PZError, and to_string().
Referenced by operator<<(), and ReadData().
size_t TPZContBufferedStream::Size | ( | ) | const |
Definition at line 293 of file TPZContBufferedStream.cpp.
References fSize.
|
virtual |
Implements TPZStream.
Definition at line 131 of file TPZContBufferedStream.cpp.
Referenced by TPZChunkInTranslation::ReadFromStream(), TPZPersistenceManager::TranslateNextPointer(), TPZPersistenceManager::TranslatePointers(), TPZYCSandlerDimaggioTranslator::UpdateAttributes(), TPZMaterialTranslator::UpdateAttributes(), TPZPlasticStepPVTranslator< YC_Translator, ER_Translator >::UpdateAttributes(), TPZPlasticStepTranslator< YC_t, TF_t, ER_t >::UpdateAttributes(), TPZMatElastoPlastic2DTranslator< TTranslator, TMEMTranslator >::UpdateAttributes(), TPZElastoPlasticMemTranslator::UpdateAttributes(), TPZTensorTranslator< STATE >::UpdateAttributes(), TPZPlasticStateTranslator< STATE >::UpdateAttributes(), TPZMatElastoPlasticTranslator< TTranslator, TMEMTranslator >::UpdateAttributes(), TPZMatWithMemTranslator< TMEMTranslator >::UpdateAttributes(), TPZNullMaterialTranslator::UpdateAttributes(), TPZElasticResponseTranslator::UpdateAttributes(), TPZYCMohrCoulombPVTranslator::UpdateAttributes(), TPZYCCamClayPVTranslator::UpdateAttributes(), TPZSandlerExtendedTranslator::UpdateAttributes(), TPZSandlerExtendedTranslator::UpdateAttributesV1(), TPZMatWithMemTranslator< TMEMTranslator >::UpdateAttributesV3(), TPZPlasticStateTranslator< STATE >::UpdateFromV1(), TPZElastoPlasticMemTranslator::UpdateFromV1(), TPZSandlerExtendedTranslator::UpdateFromV2(), TPZMatWithMemTranslator< TMEMTranslator >::UpdateFromV3(), and Write().
|
virtual |
Implements TPZStream.
Definition at line 135 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 139 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 143 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 147 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 151 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 155 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 159 of file TPZContBufferedStream.cpp.
|
virtual |
Implements TPZStream.
Definition at line 163 of file TPZContBufferedStream.cpp.
|
virtual |
|
private |
Definition at line 182 of file TPZContBufferedStream.h.
References ReadData(), and WriteToBuffer().
|
protectedvirtual |
Writes to buffer.
[in] | source | The source |
[in] | nBytes | How many bytes will be written |
Definition at line 97 of file TPZContBufferedStream.cpp.
References ConstReadFromBuffer(), fBuffer, fFirst, fLast, fNAllocatedBytes, fSize, and MIN_SIZE_INCREMENT.
Referenced by operator<<(), and WriteData().
|
private |
Definition at line 151 of file TPZContBufferedStream.h.
Referenced by clear(), ConstReadFromBuffer(), operator=(), TPZContBufferedStream(), WriteToBuffer(), and ~TPZContBufferedStream().
|
private |
Definition at line 153 of file TPZContBufferedStream.h.
Referenced by clear(), ConstReadFromBuffer(), GetDataFromBuffer(), operator=(), ReadFromBuffer(), TPZContBufferedStream(), and WriteToBuffer().
|
private |
Definition at line 155 of file TPZContBufferedStream.h.
Referenced by clear(), operator=(), TPZContBufferedStream(), and WriteToBuffer().
|
private |
Definition at line 157 of file TPZContBufferedStream.h.
Referenced by ConstReadFromBuffer(), operator=(), TPZContBufferedStream(), and WriteToBuffer().
|
private |
Definition at line 159 of file TPZContBufferedStream.h.
Referenced by clear(), ConstReadFromBuffer(), GetDataFromBuffer(), operator<<(), operator=(), Print(), ReadFromBuffer(), Size(), TPZContBufferedStream(), and WriteToBuffer().
|
staticprivate |
Definition at line 173 of file TPZContBufferedStream.h.
Referenced by TPZContBufferedStream(), and WriteToBuffer().