]> git.sesse.net Git - casparcg/blob - common/diagnostics/graph.h
git-svn-id: https://casparcg.svn.sourceforge.net/svnroot/casparcg/server/branches...
[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 void register_graph(const safe_ptr<graph>& graph);\r
55 public:\r
56         graph();\r
57         void set_text(const std::string& value);\r
58         void set_text(const std::wstring& value);\r
59         void update_value(const std::string& name, double value);\r
60         void set_value(const std::string& name, double value);\r
61         void set_color(const std::string& name, color c);\r
62         void add_tag(const std::string& name);\r
63         void add_guide(const std::string& name, double value);\r
64 private:\r
65         struct implementation;\r
66         std::shared_ptr<implementation> impl_;\r
67 };\r
68 \r
69 void register_graph(const safe_ptr<graph>& graph);\r
70 void show_graphs(bool value);\r
71 \r
72 //namespace v2\r
73 //{\r
74 //      \r
75 //      struct data\r
76 //      {\r
77 //              float value;\r
78 //      };\r
79 //\r
80 //      class line\r
81 //      {\r
82 //      public:\r
83 //              line();\r
84 //              line(const std::wstring& name);\r
85 //              std::wstring print() const;\r
86 //              void update_value(float value);\r
87 //              void set_value(float value);\r
88 //              void set_tag(const std::wstring& tag);\r
89 //\r
90 //              boost::circular_buffer<data>& ticks();\r
91 //      private:\r
92 //              struct implementation;\r
93 //              std::shared_ptr<implementation> impl_;\r
94 //      };\r
95 //      \r
96 //      class graph;\r
97 //\r
98 //\r
99 //      class graph\r
100 //      {\r
101 //      public:\r
102 //              graph(const std::wstring& name);\r
103 //              graph(const printer& parent_printer);\r
104 //\r
105 //              void update_value(const std::wstring& name, float value);\r
106 //              void set_value(const std::wstring& name, float value);\r
107 //\r
108 //              void set_guide(const std::wstring& name, float value);\r
109 //              void set_color(const std::wstring& name, color c);\r
110 //\r
111 //              color get_color() const;\r
112 //              std::map<std::wstring, line>& get_lines();\r
113 //\r
114 //              std::wstring print() const;\r
115 //\r
116 //              safe_ptr<graph> clone() const;\r
117 //      private:\r
118 //              struct implementation;\r
119 //              std::shared_ptr<implementation> impl_;\r
120 //      };\r
121 //      \r
122 //      static safe_ptr<graph> create_graph(const std::wstring& name);\r
123 //      static safe_ptr<graph> create_graph(const printer& parent_printer);\r
124 //      static std::vector<safe_ptr<graph>> get_all_graphs();\r
125 //}\r
126 \r
127 }}