summaryrefslogtreecommitdiff
path: root/src/mbgl/style/function.hpp
blob: 6ef4fcf5da2cc570c422149a6c0d34093a428dcc (plain)
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
#ifndef MBGL_STYLE_FUNCTION
#define MBGL_STYLE_FUNCTION

#include <vector>
#include <utility>

namespace mbgl {

template <typename T>
class Function {
public:
    using Stop = std::pair<float, T>;
    using Stops = std::vector<Stop>;

    // TODO: make explicit
    /* explicit */ Function(const T& constant)
        : stops({{ 0, constant }}) {}

    explicit Function(const Stops& stops_, float base_)
        : base(base_), stops(stops_) {}

    T evaluate(float z) const;

private:
    const float base = 1;
    const std::vector<std::pair<float, T>> stops;
};

}

#endif