\r
void update(const std::string& name, float value)\r
{\r
- context::begin_invoke([=]\r
- {\r
- lines_[name].update(value);\r
- });\r
+ lines_[name].update(value);\r
}\r
\r
void set(const std::string& name, float value)\r
{\r
- context::begin_invoke([=]\r
- {\r
- lines_[name].set(value);\r
- });\r
+ lines_[name].set(value);\r
}\r
\r
void tag(const std::string& name)\r
{\r
- context::begin_invoke([=]\r
- {\r
- lines_[name].tag();\r
- });\r
+ lines_[name].tag();\r
}\r
\r
void set_color(const std::string& name, color c)\r
{\r
- context::begin_invoke([=]\r
- {\r
- lines_[name].set_color(c);\r
- });\r
+ lines_[name].set_color(c);\r
}\r
\r
void guide(const std::string& name, float value)\r
{\r
- context::begin_invoke([=]\r
- {\r
- lines_[name].guide(diagnostics::guide(value));\r
- });\r
+ lines_[name].guide(diagnostics::guide(value)); \r
}\r
\r
private:\r
context::register_drawable(impl_);\r
}\r
\r
-void graph::update_value(const std::string& name, float value){if(impl_)impl_->update(name, value);}\r
-void graph::set_value(const std::string& name, float value){if(impl_)impl_->set(name, value);}\r
-void graph::set_color(const std::string& name, color c){if(impl_)impl_->set_color(name, c);}\r
-void graph::add_tag(const std::string& name){if(impl_)impl_->tag(name);}\r
-void graph::add_guide(const std::string& name, float value){if(impl_)impl_->guide(name, value);}\r
+void graph::update_value(const std::string& name, float value)\r
+{\r
+ if(impl_)\r
+ { \r
+ auto p = impl_;\r
+ context::begin_invoke([=]\r
+ { \r
+ p->update(name, value);\r
+ });\r
+ }\r
+}\r
+void graph::set_value(const std::string& name, float value)\r
+{\r
+ if(impl_)\r
+ { \r
+ auto p = impl_;\r
+ context::begin_invoke([=]\r
+ { \r
+ p->set(name, value);\r
+ });\r
+ }\r
+}\r
+void graph::set_color(const std::string& name, color c)\r
+{ \r
+ if(impl_)\r
+ { \r
+ auto p = impl_;\r
+ context::begin_invoke([=]\r
+ { \r
+ p->set_color(name, c);\r
+ });\r
+ }\r
+}\r
+void graph::add_tag(const std::string& name)\r
+{ \r
+ if(impl_)\r
+ { \r
+ auto p = impl_;\r
+ context::begin_invoke([=]\r
+ { \r
+ p->tag(name);\r
+ });\r
+ }\r
+}\r
+void graph::add_guide(const std::string& name, float value)\r
+{ \r
+ if(impl_)\r
+ { \r
+ auto p = impl_;\r
+ context::begin_invoke([=]\r
+ { \r
+ p->guide(name, value);\r
+ });\r
+ }\r
+}\r
\r
safe_ptr<graph> create_graph(const std::string& name)\r
{\r
--- /dev/null
+#pragma once\r
+\r
+#include <string>\r
+\r
+#include <tbb/spin_mutex.h>\r
+\r
+namespace caspar {\r
+\r
+class printable\r
+{\r
+ mutable tbb::spin_mutex mutex_;\r
+ const printable* parent_;\r
+public:\r
+ printable(const printable* parent = nullptr){set_parent(parent);}\r
+\r
+ std::wstring print() const\r
+ {\r
+ tbb::spin_mutex::scoped_lock lock(mutex_);\r
+ return (parent_ ? parent_->print() + L"/" : L"") + do_print();\r
+ }\r
+ \r
+ virtual void swap(object& other)\r
+ {\r
+ tbb::spin_mutex::scoped_lock lock(mutex_);\r
+ std::swap(parent_, other.parent_);\r
+ }\r
+ \r
+ const object* get_parent() const\r
+ {\r
+ tbb::spin_mutex::scoped_lock lock(mutex_);\r
+ return parent_;\r
+ }\r
+\r
+ void set_parent(const object* parent)\r
+ {\r
+ tbb::spin_mutex::scoped_lock lock(mutex_);\r
+ parent_ = parent != this ? parent : nullptr;\r
+ }\r
+\r
+private:\r
+ virtual std::wstring do_print() const = 0;\r
+};\r
+\r
+}
\ No newline at end of file