18 #ifndef __STATGEN_STATUS_H__
19 #define __STATGEN_STATUS_H__
22 #include "ErrorHandler.h"
102 void handleError(
Status newType,
const char* newMessage);
105 static const char* enumStatusString[];
108 std::string myMessage;
bool operator==(const StatGenStatus::Status &compStatus) const
Overload operator == to determine if the passed in type is equal to this status's type.
~StatGenStatus()
Destructor.
@ INVALID
invalid other than for sorting.
void reset()
Reset this status to a default state.
@ NO_MORE_RECS
NO_MORE_RECS: failed to read a record since there are no more to read either in the file or section i...
@ SUCCESS
method completed successfully.
Status getStatus() const
Return the enum for this status object.
static bool isContinuableStatus(StatGenStatus::Status status)
Returns whether or not it is "safe" to keep processing the file after the specified status return.
HandlingType
This specifies how this class should respond to errors.
This class is used to track the status results of some methods in the BAM classes.
StatGenStatus(ErrorHandler::HandlingType handleType=ErrorHandler::EXCEPTION)
Constructor that takes in the handling type, defaulting it to exception.
@ EXCEPTION
throw an exception for the error
@ FAIL_PARSE
failed to parse a record/header - invalid format.
@ FAIL_MEM
fail a memory allocation.
@ INVALID_SORT
record is invalid due to it not being sorted.
void setStatus(Status newStatus, const char *newMessage)
Set the status with the specified status enum and message.
Status
Return value enum for StatGenFile methods.
bool operator!=(const StatGenStatus::Status &compStatus) const
Overload operator != to determine if the passed in type is not equal to this status's type.
void addError(Status newStatus, const char *newMessage)
Add the specified error message to the status message, setting the status to newStatus if the current...
const char * getStatusMessage() const
Return the status message for this object.
@ FAIL_IO
method failed due to an I/O issue.
@ FAIL_ORDER
FAIL_ORDER: method failed because it was called out of order, like trying to read a file without open...
@ UNKNOWN
unknown result (default value should never be used)
static const char * getStatusString(StatGenStatus::Status statusEnum)
Return a string representation of the passed in status enum.
void setHandlingType(ErrorHandler::HandlingType handleType)
Set how to handle the errors when they are set.
StatGenStatus & operator=(Status newStatus)
Overload operator = to set the StatGen status type to the passed in status and to clear the message s...