reorganized everything
[faros-demo] / src / track.h
1 #ifndef TRACK_H_
2 #define TRACK_H_
3
4 #include <vector>
5
6 enum InterpMode {
7         INTERP_STEP,
8         INTERP_LINEAR,
9         INTERP_SIGMOID
10 };
11
12 enum ExtrapMode {
13         EXTRAP_CLAMP,
14         EXTRAP_REPEAT
15 };
16
17 struct TrackKey {
18         long time;
19         float value;
20 };
21
22 class Track {
23 private:
24         std::vector<TrackKey> keys;
25         mutable bool keys_sorted;
26
27         int get_interval(long tm) const;
28
29 public:
30         InterpMode interp;
31         ExtrapMode extrap;
32         float defval;
33
34         Track();
35
36         void clear();
37
38         void set_key(long tm, float val);
39         float get_key(long tm) const;
40         int find_key(long tm) const;
41
42         float operator ()(long tm) const;
43 };
44
45 #endif  /* TRACK_H_ */