18 #include "StatGenStatus.h"
20 const char* StatGenStatus::enumStatusString[] = {
35 return(enumStatusString[statusEnum]);
56 : myHandlingType(handleType)
78 myHandlingType = handleType;
88 myMessage += newMessage;
92 handleError(newStatus, newMessage);
111 myMessage += newMessage;
115 handleError(newStatus, newMessage);
126 myType = newStatus.myType;
132 myMessage += newStatus.myMessage;
136 handleError(newStatus.myType, newStatus.myMessage.c_str());
151 return(myMessage.c_str());
164 handleError(newStatus,
"");
173 myType = newStatus.myType;
174 myMessage = newStatus.myMessage;
175 myHandlingType = newStatus.myHandlingType;
184 return(compStatus != myType);
192 return(compStatus == myType);
196 void StatGenStatus::handleError(Status newStatus,
const char* newMessage)
204 message += newMessage;
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.
static void handleError(const char *message, HandlingType handlingType=EXCEPTION)
Handle an error based on the error handling type.
@ 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.
@ FAIL_PARSE
failed to parse a record/header - invalid format.
@ 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.
@ 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...