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;
~StatGenStatus()
Destructor.
unknown result (default value should never be used)
StatGenStatus & operator=(Status newStatus)
Overload operator = to set the StatGen status type to the passed in status and to clear the message s...
This class is used to track the status results of some methods in the BAM classes.
static bool isContinuableStatus(StatGenStatus::Status status)
Returns whether or not it is "safe" to keep processing the file after the specified status return...
StatGenStatus(ErrorHandler::HandlingType handleType=ErrorHandler::EXCEPTION)
Constructor that takes in the handling type, defaulting it to exception.
Status getStatus() const
Return the enum for this status object.
void setHandlingType(ErrorHandler::HandlingType handleType)
Set how to handle the errors when they are set.
method completed successfully.
failed to parse a record/header - invalid format.
void setStatus(Status newStatus, const char *newMessage)
Set the status with the specified status enum and message.
bool operator!=(const StatGenStatus::Status &compStatus) const
Overload operator != to determine if the passed in type is not equal to this status's type...
invalid other than for sorting.
NO_MORE_RECS: failed to read a record since there are no more to read either in the file or section i...
bool operator==(const StatGenStatus::Status &compStatus) const
Overload operator == to determine if the passed in type is equal to this status's type...
HandlingType
This specifies how this class should respond to errors.
void reset()
Reset this status to a default state.
static const char * getStatusString(StatGenStatus::Status statusEnum)
Return a string representation of the passed in status enum.
const char * getStatusMessage() const
Return the status message for this object.
record is invalid due to it not being sorted.
Status
Return value enum for StatGenFile methods.
void addError(Status newStatus, const char *newMessage)
Add the specified error message to the status message, setting the status to newStatus if the current...
static void handleError(const char *message, HandlingType handlingType=EXCEPTION)
Handle an error based on the error handling type.