Loading...
Searching...
No Matches
SamValidationErrors Class Reference

The SamValidationErrors class is a container class that holds SamValidationError Objects, allowing a validation method to return all of the invalid errors rather than just one. More...

`#include <SamValidation.h>`

## Public Member Functions

| SamValidationErrors ()
| Constructor.
| ~SamValidationErrors ()
| Destructor.
void | clear ()
| Remove all the errors from the container.
void | addError (SamValidationError::Type newType, SamValidationError::Severity newSeverity, const char *newMessage)
| Add the specified error to this container.
unsigned int | numErrors ()
| Return the number of validation errors contained in this object.
const SamValidationError * | getNextError ()
| Return a pointer to the next error without removing it from the container, and returning null once all errors have been retrieved until resetErrorIter is called.
void | resetErrorIter ()
| Reset the iterator to the begining of the errors.
void | getErrorString (std::string &errorString) const
| Append the error messages contained in this container to the passed in string.

## Detailed Description

The SamValidationErrors class is a container class that holds SamValidationError Objects, allowing a validation method to return all of the invalid errors rather than just one.

Definition at line 116 of file SamValidation.h.

## Constructor & Destructor Documentation

## SamValidationErrors()

SamValidationErrors::SamValidationErrors | ( |  | ) |

Constructor.

Definition at line 103 of file SamValidation.cpp.

: myValidationErrors()
{
myErrorIter = myValidationErrors.begin();
}

## ~SamValidationErrors()

SamValidationErrors::~SamValidationErrors | ( |  | ) |

Destructor.

Definition at line 111 of file SamValidation.cpp.

{
clear();
}
SamValidationErrors::clear
void clear()
Remove all the errors from the container.
Definition SamValidation.cpp:117

References clear().

## Member Function Documentation

## addError()

void SamValidationErrors::addError | ( | SamValidationError::Type | newType,
|  | SamValidationError::Severity | newSeverity,
|  | const char * | newMessage
| ) |  |

Add the specified error to this container.

Definition at line 132 of file SamValidation.cpp.

{
myValidationErrors.push_back(new SamValidationError(newType,
newSeverity,
newMessage));
// If this is the first element in the list, set the iterator.
if(myValidationErrors.size() == 1)
{
// set the iterator to the first element.
myErrorIter = myValidationErrors.begin();
}
}
SamValidationError
The SamValidationError class describes a validation error that occured, containing the error type,...
Definition SamValidation.h:35

Referenced by SamValidator::isValid1BasedPos(), SamValidator::isValidCigar(), SamValidator::isValidQname(), SamValidator::isValidQuality(), SamValidator::isValidRefID(), SamValidator::isValidRname(), SamValidator::isValidRname(), and SamValidator::isValidTags().

## clear()

void SamValidationErrors::clear | ( |  | ) |

Remove all the errors from the container.

Definition at line 117 of file SamValidation.cpp.

{
// Clear the errors.
std::list<const SamValidationError*>::iterator errorIter;
for(errorIter = myValidationErrors.begin();
errorIter != myValidationErrors.end(); ++errorIter)
{
delete *errorIter;
*errorIter = NULL;
}
myValidationErrors.clear();
myErrorIter = myValidationErrors.end();
}

Referenced by ~SamValidationErrors().

## getErrorString()

void SamValidationErrors::getErrorString | ( | std::string & | errorString | ) | const

Append the error messages contained in this container to the passed in string.

Definition at line 180 of file SamValidation.cpp.

{
for(std::list<const SamValidationError*>::
const_iterator validationErrorIter =
myValidationErrors.begin();
validationErrorIter != myValidationErrors.end();
validationErrorIter++)
{
std::string error = "";
(*validationErrorIter)->getErrorString(error);
errorString += error;
}
}

Referenced by SamRecord::isValid().

## getNextError()

const SamValidationError * SamValidationErrors::getNextError | ( |  | ) |

Return a pointer to the next error without removing it from the container, and returning null once all errors have been retrieved until resetErrorIter is called.

Definition at line 160 of file SamValidation.cpp.

{
if(myErrorIter == myValidationErrors.end())
{
// at the end of the list, return null.
return(NULL);
}
// Not at the end of the list, return the last element and increment.
return(*myErrorIter++);
}

## numErrors()

unsigned int SamValidationErrors::numErrors | ( |  | ) |

Return the number of validation errors contained in this object.

Definition at line 151 of file SamValidation.cpp.

{
return(myValidationErrors.size());
}

## resetErrorIter()

void SamValidationErrors::resetErrorIter | ( |  | ) |

Reset the iterator to the begining of the errors.

Definition at line 173 of file SamValidation.cpp.

{
myErrorIter = myValidationErrors.begin();
}

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

- bam/SamValidation.h
- bam/SamValidation.cpp