14#ifndef OR_TOOLS_GLOP_STATUS_H_
15#define OR_TOOLS_GLOP_STATUS_H_
19#include "absl/base/port.h"
64 std::string error_message_;
71#define GLOP_RETURN_IF_ERROR(function_call) \
73 Status return_status = function_call; \
74 if (!return_status.ok()) return return_status; \
78#define GLOP_RETURN_AND_LOG_ERROR(error_code, message) \
80 std::string error_message = message; \
81 LOG(ERROR) << GetErrorCodeString(error_code) << ": " << error_message; \
82 return Status(error_code, error_message); \
86#define GLOP_RETURN_ERROR_IF_NULL(arg) \
87 if (arg == nullptr) { \
88 const std::string variable_name = #arg; \
89 std::string error_message = variable_name + " must not be null."; \
90 LOG(DFATAL) << error_message; \
91 return Status(Status::ERROR_NULL, error_message); \
ErrorCode error_code() const
Accessors.
static Status OK()
Improves readability but identical to 0-arg constructor.
const std::string & error_message() const
ErrorCode
Possible kinds of errors.
@ GLOP_OK
Not an error. Returned on success.
@ ERROR_INVALID_PROBLEM
The linear program is invalid or it does not have the required format.
@ ERROR_NULL
A pointer argument was NULL when it shouldn't be.
@ ERROR_LU
The LU factorization of the current basis couldn't be computed.
@ ERROR_BOUND
The current variable values are out of their bound modulo the tolerance.
Status()
Creates a "successful" status.
std::string GetErrorCodeString(Status::ErrorCode error_code)
Returns the string representation of the ErrorCode enum.
In SWIG mode, we don't want anything besides these top-level includes.