-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathTile.h
46 lines (40 loc) · 1.27 KB
/
Tile.h
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
46
#ifndef TILE_INCLUDE_H
#define TILE_INCLUDE_H
// System
#include <string>
#include <vector>
// Local
#include "DataSample.h"
#include "Range.h"
#include "sizes.h"
class Tile {
public:
Tile() { header.magic = MAGIC; header.version = 0x00010000; }
struct Header {
uint32 magic;
uint32 version;
} header;
DataRanges ranges;
enum {
MAGIC = 0x69547442 // Magic('BtTi')
};
std::vector<DataSample<double> > double_samples;
std::vector<DataSample<std::string> > string_samples;
void to_binary(std::string &ret) const;
size_t binary_length() const;
void from_binary(const std::string &binary);
void insert_samples(const DataSample<double> *begin, const DataSample<double> *end);
void insert_samples(const DataSample<std::string> *begin, const DataSample<std::string> *end);
template <class T> std::vector<DataSample<T> > &get_samples();
double first_sample_time() const;
double last_sample_time() const;
std::string summary() const;
private:
size_t double_samples_length() const;
size_t string_samples_length() const;
};
template <>
inline std::vector<DataSample<double> > &Tile::get_samples<double>() { return double_samples; }
template <>
inline std::vector<DataSample<std::string> > &Tile::get_samples<std::string>() { return string_samples; }
#endif