Chaste Commit::ca8ccdedf819b6e02855bc0e8e6f50bdecbc5208
AbstractFileComparison Class Reference

#include <AbstractFileComparison.hpp>

+ Inheritance diagram for AbstractFileComparison:
+ Collaboration diagram for AbstractFileComparison:

Public Member Functions

 AbstractFileComparison (const FileFinder &rFileFinder1, const FileFinder &rFileFinder2, bool calledCollectively, bool suppressOutput)
 
 AbstractFileComparison (std::string fileName1, std::string fileName2, bool calledCollectively, bool suppressOutput)
 
virtual ~AbstractFileComparison ()
 

Protected Member Functions

void ResetFiles ()
 
void SkipHeaderLines (unsigned numLinesToSkip)
 

Protected Attributes

std::string mFilename1
 
std::string mFilename2
 
std::ifstream * mpFile1
 
std::ifstream * mpFile2
 
unsigned mLineNum
 
bool mCalledCollectively
 
bool mSuppressOutput
 

Private Member Functions

void Setup ()
 

Detailed Description

Abstract class for comparing two files, looking for differences in tests.

Definition at line 50 of file AbstractFileComparison.hpp.

Constructor & Destructor Documentation

◆ AbstractFileComparison() [1/2]

AbstractFileComparison::AbstractFileComparison ( const FileFinder rFileFinder1,
const FileFinder rFileFinder2,
bool  calledCollectively,
bool  suppressOutput 
)
inline

Specify two files to compare, and open them for reading. Actual comparison is done by calling CompareFiles.

Parameters
rFileFinder1first file
rFileFinder2second file
calledCollectivelyIf true there will be a barrier before opening files, and only master compares contents.
suppressOutputIf true then no errors will go to TS_TRACE(). Should only be set for the test of this class.

Definition at line 63 of file AbstractFileComparison.hpp.

References Setup().

◆ AbstractFileComparison() [2/2]

AbstractFileComparison::AbstractFileComparison ( std::string  fileName1,
std::string  fileName2,
bool  calledCollectively,
bool  suppressOutput 
)
inline

Specify two files to compare, and open them for reading. Actual comparison is done by calling CompareFiles.

Parameters
fileName1first file
fileName2second file
calledCollectivelyIf true there will be a barrier before opening files, and only master compares contents.
suppressOutputIf true then no errors will go to TS_TRACE(). Should only be set for the test of this class.

Definition at line 84 of file AbstractFileComparison.hpp.

References Setup().

◆ ~AbstractFileComparison()

virtual AbstractFileComparison::~AbstractFileComparison ( )
inlinevirtual

Close the files being compared.

Definition at line 99 of file AbstractFileComparison.hpp.

References mpFile1, and mpFile2.

Member Function Documentation

◆ ResetFiles()

void AbstractFileComparison::ResetFiles ( )
inlineprotected

This method closes and reopens files so that another CompareFiles() command can be run on the same object.

Definition at line 131 of file AbstractFileComparison.hpp.

References PetscTools::AmMaster(), mCalledCollectively, mFilename1, mFilename2, mLineNum, mpFile1, and mpFile2.

Referenced by NumericFileComparison::CompareFiles(), and FileComparison::CompareFiles().

◆ Setup()

void AbstractFileComparison::Setup ( )
inlineprivate

Private method called only by the two constructors.

Definition at line 168 of file AbstractFileComparison.hpp.

References PetscTools::AmMaster(), PetscTools::Barrier(), EXCEPTION, mCalledCollectively, mFilename1, mFilename2, mLineNum, mpFile1, and mpFile2.

Referenced by AbstractFileComparison(), and AbstractFileComparison().

◆ SkipHeaderLines()

void AbstractFileComparison::SkipHeaderLines ( unsigned  numLinesToSkip)
inlineprotected

This helper method just moves forward the two file pointers to skip some header lines.

Parameters
numLinesToSkipThe number of header lines to skip

Definition at line 148 of file AbstractFileComparison.hpp.

References PetscTools::AmMaster(), mCalledCollectively, mLineNum, mpFile1, and mpFile2.

Referenced by NumericFileComparison::CompareFiles(), and FileComparison::CompareFiles().

Member Data Documentation

◆ mCalledCollectively

bool AbstractFileComparison::mCalledCollectively
protected

If true there will be a barrier before opening files, and only master compares contents.

Definition at line 123 of file AbstractFileComparison.hpp.

Referenced by NumericFileComparison::CompareFiles(), FileComparison::CompareFiles(), ResetFiles(), Setup(), and SkipHeaderLines().

◆ mFilename1

std::string AbstractFileComparison::mFilename1
protected

◆ mFilename2

std::string AbstractFileComparison::mFilename2
protected

◆ mLineNum

unsigned AbstractFileComparison::mLineNum
protected

Counter for the line number we are on (in FileComparision)

Definition at line 121 of file AbstractFileComparison.hpp.

Referenced by FileComparison::CompareFiles(), ResetFiles(), Setup(), and SkipHeaderLines().

◆ mpFile1

std::ifstream* AbstractFileComparison::mpFile1
protected

◆ mpFile2

std::ifstream* AbstractFileComparison::mpFile2
protected

◆ mSuppressOutput

bool AbstractFileComparison::mSuppressOutput
protected

Whether we should suppress output from this class, just for a clean looking test

Definition at line 126 of file AbstractFileComparison.hpp.

Referenced by NumericFileComparison::CompareFiles(), and FileComparison::CompareFiles().


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