aboutsummaryrefslogtreecommitdiffstats
path: root/staging_vespalib/src/vespa/vespalib/metrics/metric_point_id.h
blob: f9d788a0f921c5b5447bcd0db58bb00244ace941 (plain) (blame)
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
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once

#include "metric_id.h"
#include "point.h"
#include <functional>

namespace vespalib {
namespace metrics {

/** class to use as a map key, identifying a metric and a point */
struct MetricPointId {
    const MetricId _name;
    const Point _point;

    MetricPointId() = delete;

    MetricPointId(MetricId name, Point point)
        : _name(name), _point(point) {}

    bool operator< (const MetricPointId &other) const {
        if (_name != other._name) {
            return _name < other._name;
        }
        return _point < other._point;
    }
    bool operator== (const MetricPointId &other) const {
        return (_name == other._name &&
                _point == other._point);
    }

    MetricId name() const { return _name; }
    Point point() const { return _point; }

};

} // namespace vespalib::metrics
} // namespace vespalib