]> git.sesse.net Git - casparcg/blob - common/diagnostics/graph.h
0d9ef3d6226c954a11b522a8caeec23a2da5e816
[casparcg] / common / diagnostics / graph.h
1 /*\r
2 * copyright (c) 2010 Sveriges Television AB <info@casparcg.com>\r
3 *\r
4 *  This file is part of CasparCG.\r
5 *\r
6 *    CasparCG is free software: you can redistribute it and/or modify\r
7 *    it under the terms of the GNU General Public License as published by\r
8 *    the Free Software Foundation, either version 3 of the License, or\r
9 *    (at your option) any later version.\r
10 *\r
11 *    CasparCG is distributed in the hope that it will be useful,\r
12 *    but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14 *    GNU General Public License for more details.\r
15 \r
16 *    You should have received a copy of the GNU General Public License\r
17 *    along with CasparCG.  If not, see <http://www.gnu.org/licenses/>.\r
18 *\r
19 */\r
20 #pragma once\r
21 \r
22 #include "../memory/safe_ptr.h"\r
23 \r
24 #include <functional>\r
25 #include <string>\r
26 #include <vector>\r
27 #include <map>\r
28 \r
29 #include <boost/range/iterator_range.hpp>\r
30 #include <boost/circular_buffer.hpp>\r
31 \r
32 namespace caspar {\r
33                 \r
34 typedef std::function<std::wstring()> printer;\r
35         \r
36 namespace diagnostics {\r
37         \r
38 struct color\r
39 {\r
40         float red;\r
41         float green;\r
42         float blue;\r
43         float alpha;\r
44         \r
45         color(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f)\r
46                 : red(r)\r
47                 , green(g)\r
48                 , blue(b)\r
49                 , alpha(a){}\r
50 };\r
51 \r
52 class graph\r
53 {\r
54         friend safe_ptr<graph> create_graph(const std::string& name);\r
55         graph(const std::string& name);\r
56 public:\r
57         void update_value(const std::string& name, double value);\r
58         void update_text(const std::string& value);\r
59         void set_value(const std::string& name, double value);\r
60         void set_color(const std::string& name, color c);\r
61         void add_tag(const std::string& name);\r
62         void add_guide(const std::string& name, double value);\r
63 private:\r
64         struct implementation;\r
65         std::shared_ptr<implementation> impl_;\r
66 };\r
67 \r
68 safe_ptr<graph> create_graph(const std::string& name);\r
69         \r
70 //namespace v2\r
71 //{\r
72 //      \r
73 //      struct data\r
74 //      {\r
75 //              float value;\r
76 //      };\r
77 //\r
78 //      class line\r
79 //      {\r
80 //      public:\r
81 //              line();\r
82 //              line(const std::wstring& name);\r
83 //              std::wstring print() const;\r
84 //              void update_value(float value);\r
85 //              void set_value(float value);\r
86 //              void set_tag(const std::wstring& tag);\r
87 //\r
88 //              boost::circular_buffer<data>& ticks();\r
89 //      private:\r
90 //              struct implementation;\r
91 //              std::shared_ptr<implementation> impl_;\r
92 //      };\r
93 //      \r
94 //      class graph;\r
95 //\r
96 //\r
97 //      class graph\r
98 //      {\r
99 //      public:\r
100 //              graph(const std::wstring& name);\r
101 //              graph(const printer& parent_printer);\r
102 //\r
103 //              void update_value(const std::wstring& name, float value);\r
104 //              void set_value(const std::wstring& name, float value);\r
105 //\r
106 //              void set_guide(const std::wstring& name, float value);\r
107 //              void set_color(const std::wstring& name, color c);\r
108 //\r
109 //              color get_color() const;\r
110 //              std::map<std::wstring, line>& get_lines();\r
111 //\r
112 //              std::wstring print() const;\r
113 //\r
114 //              safe_ptr<graph> clone() const;\r
115 //      private:\r
116 //              struct implementation;\r
117 //              std::shared_ptr<implementation> impl_;\r
118 //      };\r
119 //      \r
120 //      static safe_ptr<graph> create_graph(const std::wstring& name);\r
121 //      static safe_ptr<graph> create_graph(const printer& parent_printer);\r
122 //      static std::vector<safe_ptr<graph>> get_all_graphs();\r
123 //}\r
124 \r
125 }}