OR-Tools  8.2
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
19
20namespace operations_research {
21namespace glop {
22
23Status::Status() : error_code_(GLOP_OK), error_message_() {}
24
25Status::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
29std::string GetErrorCodeString(Status::ErrorCode error_code) {
30 switch (error_code) {
31 case Status::GLOP_OK:
32 return "GLOP_OK";
34 return "ERROR_LU";
36 return "ERROR_BOUND";
38 return "ERROR_NULL";
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
#define LOG(severity)
Definition: base/logging.h:420
std::string GetErrorCodeString(Status::ErrorCode error_code)
Definition: status.cc:29
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
STL namespace.