-
Notifications
You must be signed in to change notification settings - Fork 3
/
davis.h
108 lines (96 loc) · 2.65 KB
/
davis.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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#ifndef DAVIS_H
#define DAVIS_H
#include <string>
#include <vector>
#include <cstdlib>
#include "plotly_maker/plotly_maker.h"
#include "array_core/configurator.h"
/*
namespace {
using std::string;
using std::vector;
constexpr char davis[] = "davis --";
constexpr char prefix[] = "=\"";
constexpr char postfix[] = "\"";
constexpr char command_heatmap[] = "heatmap";
constexpr char command_surface[] = "surface";
constexpr char command_line_chart[] = "linechart";
void runDavisBySystem(const string& args) {
system(args.c_str());
}
void makeStringFromValues(const vector<double> in_values,
string& out_values) {
for (size_t i = 0; i < in_values.size(); ++i) {
std::string value = std::to_string(in_values[i]);
out_values.append(value);
if (i != in_values.size() - 1) {
out_values.append(",");
}
}
}
void makeArgs(const vector<vector<double>>& values, string& out) {
switch (dv::Configurator::getInstance().common.typeVisual) {
case dv::config_visualizationTypes::VISUALTYPE_CHART:
break;
case dv::config_visualizationTypes::VISUALTYPE_HEATMAP:
//duplicated code
out.append(davis);
out.append(command_heatmap);
out.append(prefix);
for (size_t i = 0; i < values.size(); ++i) {
makeStringFromValues(values[i], out);
if (i != values.size() - 1)
out.append(";");
}
out.append(postfix);
break;
case dv::config_visualizationTypes::VISUALTYPE_SURFACE:
//duplicated code
out.append(davis);
out.append(command_surface);
out.append(prefix);
for (size_t i = 0; i < values.size(); ++i) {
makeStringFromValues(values[i], out);
if (i != values.size() - 1)
out.append(";");
}
out.append(postfix);
break;
default:
break;
}
}
void makeArgs(vector<double>& values, string& out) {
switch (dv::Configurator::getInstance().common.typeVisual) {
case dv::config_visualizationTypes::VISUALTYPE_CHART:
out.append(davis);
out.append(command_line_chart);
out.append(prefix);
makeStringFromValues(values, out);
out.append(postfix);
break;
case dv::config_visualizationTypes::VISUALTYPE_HEATMAP:
break;
case dv::config_visualizationTypes::VISUALTYPE_SURFACE:
break;
default:
break;
}
}
}
namespace dv {
void show(vector<vector<double>>& values);
void show(vector<double>& values);
void show(vector<vector<double>>& values) {
string args;
makeArgs(values, args);
runDavisBySystem(args);
}
void show(vector<double>& values) {
string args;
makeArgs(values, args);
runDavisBySystem(args);
}
}
*/
#endif // DAVIS_H