Home  · Classes  · Annotated Classes  · Modules  · Members  · Namespaces  · Related Pages

FuzzyStringComparator Class Reference

#include <OpenMS/CONCEPT/FuzzyStringComparator.h>

List of all members.


Detailed Description

Fuzzy comparison of strings, tolerates numeric differences.

Public Member Functions

const double & getAcceptableRelative () const
 Acceptable relative error (a number >= 1.0).
void setAcceptableRelative (const double rhs)
 Acceptable relative error (a number >= 1.0).
const double & getAcceptableAbsolute () const
 Acceptable absolute difference (a number >= 0.0).
void setAcceptableAbsolute (const double rhs)
 Acceptable absolute difference (a number >= 0.0).
const int & getVerboseLevel () const
 verbose level
void setVerboseLevel (const int rhs)
 verbose level
std::ostream & getLogDestination () const
 Log output is written to this destination.
void setLogDestination (std::ostream &rhs)
 Log output is written to this destination.
bool compare_strings (std::string const &lhs, std::string const &rhs)
 Compare two strings.
bool compare_streams (std::istream &input_1, std::istream &input_2)
 Compare two streams of input.
bool compare_files (const std::string &filename_1, const std::string &filename_2)
 Simple diff-like application to compare two input files. Numeric differences are tolerated up to a certain ratio or absolute difference.
the fabulous four
 FuzzyStringComparator ()
 Constructor.
virtual ~FuzzyStringComparator ()
 Destructor.
 FuzzyStringComparator (const FuzzyStringComparator &rhs)
 Copy constructor intentionally not implemented.
FuzzyStringComparatoroperator= (const FuzzyStringComparator &rhs)
 Assignment operator intentionally not implemented.

Protected Member Functions

bool compare_lines_ (std::string const &line_str_1, std::string const &line_str_2)
 Compare two lines of input.
void report_success_ () const
 Report good news.
void report_failure_ (char const *const message) const throw (AbortComparison)
 Report bad news.

Protected Attributes

std::ostream * log_dest_
 Log and results output goes here.
std::string input_1_name
 input_1 name
std::string input_2_name
 input_2 name
std::stringstream line_1
std::stringstream line_2
std::ios::pos_type line_1_pos
std::ios::pos_type line_2_pos
double ratio_max_allowed
 Maximum ratio of numbers allowed.
double ratio_max
 Maximum ratio of numbers observed so far.
double absdiff_max_allowed
 Maximum absolute difference of numbers allowed.
double absdiff_max
 Maximum difference of numbers observed so far.
double number_1
char letter_1
bool is_number_1
bool is_space_1
double number_2
char letter_2
bool is_number_2
bool is_space_2
bool is_absdiff_small
int line_num_1
int line_num_2
int line_num_1_max
int line_num_2_max
int verbose_level
bool is_status_success
 Has comparison been sucessful so far? Note: this flag is changed in report_failure_();.
std::string line_str_1_max
std::string line_str_2_max

Classes

struct  AbortComparison
 Internal exeption class. More...

Constructor & Destructor Documentation

FuzzyStringComparator (  ) 

Constructor.

virtual ~FuzzyStringComparator (  )  [virtual]

Destructor.

FuzzyStringComparator ( const FuzzyStringComparator rhs  ) 

Copy constructor intentionally not implemented.


Member Function Documentation

FuzzyStringComparator& operator= ( const FuzzyStringComparator rhs  ) 

Assignment operator intentionally not implemented.

const double& getAcceptableRelative (  )  const [inline]

Acceptable relative error (a number >= 1.0).

void setAcceptableRelative ( const double  rhs  )  [inline]

Acceptable relative error (a number >= 1.0).

const double& getAcceptableAbsolute (  )  const [inline]

Acceptable absolute difference (a number >= 0.0).

void setAcceptableAbsolute ( const double  rhs  )  [inline]

Acceptable absolute difference (a number >= 0.0).

const int& getVerboseLevel (  )  const [inline]

verbose level

void setVerboseLevel ( const int  rhs  )  [inline]

verbose level

std::ostream& getLogDestination (  )  const [inline]

Log output is written to this destination.

The default is std::cout. Use std::ostringstream etc. to save the output in a string.

void setLogDestination ( std::ostream &  rhs  )  [inline]

Log output is written to this destination.

The default is std::cout. Use std::ostringstream etc. to save the output in a string.

bool compare_strings ( std::string const &  lhs,
std::string const &  rhs 
)

Compare two strings.

This compares all lines of the input.

returns true in case of success

bool compare_streams ( std::istream &  input_1,
std::istream &  input_2 
)

Compare two streams of input.

This compares all lines of the input. Intended to be used for file streams.

returns true in case of success

bool compare_files ( const std::string &  filename_1,
const std::string &  filename_2 
)

Simple diff-like application to compare two input files. Numeric differences are tolerated up to a certain ratio or absolute difference.

where

Parameters:
filename_1 first input file
filename_2 second input file
Returns:
A non-zero exit status indicates that errors were found. For the meaning of other numbers, see the code.
See also:
acceptable_ratio

acceptable_absdiff

verbose_level

bool compare_lines_ ( std::string const &  line_str_1,
std::string const &  line_str_2 
) [protected]

Compare two lines of input.

This implements the core functionality. Intended to be used for a single line of input.

returns true in case of success

void report_success_ (  )  const [protected]

Report good news.

void report_failure_ ( char const *const   message  )  const throw (AbortComparison) [protected]

Report bad news.


Member Data Documentation

std::ostream* log_dest_ [protected]

Log and results output goes here.

std::string input_1_name [protected]

input_1 name

std::string input_2_name [protected]

input_2 name

std::stringstream line_1 [protected]

std::stringstream line_2 [protected]

std::ios::pos_type line_1_pos [protected]

std::ios::pos_type line_2_pos [protected]

double ratio_max_allowed [protected]

Maximum ratio of numbers allowed.

double ratio_max [protected]

Maximum ratio of numbers observed so far.

double absdiff_max_allowed [protected]

Maximum absolute difference of numbers allowed.

double absdiff_max [protected]

Maximum difference of numbers observed so far.

double number_1 [protected]

char letter_1 [protected]

bool is_number_1 [protected]

bool is_space_1 [protected]

double number_2 [protected]

char letter_2 [protected]

bool is_number_2 [protected]

bool is_space_2 [protected]

bool is_absdiff_small [protected]

int line_num_1 [protected]

int line_num_2 [protected]

int line_num_1_max [protected]

int line_num_2_max [protected]

int verbose_level [protected]

bool is_status_success [protected]

Has comparison been sucessful so far? Note: this flag is changed in report_failure_();.

std::string line_str_1_max [protected]

std::string line_str_2_max [protected]


The documentation for this class was generated from the following file:
Generated Tue Apr 1 15:36:43 2008 -- using doxygen 1.5.4 OpenMS / TOPP 1.1