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

Implements an interface to check the consistency of two implementations. Utility. More...

#include <pzcheckconsistency.h>

Public Member Functions

 TPZCheckConsistency (const std::string &filename)
 Constructor indicating the root filename. More...
 
void SetOverWrite (bool flag=true)
 Set the overwrite flag. More...
 
void SetReadMode ()
 Set the read mode. No write. More...
 
void SetWriteMode ()
 Set the write mode. More...
 
bool CheckObject (TPZSavable &obj)
 Reads or writes depending on the compiler directive. More...
 

Private Attributes

int fCounter
 A counter which will be used to compose the file name. More...
 
std::string fPath
 Path where the file will be stored. If CHECKPATH is defined then this will be used as the file path, else the current directory will be the path. More...
 
std::string fFileName
 base file name. This name has to be unique to avoid overwrites More...
 
bool fOverWrite
 Boolean indicating whether the objects should be overwritten or not. More...
 
bool fWriteFlag
 Boolean indicating whether the object will write the objects to disk or read them. More...
 

Detailed Description

Implements an interface to check the consistency of two implementations. Utility.

Author
Philippe Devloo
Since
27/12/2009

Definition at line 17 of file pzcheckconsistency.h.

Constructor & Destructor Documentation

◆ TPZCheckConsistency()

TPZCheckConsistency::TPZCheckConsistency ( const std::string &  filename)

Constructor indicating the root filename.

constructor indicating the root filename

Definition at line 14 of file pzcheckconsistency.cpp.

References fCounter, fFileName, stats::filename, fOverWrite, fPath, and fWriteFlag.

Member Function Documentation

◆ CheckObject()

bool TPZCheckConsistency::CheckObject ( TPZSavable obj)

Reads or writes depending on the compiler directive.

this method goes reads or writes depending on the compiler directive

when writing the method will write a binary copy of the object to a binary file
when reading the method will read an object from the binary file and compare both copies

when writing the method will write a binary copy of the object to a binary file when reading the method will read an object from the binary file and compare both copies

Definition at line 43 of file pzcheckconsistency.cpp.

References TPZPersistenceManagerNS::binary, TPZPersistenceManager::CloseWrite(), TPZSavable::Compare(), fCounter, fFileName, fOverWrite, fPath, fWriteFlag, TPZPersistenceManager::OpenRead(), TPZPersistenceManager::OpenWrite(), TPZPersistenceManager::ReadFromFile(), and TPZPersistenceManager::WriteToFile().

Referenced by SetWriteMode().

◆ SetOverWrite()

void TPZCheckConsistency::SetOverWrite ( bool  flag = true)

Set the overwrite flag.

set the overwrite flag

Definition at line 34 of file pzcheckconsistency.cpp.

References fOverWrite.

◆ SetReadMode()

void TPZCheckConsistency::SetReadMode ( )
inline

Set the read mode. No write.

Definition at line 46 of file pzcheckconsistency.h.

◆ SetWriteMode()

void TPZCheckConsistency::SetWriteMode ( )
inline

Set the write mode.

Definition at line 51 of file pzcheckconsistency.h.

References CheckObject(), and test::obj.

Member Data Documentation

◆ fCounter

int TPZCheckConsistency::fCounter
private

A counter which will be used to compose the file name.

Definition at line 20 of file pzcheckconsistency.h.

Referenced by CheckObject(), and TPZCheckConsistency().

◆ fFileName

std::string TPZCheckConsistency::fFileName
private

base file name. This name has to be unique to avoid overwrites

Definition at line 27 of file pzcheckconsistency.h.

Referenced by CheckObject(), and TPZCheckConsistency().

◆ fOverWrite

bool TPZCheckConsistency::fOverWrite
private

Boolean indicating whether the objects should be overwritten or not.

This flag is set to false by default

Definition at line 30 of file pzcheckconsistency.h.

Referenced by CheckObject(), SetOverWrite(), and TPZCheckConsistency().

◆ fPath

std::string TPZCheckConsistency::fPath
private

Path where the file will be stored. If CHECKPATH is defined then this will be used as the file path, else the current directory will be the path.

Definition at line 25 of file pzcheckconsistency.h.

Referenced by CheckObject(), and TPZCheckConsistency().

◆ fWriteFlag

bool TPZCheckConsistency::fWriteFlag
private

Boolean indicating whether the object will write the objects to disk or read them.

The value of this variable is set default to true or false depending on the compiler directive READCHECK or WRITECHECK

Definition at line 36 of file pzcheckconsistency.h.

Referenced by CheckObject(), and TPZCheckConsistency().


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