libdballe
9.9
dballe
db
v7
utils.h
1
#ifndef DBALLE_DB_V7_UTILS_H
2
#define DBALLE_DB_V7_UTILS_H
3
4
#include <
wreport/varinfo.h
>
5
#include <unordered_set>
6
7
namespace
dballe {
8
namespace
db {
9
namespace
v7 {
10
11
struct
IdVarcode
12
{
13
int
id;
14
wreport::Varcode
varcode;
15
16
IdVarcode
(
int
id
,
wreport::Varcode
varcode)
17
: id(
id
), varcode(varcode)
18
{
19
}
20
21
bool
operator==(
const
IdVarcode
&
o
)
const
{
return
std::tie(
id
, varcode) == std::tie(
o
.id,
o
.varcode); }
22
bool
operator!=(
const
IdVarcode
&
o
)
const
{
return
std::tie(
id
, varcode) != std::tie(
o
.id,
o
.varcode); }
23
bool
operator<
(
const
IdVarcode
&
o
)
const
{
return
std::tie(
id
, varcode) < std::tie(
o
.id,
o
.varcode); }
24
bool
operator>(
const
IdVarcode
&
o
)
const
{
return
std::tie(
id
, varcode) > std::tie(
o
.id,
o
.varcode); }
25
};
26
27
}
28
}
29
}
30
31
namespace
std
32
{
33
template
<>
struct
hash<dballe::db::v7::IdVarcode>
34
{
35
typedef
dballe::db::v7::IdVarcode
argument_type
;
36
typedef
std::size_t result_type;
37
result_type operator()(
argument_type
const
& s)
const
noexcept
38
{
39
result_type
const
h1 ( std::hash<int>{}(s.id) );
40
result_type
const
h2 ( std::hash<wreport::Varcode>{}(s.varcode) );
41
return
h1 ^ (h2 << 1);
42
}
43
};
44
}
45
46
47
#endif
dballe::db::v7::Tracer
Smart pointer for trace::Step objects, which calls done() when going out of scope.
Definition
db/v7/fwd.h:46
wreport::Varcode
uint16_t Varcode
dballe::db::v7::IdVarcode
Definition
utils.h:12
varinfo.h
Generated by
1.10.0