NeoPZ
pzcheckconsistency.cpp
Go to the documentation of this file.
1 
7 #include "pzcheckconsistency.h"
8 #include "TPZBFileStream.h"
10 #include <sstream>
11 #include <fstream>
12 
15 {
16  fCounter = 0;
17 #ifdef CHECKPATH
18  fPath = CHECKPATH;
19 #else
20  fPath = "./";
21 #endif
22  fOverWrite = false;
24  fWriteFlag = true;
25 #ifdef READCHECK
26  fWriteFlag = false;
27 #endif
28 #ifdef WRITECHECK
29  fWriteFlag = true;
30 #endif
31 }
32 
35 {
36  fOverWrite = flag;
37 }
39 
44 {
45  std::stringstream sout;
46  sout << fCounter++;
47  std::string name = fPath + fFileName + sout.str() + ".chk";
48  if(!fWriteFlag)
49  {
52  return obj.Compare(copy,fOverWrite);
53  }
54  else
55  {
59  return true;
60  }
61 }
static void OpenWrite(const std::string &fileName, streamType=binary)
filename
Definition: stats.py:82
static TPZSavable * ReadFromFile()
static unsigned int OpenRead(const std::string &fileName, streamType=binary)
std::string fPath
Path where the file will be stored. If CHECKPATH is defined then this will be used as the file path...
bool fOverWrite
Boolean indicating whether the objects should be overwritten or not.
virtual bool Compare(TPZSavable *copy, bool override=false)
Compares the object for identity with the object pointed to, eventually copy the object.
Definition: TPZSavable.cpp:98
int fCounter
A counter which will be used to compose the file name.
TPZCheckConsistency(const std::string &filename)
Constructor indicating the root filename.
void SetOverWrite(bool flag=true)
Set the overwrite flag.
static void WriteToFile(const TPZSavable *)
bool CheckObject(TPZSavable &obj)
Reads or writes depending on the compiler directive.
bool fWriteFlag
Boolean indicating whether the object will write the objects to disk or read them.
std::string fFileName
base file name. This name has to be unique to avoid overwrites
This class defines the interface to save and restore objects from TPZStream objects. Persistency.
Definition: TPZSavable.h:67
obj
Definition: test.py:225