OR-Tools
8.1
status.cc
Go to the documentation of this file.
1
// Copyright 2010-2018 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 <utility>
17
18
#include "
ortools/base/logging.h
"
19
20
namespace
operations_research
{
21
namespace
glop {
22
23
Status::Status
() : error_code_(GLOP_OK), error_message_() {}
24
25
Status::Status
(
ErrorCode
error_code, std::string error_message)
26
: error_code_(error_code),
27
error_message_(error_code == GLOP_OK ?
""
: std::move(error_message)) {}
28
29
std::string
GetErrorCodeString
(
Status::ErrorCode
error_code) {
30
switch
(error_code) {
31
case
Status::GLOP_OK
:
32
return
"GLOP_OK"
;
33
case
Status::ERROR_LU
:
34
return
"ERROR_LU"
;
35
case
Status::ERROR_BOUND
:
36
return
"ERROR_BOUND"
;
37
case
Status::ERROR_NULL
:
38
return
"ERROR_NULL"
;
39
case
Status::ERROR_INVALID_PROBLEM
:
40
return
"INVALID_PROBLEM"
;
41
}
42
// Fallback. We don't use "default:" so the compiler will return an error
43
// if we forgot one enum case above.
44
LOG
(DFATAL) <<
"Invalid Status::ErrorCode "
<< error_code;
45
return
"UNKNOWN Status::ErrorCode"
;
46
}
47
48
}
// namespace glop
49
}
// namespace operations_research
operations_research::glop::Status::GLOP_OK
@ GLOP_OK
Definition:
status.h:29
LOG
#define LOG(severity)
Definition:
base/logging.h:420
operations_research::glop::Status::ERROR_INVALID_PROBLEM
@ ERROR_INVALID_PROBLEM
Definition:
status.h:41
logging.h
operations_research
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition:
dense_doubly_linked_list.h:21
operations_research::glop::GetErrorCodeString
std::string GetErrorCodeString(Status::ErrorCode error_code)
Definition:
status.cc:29
operations_research::glop::Status::ERROR_LU
@ ERROR_LU
Definition:
status.h:32
operations_research::glop::Status::Status
Status()
Definition:
status.cc:23
operations_research::glop::Status::ERROR_BOUND
@ ERROR_BOUND
Definition:
status.h:35
operations_research::glop::Status::ErrorCode
ErrorCode
Definition:
status.h:27
status.h
operations_research::glop::Status::ERROR_NULL
@ ERROR_NULL
Definition:
status.h:38
ortools
glop
status.cc
Generated by
1.8.20