Rivet: /Users/chrisg/software/rivet/include/Rivet/Tools/Cmp.fhh Source File

| Rivet 3.1.9

Cmp.fhh
1// -*- C++ -*-
2#ifndef RIVET_Cmp_FHH
3#define RIVET_Cmp_FHH
4
5namespace Rivet {
6
7
8 // Forward-declare the Cmp template class
9 template <typename T>
10 class Cmp;
11
12
13 /// Enumeration of possible value-comparison states
14 enum class CmpState {
15 UNDEF, EQ, NEQ
16 };
17
18 /// Representation of a CmpState as a string
19 inline std::string toString(const CmpState& cmpst) {
20 switch (cmpst) {
21 case CmpState::UNDEF: return "Cmp: ??";
22 case CmpState::EQ: return "Cmp: ==";
23 case CmpState::NEQ: return "Cmp: !=";
24 }
25 throw Error("CmpState value not in enum list");
26 }
27
28 /// Stream a CmpState via its toString representation
29 inline std::ostream& operator << (std::ostream& os, const CmpState& obj) {
30 os << toString(obj);
31 return os;
32 }
33
34}
35
36#endif