-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbcc_handler.h
68 lines (48 loc) · 1.96 KB
/
bcc_handler.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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#pragma once
// C++ STL
#include <iostream>
#include <vector>
// CGV framework core
#include <cgv/math/fvec.h>
#include <cgv/math/fmat.h>
#include <cgv/media/color.h>
// local includes
#include "traj_loader.h"
/// provides read capabilites for Cem Yuksel's Binary Curve Collection file format.
template <class flt_type>
class bcc_handler : public traj_format_handler<flt_type>
{
public:
// trajectory handler interface
typedef traj_format_handler<flt_type> super;
/// real number type
typedef typename super::real real;
/// 2D vector type
typedef typename super::Vec2 vec2;
/// 3D vector type
typedef typename super::Vec3 vec3;
/// 4D vector type
typedef typename super::Vec4 vec4;
/// rgb color type
typedef typename super::Color color;
/// implementation forward
struct Impl;
/// reports the name "Binary Curve Collection"
const std::string& format_name (void) const;
/// reports the single extension "bcc" which the handler will claim regardless of content.
const std::vector<std::string>& handled_extensions (void) const;
/// test if the given data stream appears to be a supported BCC file
virtual bool can_handle (std::istream &contents) const;
/// parse the given stream containing the file contents and report whether any data was loaded
virtual traj_dataset<flt_type> read (std::istream &contents, DatasetOrigin source, const std::string &path);
protected:
// proxy for the internal implementation class to be able to add attributes to the result dataset object
template <class T>
inline static typename traj_dataset<flt_type>::template attrib_info<T> add_attribute(traj_dataset<real> &ds, const std::string &name) {
return super::template add_attribute<T>(ds, name);
}
// proxy for the internal implementation class to be able to manipulate trajectory info in the result dataset object
inline static std::vector<range>& trajectories (traj_dataset<real> &ds, const traj_attribute<real> &attrib) {
return super::trajectories(ds, attrib);
}
};