Google OR-Tools
v9.15
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
status.cc
Go to the documentation of this file.
1
// Copyright 2010-2025 Google LLC
2
// Licensed under the Apache License, Version 2.0 (the "License");
3
// you may not use this file except in compliance with the License.
4
// You may obtain a copy of the License at
5
//
6
// http://www.apache.org/licenses/LICENSE-2.0
7
//
8
// Unless required by applicable law or agreed to in writing, software
9
// distributed under the License is distributed on an "AS IS" BASIS,
10
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
// See the License for the specific language governing permissions and
12
// limitations under the License.
13
14
#include "
ortools/glop/status.h
"
15
16
#include <string>
17
#include <utility>
18
19
#include "
ortools/base/logging.h
"
20
21
namespace
operations_research
{
22
namespace
glop
{
23
24
Status::Status
() : error_code_(
GLOP_OK
), error_message_() {}
25
26
Status::Status
(
ErrorCode
error_code
, std::string
error_message
)
27
: error_code_(
error_code
),
28
error_message_(
error_code
==
GLOP_OK
?
""
:
std
::move(
error_message
)) {}
29
30
std::string
GetErrorCodeString
(
Status::ErrorCode
error_code) {
31
switch
(error_code) {
32
case
Status::GLOP_OK
:
33
return
"GLOP_OK"
;
34
case
Status::ERROR_LU
:
35
return
"ERROR_LU"
;
36
case
Status::ERROR_BOUND
:
37
return
"ERROR_BOUND"
;
38
case
Status::ERROR_NULL
:
39
return
"ERROR_NULL"
;
40
case
Status::ERROR_INVALID_PROBLEM
:
41
return
"INVALID_PROBLEM"
;
42
}
43
// Fallback. We don't use "default:" so the compiler will return an error
44
// if we forgot one enum case above.
45
LOG(DFATAL) <<
"Invalid Status::ErrorCode "
<< error_code;
46
return
"UNKNOWN Status::ErrorCode"
;
47
}
48
49
}
// namespace glop
50
}
// namespace operations_research
logging.h
operations_research::glop::Status::error_code
ErrorCode error_code() const
Definition
status.h:56
operations_research::glop::Status::error_message
const std::string & error_message() const
Definition
status.h:57
operations_research::glop::Status::ErrorCode
ErrorCode
Definition
status.h:27
operations_research::glop::Status::GLOP_OK
@ GLOP_OK
Definition
status.h:29
operations_research::glop::Status::ERROR_INVALID_PROBLEM
@ ERROR_INVALID_PROBLEM
Definition
status.h:41
operations_research::glop::Status::ERROR_NULL
@ ERROR_NULL
Definition
status.h:38
operations_research::glop::Status::ERROR_LU
@ ERROR_LU
Definition
status.h:32
operations_research::glop::Status::ERROR_BOUND
@ ERROR_BOUND
Definition
status.h:35
operations_research::glop::Status::Status
Status()
Definition
status.cc:24
operations_research::glop
Definition
basis_representation.cc:25
operations_research::glop::GetErrorCodeString
std::string GetErrorCodeString(Status::ErrorCode error_code)
Definition
status.cc:30
operations_research
OR-Tools root namespace.
Definition
binary_indexed_tree.h:21
std
STL namespace.
status.h
ortools
glop
status.cc
Generated by
1.15.0