NeoPZ
Public Member Functions | Private Member Functions | Private Attributes | List of all members
TPZMD5Stream Class Reference

Implements the interface to write and check MD5 files. Persistency. More...

#include <pzmd5stream.h>

Inheritance diagram for TPZMD5Stream:
[legend]
Collaboration diagram for TPZMD5Stream:
[legend]

Public Member Functions

 TPZMD5Stream ()
 Default constructor. More...
 
virtual ~TPZMD5Stream ()
 Default destructor. More...
 
int CheckMD5 (const std::string &filename)
 Check Stream MD5 signature against MD5 signature store on file. More...
 
int CheckMD5 (FILE *fh)
 Check Stream MD5 signature against MD5 signature store on file. More...
 
int WriteMD5 (const std::string &filename)
 Write computed MD5 signature to file. More...
 
int WriteMD5 (FILE *fh)
 Write computed MD5 signature to file. More...
 
int ResetMD5 ()
 Reset the MD5 signature. More...
 
virtual void Write (const int *p, int size)
 Writes size integers at pointer location p. More...
 
virtual void Write (const int64_t *p, int size)
 Writes size longs at pointer location p. More...
 
virtual void Write (const unsigned int *p, int size)
 Writes size integers at pointer location p. More...
 
virtual void Write (const float *p, int size)
 Writes size floating points at pointer location p. More...
 
virtual void Write (const double *p, int size)
 Writes size floating points at pointer location p. More...
 
virtual void Write (const long double *p, int size)
 Writes size floating points at pointer location p. More...
 
virtual void Write (const char *p, int size)
 Writes size chars at pointer location p. More...
 
virtual void Write (const std::string *p, int size)
 Writes size strings at pointer location p. More...
 
virtual void Write (const std::complex< float > *p, int size)
 Writes size complex-float at pointer location p. More...
 
virtual void Write (const std::complex< double > *p, int size)
 Writes size complex-double at pointer location p. More...
 
virtual void Write (const std::complex< long double > *p, int size)
 Writes size complex-long double at pointer location p. More...
 
template<class T >
void Writes (const T *p, int size)
 Writes size objects of the class T at pointer location p. More...
 
virtual void Read (int *p, int size)
 Reads size integers from pointer location p. More...
 
virtual void Read (int64_t *p, int size)
 Reads size longs from pointer location p. More...
 
virtual void Read (unsigned int *p, int size)
 Reads size integers from pointer location p. More...
 
virtual void Read (float *p, int size)
 Reads size floating points from pointer location p. More...
 
virtual void Read (double *p, int size)
 Reads size floating points from pointer location p. More...
 
virtual void Read (long double *p, int size)
 Reads size floating points from pointer location p. More...
 
virtual void Read (char *p, int size)
 Reads size chars from pointer location p. More...
 
virtual void Read (std::string *p, int size)
 Reads size strings from pointer location p. More...
 
virtual void Read (std::complex< float > *p, int size)
 Reads size complex-float from pointer location p. More...
 
virtual void Read (std::complex< double > *p, int size)
 Reads size complex-double from pointer location p. More...
 
virtual void Read (std::complex< long double > *p, int size)
 Reads size complex-long double from pointer location p. More...
 
void ReadError ()
 
- Public Member Functions inherited from TPZStream
 TPZStream ()
 
virtual ~TPZStream ()
 
virtual void Write (const bool val)
 
virtual void Write (const uint64_t *p, int howMany=1)=0
 
virtual void Write (const unsigned char *p, int howMany=1)=0
 
void Write (const TPZFlopCounter *p, int howMany=1)
 
virtual void Read (bool &val)
 
virtual void Read (uint64_t *p, int howMany=1)=0
 
virtual void Read (unsigned char *p, int howMany=1)=0
 
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)
 

Private Member Functions

int compare_digests (unsigned char *d1, unsigned char *d2, unsigned int dsz)
 Return 0 if digests are equal. -2 otherwise. More...
 

Private Attributes

int last_status
 

Detailed Description

Implements the interface to write and check MD5 files. Persistency.

Author
Edson Borin

Definition at line 22 of file pzmd5stream.h.

Constructor & Destructor Documentation

◆ TPZMD5Stream()

TPZMD5Stream::TPZMD5Stream ( )
inline

Default constructor.

Definition at line 47 of file pzmd5stream.h.

References ResetMD5().

◆ ~TPZMD5Stream()

virtual TPZMD5Stream::~TPZMD5Stream ( )
inlinevirtual

Default destructor.

