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