libStatGen Software 1
SamValidationError Class Reference

The SamValidationError class describes a validation error that occured, containing the error type, severity, and textual error message. More...

#include <SamValidation.h>

Public Types

enum  Severity { WARNING , ERROR }
 Severity of the error. More...
 
enum  Type {
  INVALID_QNAME , INVALID_REF_ID , INVALID_RNAME , INVALID_POS ,
  INVALID_MAPQ , INVALID_CIGAR , INVALID_MRNM , INVALID_QUAL ,
  INVALID_TAG
}
 Type of the error. More...
 

Public Member Functions

 SamValidationError (Type type, Severity severity, std::string Message)
 Constructor that sets the type, severity, and message for the validation error. More...
 
Type getType () const
 Return the type enum of this validation error object. More...
 
Severity getSeverity () const
 Return the severity enum of this validation error object. More...
 
const char * getMessage () const
 Return the error message of this validation error object. More...
 
const char * getTypeString () const
 Return the string representing this object's type of validation error. More...
 
const char * getSeverityString () const
 Return the string representing this object's severity of validation error. More...
 
void getErrorString (std::string &errorString) const
 Get the error string representing this object's error. More...
 
void printError () const
 Print a formatted output of the error to cerr. More...
 

Static Public Member Functions

static const char * getTypeString (Type type)
 Get the string representing the specified type of validation error. More...
 

Detailed Description

The SamValidationError class describes a validation error that occured, containing the error type, severity, and textual error message.

Definition at line 34 of file SamValidation.h.

Member Enumeration Documentation

◆ Severity

Severity of the error.

Enumerator
WARNING 

Warning is used if it is just an invalid value.

ERROR 

Error is used if parsing could not succeed.

Definition at line 38 of file SamValidation.h.

39 {
40 WARNING, ///< Warning is used if it is just an invalid value.
41 ERROR ///< Error is used if parsing could not succeed.
42 };
@ WARNING
Warning is used if it is just an invalid value.
Definition: SamValidation.h:40
@ ERROR
Error is used if parsing could not succeed.
Definition: SamValidation.h:41

◆ Type

Type of the error.

TODO: NOT ALL INVALID TYPES HAVE BEEN ADDED SINCE NOT ALL VALIDATION IS COMPLETE YET

Enumerator
INVALID_QNAME 

Invalid read/query name.

INVALID_REF_ID 

Invalid reference id.

INVALID_RNAME 

Invalid reference name.

INVALID_POS 

Invalid position.

INVALID_MAPQ 

Invalid mapping quality.

INVALID_CIGAR 

Invalid CIGAR.

INVALID_MRNM 

Invalid mate/next fragment reference name.

INVALID_QUAL 

Invalid base quality.

INVALID_TAG 

Invalid tag.

Definition at line 47 of file SamValidation.h.

48 {
49 INVALID_QNAME, ///< Invalid read/query name
50 INVALID_REF_ID, ///< Invalid reference id
51 INVALID_RNAME, ///< Invalid reference name
52 INVALID_POS, ///< Invalid position
53 INVALID_MAPQ, ///< Invalid mapping quality
54 INVALID_CIGAR, ///< Invalid CIGAR
55 INVALID_MRNM, ///< Invalid mate/next fragment reference name
56 INVALID_QUAL, ///< Invalid base quality
57 INVALID_TAG ///< Invalid tag
58 };
@ INVALID_REF_ID
Invalid reference id.
Definition: SamValidation.h:50
@ INVALID_TAG
Invalid tag.
Definition: SamValidation.h:57
@ INVALID_QNAME
Invalid read/query name.
Definition: SamValidation.h:49
@ INVALID_MRNM
Invalid mate/next fragment reference name.
Definition: SamValidation.h:55
@ INVALID_CIGAR
Invalid CIGAR.
Definition: SamValidation.h:54
@ INVALID_MAPQ
Invalid mapping quality.
Definition: SamValidation.h:53
@ INVALID_POS
Invalid position.
Definition: SamValidation.h:52
@ INVALID_RNAME
Invalid reference name.
Definition: SamValidation.h:51
@ INVALID_QUAL
Invalid base quality.
Definition: SamValidation.h:56

Constructor & Destructor Documentation

◆ SamValidationError()

SamValidationError::SamValidationError ( Type  type,
Severity  severity,
std::string  Message 
)

Constructor that sets the type, severity, and message for the validation error.

Definition at line 45 of file SamValidation.cpp.

47{
48 myType = type;
49 mySeverity = severity;
50 myMessage = message;
51}

References SamValidationError().

Referenced by SamValidationError().

Member Function Documentation

◆ getErrorString()

void SamValidationError::getErrorString ( std::string &  errorString) const

Get the error string representing this object's error.

Definition at line 84 of file SamValidation.cpp.

85{
86 errorString = getTypeString();
87 errorString += " (";
88 errorString += getSeverityString();
89 errorString += ") : ";
90 errorString += getMessage();
91 errorString += "\n";
92}
const char * getSeverityString() const
Return the string representing this object's severity of validation error.
const char * getMessage() const
Return the error message of this validation error object.
const char * getTypeString() const
Return the string representing this object's type of validation error.

References getMessage(), getSeverityString(), and getTypeString().

◆ getMessage()

const char * SamValidationError::getMessage ( ) const

Return the error message of this validation error object.

Definition at line 66 of file SamValidation.cpp.

67{
68 return(myMessage.c_str());
69}

Referenced by getErrorString().

◆ getSeverity()

SamValidationError::Severity SamValidationError::getSeverity ( ) const

Return the severity enum of this validation error object.

Definition at line 60 of file SamValidation.cpp.

61{
62 return(mySeverity);
63}

◆ getSeverityString()

const char * SamValidationError::getSeverityString ( ) const

Return the string representing this object's severity of validation error.

Definition at line 78 of file SamValidation.cpp.

79{
80 return(enumSeverityString[mySeverity]);
81}

Referenced by getErrorString().

◆ getType()

SamValidationError::Type SamValidationError::getType ( ) const

Return the type enum of this validation error object.

Definition at line 54 of file SamValidation.cpp.

55{
56 return(myType);
57}

◆ getTypeString() [1/2]

const char * SamValidationError::getTypeString ( ) const

Return the string representing this object's type of validation error.

Definition at line 72 of file SamValidation.cpp.

73{
74 return(enumTypeString[myType]);
75}

Referenced by getErrorString().

◆ getTypeString() [2/2]

const char * SamValidationError::getTypeString ( Type  type)
static

Get the string representing the specified type of validation error.

Definition at line 39 of file SamValidation.cpp.

40{
41 return(enumTypeString[type]);
42}

◆ printError()

void SamValidationError::printError ( ) const

Print a formatted output of the error to cerr.

Definition at line 95 of file SamValidation.cpp.

96{
97 std::cerr << this;
98}

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