Definition at line 53 of file pzmd5stream.h.

Member Function Documentation

◆ CheckMD5() [1/2]

int TPZMD5Stream::CheckMD5 ( const std::string &  filename)
inline

Check Stream MD5 signature against MD5 signature store on file.

Returns
Returns 0 if ok; 1 if an error ocurred when opening the file 2 if an error ocurred when reading the MD5 from the file -1 if an error ocurred when computing this MD5 digest -2 if the digests are different -3 error when computing this MD5 signature (last_status != 1)

Definition at line 65 of file pzmd5stream.h.

Referenced by main().

◆ CheckMD5() [2/2]

int TPZMD5Stream::CheckMD5 ( FILE *  fh)
inline

Check Stream MD5 signature against MD5 signature store on file.

Returns
Returns 0 if ok; 2 if an error ocurred when reading the MD5 from the file -1 if an error ocurred when computing this MD5 digest -2 if the digests are different -3 error when computing this MD5 signature (last_status != 1) 1 if is disable OPENSSL

Definition at line 82 of file pzmd5stream.h.

References compare_digests().

◆ compare_digests()

int TPZMD5Stream::compare_digests ( unsigned char *  d1,
unsigned char *  d2,
unsigned int  dsz 
)
inlineprivate

Return 0 if digests are equal. -2 otherwise.

Definition at line 35 of file pzmd5stream.h.

Referenced by CheckMD5().

◆ Read() [1/11]

virtual void TPZMD5Stream::Read ( int *  p,
int  size 
)
inlinevirtual

Reads size integers from pointer location p.

Implements TPZStream.

Definition at line 266 of file pzmd5stream.h.

References ReadError().

Referenced by Writes().

◆ Read() [2/11]

virtual void TPZMD5Stream::Read ( int64_t *  p,
int  size 
)
inlinevirtual

Reads size longs from pointer location p.

Implements TPZStream.

Definition at line 270 of file pzmd5stream.h.

References ReadError().

◆ Read() [3/11]

virtual void TPZMD5Stream::Read ( unsigned int *  p,
int  size 
)
inlinevirtual

Reads size integers from pointer location p.

Implements TPZStream.

Definition at line 274 of file pzmd5stream.h.

References ReadError().

◆ Read() [4/11]

virtual void TPZMD5Stream::Read ( float *  p,
int  size 
)
inlinevirtual

Reads size floating points from pointer location p.

Implements TPZStream.

Definition at line 278 of file pzmd5stream.h.

References ReadError().

◆ Read() [5/11]

virtual void TPZMD5Stream::Read ( double *  p,
int  size 
)
inlinevirtual

Reads size floating points from pointer location p.

Implements TPZStream.

Definition at line 282 of file pzmd5stream.h.

References ReadError().

◆ Read() [6/11]

virtual void TPZMD5Stream::Read ( long double *  p,
int  size 
)
inlinevirtual

Reads size floating points from pointer location p.

Reimplemented from TPZStream.

Definition at line 286 of file pzmd5stream.h.

References ReadError().

◆ Read() [7/11]

virtual void TPZMD5Stream::Read ( char *  p,
int  size 
)
inlinevirtual

Reads size chars from pointer location p.

Implements TPZStream.

Definition at line 290 of file pzmd5stream.h.

References ReadError().

◆ Read() [8/11]

virtual void TPZMD5Stream::Read ( std::string *  p,
int  size 
)
inlinevirtual

Reads size strings from pointer location p.

Reimplemented from TPZStream.

Definition at line 294 of file pzmd5stream.h.

References ReadError().

◆ Read() [9/11]

virtual void TPZMD5Stream::Read ( std::complex< float > *  p,
int  size 
)
inlinevirtual

Reads size complex-float from pointer location p.

Implements TPZStream.

Definition at line 299 of file pzmd5stream.h.

References ReadError().

◆ Read() [10/11]

virtual void TPZMD5Stream::Read ( std::complex< double > *  p,
int  size 
)
inlinevirtual

Reads size complex-double from pointer location p.

Implements TPZStream.

Definition at line 303 of file pzmd5stream.h.

References ReadError().

◆ Read() [11/11]

virtual void TPZMD5Stream::Read ( std::complex< long double > *  p,
int  size 
)
inlinevirtual

Reads size complex-long double from pointer location p.

Reimplemented from TPZStream.

Definition at line 307 of file pzmd5stream.h.

References ReadError().

◆ ReadError()

void TPZMD5Stream::ReadError ( )
inline

Definition at line 311 of file pzmd5stream.h.

