OR-Tools  9.3
strong_integers.h File Reference

Go to the source code of this file.

Classes

class  StrongIndex< StrongIndexName >
 
class  StrongInt64< StrongIntegerName >
 
struct  hash< operations_research::StrongIndex< Tag > >
 
struct  hash< operations_research::StrongInt64< Tag > >
 

Namespaces

namespace  operations_research
 Collection of objects used to extend the Constraint Solver library.
 
namespace  std
 STL namespace.
 

Macros

#define DEFINE_STRONG_INDEX_TYPE(index_type_name)
 
#define DEFINE_STRONG_INT64_TYPE(integer_type_name)
 
#define STRONG_ASSIGNMENT_OP(StrongClass, IntType, op)
 
#define INCREMENT_AND_DECREMENT_OPERATORS
 
#define STRONG_TYPE_ARITHMETIC_OP(StrongType, IntType, op)
 
#define STRONG_TYPE_COMPARISON_OP(StrongType, IntType, op)
 

Functions

template<typename StrongIndexName >
std::ostream & operator<< (std::ostream &os, StrongIndex< StrongIndexName > arg)
 
template<typename StrongIntegerName >
std::ostream & operator<< (std::ostream &os, StrongInt64< StrongIntegerName > arg)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongIndex, int,+)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongIndex, int, -)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongIndex, int, *)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongIndex, int, %)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongInt64, int64_t,+)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongInt64, int64_t, -)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongInt64, int64_t, *)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongInt64, int64_t,/)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongInt64, int64_t,<<)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongInt64, int64_t, > >)
 
 STRONG_TYPE_ARITHMETIC_OP (StrongInt64, int64_t, %)
 
 STRONG_TYPE_COMPARISON_OP (StrongIndex, int,==)
 
 STRONG_TYPE_COMPARISON_OP (StrongIndex, int, !=)
 
 STRONG_TYPE_COMPARISON_OP (StrongIndex, int,<=)
 
 STRONG_TYPE_COMPARISON_OP (StrongIndex, int, >=)
 
 STRONG_TYPE_COMPARISON_OP (StrongInt64, int64_t,==)
 
 STRONG_TYPE_COMPARISON_OP (StrongInt64, int64_t, !=)
 
 STRONG_TYPE_COMPARISON_OP (StrongInt64, int64_t,<=)
 
 STRONG_TYPE_COMPARISON_OP (StrongInt64, int64_t, >=)
 
template<typename StrongIndexName , typename H >
AbslHashValue (H h, const StrongIndex< StrongIndexName > &i)
 
template<typename StrongIntegerName , typename H >
AbslHashValue (H h, const StrongInt64< StrongIntegerName > &i)
 

Macro Definition Documentation

◆ DEFINE_STRONG_INDEX_TYPE

#define DEFINE_STRONG_INDEX_TYPE (   index_type_name)
Value:
struct index_type_name##_index_tag_ { \
static constexpr absl::string_view TypeName() { return #index_type_name; } \
}; \
typedef ::operations_research::StrongIndex<index_type_name##_index_tag_> \
index_type_name;

Definition at line 72 of file strong_integers.h.

◆ DEFINE_STRONG_INT64_TYPE

#define DEFINE_STRONG_INT64_TYPE (   integer_type_name)
Value:
struct integer_type_name##_integer_tag_ { \
static constexpr absl::string_view TypeName() { \
return #integer_type_name; \
} \
}; \
typedef ::operations_research::StrongInt64<integer_type_name##_integer_tag_> \
integer_type_name;

Definition at line 83 of file strong_integers.h.

◆ INCREMENT_AND_DECREMENT_OPERATORS

#define INCREMENT_AND_DECREMENT_OPERATORS
Value:
ThisType& operator++() { \
++value_; \
return *this; \
} \
const ThisType operator++(int v) { \
ThisType temp(*this); \
++value_; \
return temp; \
} \
ThisType& operator--() { \
--value_; \
return *this; \
} \
const ThisType operator--(int v) { \
ThisType temp(*this); \
--value_; \
return temp; \
}

Definition at line 109 of file strong_integers.h.

◆ STRONG_ASSIGNMENT_OP

#define STRONG_ASSIGNMENT_OP (   StrongClass,
  IntType,
  op 
)
Value:
ThisType& operator op(const ThisType& arg_value) { \
value_ op arg_value.value(); \
return *this; \
} \
ThisType& operator op(IntType arg_value) { \
value_ op arg_value; \
return *this; \
}

Definition at line 99 of file strong_integers.h.

◆ STRONG_TYPE_ARITHMETIC_OP

#define STRONG_TYPE_ARITHMETIC_OP (   StrongType,
  IntType,
  op 
)
Value:
template <typename StrongName> \
constexpr StrongType<StrongName> operator op(StrongType<StrongName> id_1, \
StrongType<StrongName> id_2) { \
return StrongType<StrongName>(id_1.value() op id_2.value()); \
} \
template <typename StrongName> \
constexpr StrongType<StrongName> operator op(StrongType<StrongName> id, \
IntType arg_val) { \
return StrongType<StrongName>(id.value() op arg_val); \
} \
template <typename StrongName> \
constexpr StrongType<StrongName> operator op(IntType arg_val, \
StrongType<StrongName> id) { \
return StrongType<StrongName>(arg_val op id.value()); \
}
int64_t value

Definition at line 265 of file strong_integers.h.

◆ STRONG_TYPE_COMPARISON_OP

#define STRONG_TYPE_COMPARISON_OP (   StrongType,
  IntType,
  op 
)
Value:
template <typename StrongName> \
static inline constexpr bool operator op(StrongType<StrongName> id_1, \
StrongType<StrongName> id_2) { \
return id_1.value() op id_2.value(); \
} \
template <typename StrongName> \
static inline constexpr bool operator op(StrongType<StrongName> id, \
IntType val) { \
return id.value() op val; \
} \
template <typename StrongName> \
static inline constexpr bool operator op(IntType val, \
StrongType<StrongName> id) { \
return val op id.value(); \
}

Definition at line 297 of file strong_integers.h.