1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#pragma once

#include <cstddef>
#include <ostream>
#include <string>

#include <boost/container_hash/hash.hpp>

namespace kooling::datamodel {

struct fingerprint
{
    std::string manufacturer;
    std::string model;
    std::string os_version;
};

inline std::ostream& operator<<(std::ostream& stream, const fingerprint& fp)
{
    stream << fp.manufacturer << ", " << fp.model << ", " << fp.os_version;
    return stream;
}

inline bool operator==(const fingerprint& lhs, const fingerprint& rhs)
{
    return lhs.manufacturer == rhs.manufacturer
        && lhs.model == rhs.model
        && lhs.os_version == rhs.os_version;
}

inline bool operator!=(const fingerprint& lhs, const fingerprint& rhs)
{
    return !(lhs == rhs);
}

inline std::size_t hash_value(const fingerprint& fp)<--- The function 'hash_value' is never used.
{
    std::size_t seed{};
    boost::hash_combine(seed, fp.manufacturer);
    boost::hash_combine(seed, fp.model);
    boost::hash_combine(seed, fp.os_version);
    return seed;
}

} // namespace kooling::datamodel