Referenced by Read(), and Writes().

◆ ResetMD5()

int TPZMD5Stream::ResetMD5 ( )
inline

Reset the MD5 signature.

Returns
Returns 1 if ok, 0 otherwise.

Definition at line 163 of file pzmd5stream.h.

Referenced by TPZMD5Stream().

◆ Write() [1/11]

virtual void TPZMD5Stream::Write ( const int *  p,
int  size 
)
inlinevirtual

Writes size integers at pointer location p.

Implements TPZStream.

Definition at line 174 of file pzmd5stream.h.

Referenced by Write().

◆ Write() [2/11]

virtual void TPZMD5Stream::Write ( const int64_t *  p,
int  size 
)
inlinevirtual

Writes size longs at pointer location p.

Implements TPZStream.

Definition at line 178 of file pzmd5stream.h.

◆ Write() [3/11]

virtual void TPZMD5Stream::Write ( const unsigned int *  p,
int  size 
)
inlinevirtual

Writes size integers at pointer location p.

Implements TPZStream.

Definition at line 182 of file pzmd5stream.h.

◆ Write() [4/11]

virtual void TPZMD5Stream::Write ( const float *  p,
int  size 
)
inlinevirtual

Writes size floating points at pointer location p.

Implements TPZStream.

Definition at line 186 of file pzmd5stream.h.

◆ Write() [5/11]

virtual void TPZMD5Stream::Write ( const double *  p,
int  size 
)
inlinevirtual

Writes size floating points at pointer location p.

Implements TPZStream.

Definition at line 190 of file pzmd5stream.h.

◆ Write() [6/11]

virtual void TPZMD5Stream::Write ( const long double *  p,
int  size 
)
inlinevirtual

Writes size floating points at pointer location p.

Reimplemented from TPZStream.

Definition at line 194 of file pzmd5stream.h.

◆ Write() [7/11]

virtual void TPZMD5Stream::Write ( const char *  p,
int  size 
)
inlinevirtual

Writes size chars at pointer location p.

Implements TPZStream.

Definition at line 198 of file pzmd5stream.h.

◆ Write() [8/11]

virtual void TPZMD5Stream::Write ( const std::string *  p,
int  size 
)
inlinevirtual

Writes size strings at pointer location p.

Reimplemented from TPZStream.

Definition at line 202 of file pzmd5stream.h.

References Write().

◆ Write() [9/11]

virtual void TPZMD5Stream::Write ( const std::complex< float > *  p,
int  size 
)
inlinevirtual

Writes size complex-float at pointer location p.

Implements TPZStream.

Definition at line 212 of file pzmd5stream.h.

◆ Write() [10/11]

virtual void TPZMD5Stream::Write ( const std::complex< double > *  p,
int  size 
)
inlinevirtual

Writes size complex-double at pointer location p.

Implements TPZStream.

Definition at line 216 of file pzmd5stream.h.

◆ Write() [11/11]

virtual void TPZMD5Stream::Write ( const std::complex< long double > *  p,
int  size 
)
inlinevirtual

Writes size complex-long double at pointer location p.

Reimplemented from TPZStream.

Definition at line 220 of file pzmd5stream.h.

References Write().

◆ WriteMD5() [1/2]

int TPZMD5Stream::WriteMD5 ( const std::string &  filename)
inline

Write computed MD5 signature to file.

Returns
Returns 0 if ok; 1 if an error ocurred when opening the file 2 if an error ocurred when writing the MD5 to the file -1 if an error ocurred when computing this MD5 digest -3 error when computing this MD5 signature (last_status != 1)

Definition at line 121 of file pzmd5stream.h.

Referenced by main().

◆ WriteMD5() [2/2]

int TPZMD5Stream::WriteMD5 ( FILE *  fh)
inline

Write computed MD5 signature to file.

Returns
Returns 0 if ok; 2 if an error ocurred when writing the MD5 to the file -1 if an error ocurred when computing this MD5 digest -3 error when computing this MD5 signature (last_status != 1) 1 if it is not enable OPENSSL

Definition at line 137 of file pzmd5stream.h.

◆ Writes()

template<class T >
void TPZMD5Stream::Writes ( const T *  p,
int  size 
)
inline

Writes size objects of the class T at pointer location p.

Definition at line 242 of file pzmd5stream.h.

References Read(), and ReadError().

Member Data Documentation

◆ last_status

int TPZMD5Stream::last_status
private

Definition at line 32 of file pzmd5stream.h.


The documentation for this class was generated from the following file: