Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <optional>
#include <ostream>
#include <sstream>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>
#include "absl/container/inlined_vector.h"
Go to the source code of this file.
Classes | |
struct | operations_research::base::internal_dump_vars::print_fields |
class | operations_research::base::internal_dump_vars::Dump< F > |
Namespaces | |
namespace | operations_research |
In SWIG mode, we don't want anything besides these top-level includes. | |
namespace | operations_research::base |
namespace | operations_research::base::internal_dump_vars |
Macros | |
#define | DUMP_FOR_EACH_N0(F) |
#define | DUMP_FOR_EACH_N1(F, a) |
#define | DUMP_FOR_EACH_N2(F, a, ...) |
#define | DUMP_FOR_EACH_N3(F, a, ...) |
#define | DUMP_FOR_EACH_N4(F, a, ...) |
#define | DUMP_FOR_EACH_N5(F, a, ...) |
#define | DUMP_FOR_EACH_N6(F, a, ...) |
#define | DUMP_FOR_EACH_N7(F, a, ...) |
#define | DUMP_FOR_EACH_N8(F, a, ...) |
#define | DUMP_FOR_EACH_N9(F, a, ...) |
#define | DUMP_FOR_EACH_N10(F, a, ...) |
#define | DUMP_FOR_EACH_N11(F, a, ...) |
#define | DUMP_CONCATENATE(x, y) |
#define | DUMP_FOR_EACH_(N, F, ...) |
#define | DUMP_NARG(...) |
#define | DUMP_NARG_(...) |
#define | DUMP_ARG_N(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, N, ...) |
#define | DUMP_RSEQ_N() |
#define | DUMP_FOR_EACH(F, ...) |
#define | DUMP_VARS(...) |
#define | DUMP_STRINGIZE(a) |
#define | DUMP_STRINGIFY(...) |
#define | DUMP_IDENTITY(...) |
Returns the arguments. | |
#define | DUMP_RM_PARENS(...) |
Removes parenthesis. Requires argument enclosed in parenthesis. | |
#define | DUMP_GEN_ONE_BINDING(a) |
#define | DUMP_GEN_BINDING(binding) |
#define | DUMP_VARS_WITH_BINDINGS(binding, ...) |
Typedefs | |
using | operations_research::base::internal_dump_vars::DumpNames = ::std::vector<::std::string> |
Functions | |
template<typename T > | |
std::ostream & | operations_research::base::internal_dump_vars::operator<< (std::ostream &os, const ::absl::InlinedVector< T, 8 > &vec) |
needed by routing | |
template<typename T > | |
std::ostream & | operations_research::base::internal_dump_vars::operator<< (std::ostream &os, const ::std::vector< T > &vec) |
needed by algorithms tests | |
template<typename T > | |
std::ostream & | operations_research::base::internal_dump_vars::operator<< (std::ostream &os, const ::std::optional< T > &opt) |
template<class F > | |
Dump< F > | operations_research::base::internal_dump_vars::make_dump_vars (DumpNames &&names, F f) |
#define DUMP_ARG_N | ( | _1, | |
_2, | |||
_3, | |||
_4, | |||
_5, | |||
_6, | |||
_7, | |||
_8, | |||
_9, | |||
_10, | |||
_11, | |||
N, | |||
... ) |
Definition at line 72 of file dump_vars.h.
Definition at line 66 of file dump_vars.h.
#define DUMP_FOR_EACH | ( | F, | |
... ) |
Definition at line 74 of file dump_vars.h.
#define DUMP_FOR_EACH_ | ( | N, | |
F, | |||
... ) |
Definition at line 67 of file dump_vars.h.
#define DUMP_FOR_EACH_N0 | ( | F | ) |
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. DUMP_VARS() is a convenience macro for writing objects to text logs. It prints all of its arguments as key-value pairs.
Example: int foo = 42; vector<int> bar = {1, 2, 3}; ///< Prints: foo = 42, bar.size() = 3 LOG(INFO) << DUMP_VARS(foo, bar.size());
DUMP_VARS() produces high quality human-readable output for most types: builtin types, strings, anything with operator<<.
DUMP_VARS() accepts at most 8 arguments.
Structured bindings require an extra step to make DUMP_VARS print them. They need to be listed as first argument of DUMP_VARS_WITH_BINDINGS:
for (const auto& [x, y, z] : Foo()) { ///< Would not compile: ///< LOG(INFO) << DUMP_VARS(x, *y, f(z), other_var); LOG(INFO) << DUMP_VARS_WITH_BINDINGS((x, y, z), x, *y, f(z), other_var); }
Definition at line 53 of file dump_vars.h.
#define DUMP_FOR_EACH_N1 | ( | F, | |
a ) |
Definition at line 54 of file dump_vars.h.
#define DUMP_FOR_EACH_N10 | ( | F, | |
a, | |||
... ) |
Definition at line 63 of file dump_vars.h.
#define DUMP_FOR_EACH_N11 | ( | F, | |
a, | |||
... ) |
Definition at line 64 of file dump_vars.h.
#define DUMP_FOR_EACH_N2 | ( | F, | |
a, | |||
... ) |
Definition at line 55 of file dump_vars.h.
#define DUMP_FOR_EACH_N3 | ( | F, | |
a, | |||
... ) |
Definition at line 56 of file dump_vars.h.
#define DUMP_FOR_EACH_N4 | ( | F, | |
a, | |||
... ) |
Definition at line 57 of file dump_vars.h.
#define DUMP_FOR_EACH_N5 | ( | F, | |
a, | |||
... ) |
Definition at line 58 of file dump_vars.h.
#define DUMP_FOR_EACH_N6 | ( | F, | |
a, | |||
... ) |
Definition at line 59 of file dump_vars.h.
#define DUMP_FOR_EACH_N7 | ( | F, | |
a, | |||
... ) |
Definition at line 60 of file dump_vars.h.
#define DUMP_FOR_EACH_N8 | ( | F, | |
a, | |||
... ) |
Definition at line 61 of file dump_vars.h.
#define DUMP_FOR_EACH_N9 | ( | F, | |
a, | |||
... ) |
Definition at line 62 of file dump_vars.h.
#define DUMP_GEN_BINDING | ( | binding | ) |
Definition at line 89 of file dump_vars.h.
#define DUMP_GEN_ONE_BINDING | ( | a | ) |
Definition at line 88 of file dump_vars.h.
#define DUMP_IDENTITY | ( | ... | ) |
#define DUMP_NARG | ( | ... | ) |
Definition at line 70 of file dump_vars.h.
#define DUMP_NARG_ | ( | ... | ) |
Definition at line 71 of file dump_vars.h.
#define DUMP_RM_PARENS | ( | ... | ) |
Removes parenthesis. Requires argument enclosed in parenthesis.
Definition at line 86 of file dump_vars.h.
#define DUMP_RSEQ_N | ( | ) |
Definition at line 73 of file dump_vars.h.
#define DUMP_STRINGIFY | ( | ... | ) |
Definition at line 81 of file dump_vars.h.
#define DUMP_STRINGIZE | ( | a | ) |
Definition at line 80 of file dump_vars.h.
#define DUMP_VARS | ( | ... | ) |
Definition at line 77 of file dump_vars.h.
#define DUMP_VARS_WITH_BINDINGS | ( | binding, | |
... ) |
Definition at line 92 of file dump_vars.h.