OR-Tools  9.3
enums.h File Reference

Go to the source code of this file.

Classes

struct  Enum< E >
 
struct  EnumProto< P >
 

Namespaces

namespace  operations_research
 Collection of objects used to extend the Constraint Solver library.
 
namespace  operations_research::math_opt
 

Macros

#define MATH_OPT_DEFINE_ENUM(CppEnum, proto_unspecified_value)
 

Typedefs

using ProtoEnumIsValid = bool(*)(int)
 

Functions

template<typename E >
Enum< E >::Proto EnumToProto (const std::optional< E > value)
 
template<typename E >
Enum< E >::Proto EnumToProto (const E value)
 
template<typename P >
std::optional< typename EnumProto< P >::Cpp > EnumFromProto (const P proto_value)
 
template<typename E >
absl::string_view EnumToString (const E value)
 
template<typename E >
std::optional< absl::string_view > EnumToOptString (const E value)
 
template<typename E >
std::optional< E > EnumFromString (const absl::string_view str)
 
template<typename E , typename = std::enable_if_t<Enum<E>::kIsImplemented>>
std::ostream & operator<< (std::ostream &out, const E value)
 
template<typename E , typename = std::enable_if_t<Enum<E>::kIsImplemented>>
std::ostream & operator<< (std::ostream &out, const std::optional< E > opt_value)
 

Macro Definition Documentation

◆ MATH_OPT_DEFINE_ENUM

#define MATH_OPT_DEFINE_ENUM (   CppEnum,
  proto_unspecified_value 
)
Value:
template <> \
struct Enum<CppEnum> { \
static constexpr bool kIsImplemented = true; \
using Proto = CppEnum##Proto; \
static constexpr Proto kProtoUnspecifiedValue = proto_unspecified_value; \
static std::optional<absl::string_view> ToOptString(CppEnum value); \
static absl::Span<const CppEnum> AllValues(); \
}; \
\
template <> \
struct EnumProto<CppEnum##Proto> { \
using Cpp = CppEnum; \
static constexpr CppEnum##Proto kMin = CppEnum##Proto##_MIN; \
static constexpr CppEnum##Proto kMax = CppEnum##Proto##_MAX; \
static constexpr ProtoEnumIsValid kIsValid = CppEnum##Proto##_IsValid; \
} /* missing semicolon to force adding it at the invocation site */
int64_t value
bool(*)(int) ProtoEnumIsValid
Definition: enums.h:157

Definition at line 319 of file enums.h.