};\r
\r
template<typename I, typename O = I>\r
-class basic_subject : public subject<I, O>\r
+class basic_subject sealed : public subject<I, O>\r
{ \r
template <typename, typename> friend class basic_subject;\r
\r
: impl_(std::move(other.impl_))\r
{\r
}\r
-\r
- virtual ~basic_subject()\r
- {\r
- }\r
-\r
+ \r
basic_subject& operator=(basic_subject&& other)\r
{\r
other.swap(*this);\r
path::path(const char* path)\r
: str_(path)\r
{\r
-\r
}\r
\r
path::path(std::string path)\r
: str_(path)\r
{\r
-\r
}\r
\r
path::path(const path& other)\r
return str_.empty();\r
}\r
\r
+std::ostream& operator<<(std::ostream& o, const path& p)\r
+{\r
+ o << p.str();\r
+ return o;\r
+}\r
+\r
// event\r
\r
event::event(monitor::path path)\r
- : read_only_(true)\r
- , path_(std::move(path))\r
- , params_(std::make_shared<params_t>())\r
+ : path_(std::move(path))\r
{\r
}\r
\r
-event::event(monitor::path path, std::shared_ptr<params_t> params)\r
- : read_only_(true)\r
- , path_(std::move(path))\r
+event::event(monitor::path path, params_t params)\r
+ : path_(std::move(path))\r
, params_(std::move(params))\r
{\r
- if(params_ == nullptr)\r
- throw std::invalid_argument("params");\r
}\r
\r
event::event(const event& other)\r
- : read_only_(true)\r
- , path_(other.path_)\r
+ : path_(other.path_)\r
, params_(other.params_)\r
{\r
}\r
\r
event::event(event&& other)\r
- : read_only_(true)\r
- , path_(std::move(other.path_))\r
+ : path_(std::move(other.path_))\r
, params_(std::move(other.params_))\r
{\r
}\r
\r
void event::swap(event& other)\r
{\r
- std::swap(read_only_, other.read_only_);\r
std::swap(path_, other.path_);\r
std::swap(params_, other.params_);\r
}\r
\r
const event::params_t& event::params() const \r
{\r
- return *params_;\r
+ return params_;\r
}\r
\r
event event::propagate(monitor::path path) const\r
return event(std::move(path) % path_, params_);\r
}\r
\r
+std::ostream& operator<<(std::ostream& o, const event& e)\r
+{\r
+ o << e.path();\r
+ for(auto it = e.params().begin(); it != e.params().end(); ++it)\r
+ o << " " << *it;\r
+ return o;\r
+}\r
+\r
}}
\ No newline at end of file
#define _SCL_SECURE_NO_WARNINGS\r
#endif\r
\r
+namespace boost {\r
+namespace detail { namespace variant {\r
+\r
+template <>\r
+struct has_nothrow_move<std::string>\r
+: mpl::true_\r
+{\r
+};\r
+ \r
+template <>\r
+struct has_nothrow_move<std::vector<int8_t>>\r
+: mpl::true_\r
+{\r
+};\r
+\r
+template <>\r
+struct has_nothrow_move<boost::chrono::duration<double, boost::ratio<1, 1>>>\r
+: mpl::true_\r
+{\r
+};\r
+\r
+}}}\r
+\r
namespace caspar { namespace monitor {\r
\r
// path\r
return std::move(path %= std::forward<T>(value));\r
}\r
\r
+std::ostream& operator<<(std::ostream& o, const path& p);\r
+\r
// param\r
\r
typedef boost::chrono::duration<double, boost::ratio<1, 1>> duration;\r
typedef std::vector<param, tbb::cache_aligned_allocator<param>> params_t;\r
\r
event(path path); \r
- event(path path, std::shared_ptr<params_t> params); \r
+ event(path path, params_t params); \r
\r
event(const event& other);\r
event(event&& other);\r
template<typename T>\r
event& operator%(T&& value)\r
{\r
- if(read_only_)\r
- {\r
- read_only_ = false;\r
- params_ = spl::make_shared<params_t>(*params_);\r
- }\r
- params_->push_back(std::forward<T>(value));\r
+ params_.push_back(std::forward<T>(value));\r
return *this;\r
}\r
\r
const path& path() const;\r
const params_t& params() const;\r
private:\r
- bool read_only_; \r
- monitor::path path_;\r
- std::shared_ptr<params_t> params_;\r
+ monitor::path path_;\r
+ params_t params_;\r
};\r
\r
-typedef reactive::observable<monitor::event> observable;\r
-typedef reactive::observer<monitor::event> observer;\r
+std::ostream& operator<<(std::ostream& o, const event& e);\r
+\r
+// reactive\r
+\r
+typedef reactive::observable<monitor::event> observable;\r
+typedef reactive::observer<monitor::event> observer;\r
+typedef reactive::subject<monitor::event> subject;\r
\r
-class subject : public reactive::subject<monitor::event>\r
+class basic_subject sealed : public reactive::subject<monitor::event>\r
{ \r
- subject(const subject&);\r
- subject& operator=(const subject&);\r
+ basic_subject(const basic_subject&);\r
+ basic_subject& operator=(const basic_subject&);\r
\r
class impl : public observer\r
{\r
};\r
\r
public: \r
- subject(monitor::path path = monitor::path())\r
+ basic_subject(monitor::path path = monitor::path())\r
: impl_(std::make_shared<impl>(std::move(path)))\r
\r
{\r
}\r
\r
- subject(subject&& other)\r
+ basic_subject(basic_subject&& other)\r
: impl_(std::move(other.impl_))\r
{\r
}\r
-\r
- virtual ~subject()\r
- {\r
- }\r
-\r
- subject& operator=(subject&& other)\r
+ \r
+ basic_subject& operator=(basic_subject&& other)\r
{\r
impl_ = std::move(other.impl_);\r
}\r
\r
class follow_producer_proxy : public producer_proxy_base\r
{ \r
- monitor::subject event_subject_;\r
+ monitor::basic_subject event_subject_;\r
public:\r
follow_producer_proxy(spl::shared_ptr<frame_producer>&& producer) \r
: producer_proxy_base(std::move(producer))\r
\r
struct layer::impl\r
{ \r
- monitor::subject event_subject_;\r
- monitor::subject foreground_event_subject_;\r
- monitor::subject background_event_subject_;\r
+ monitor::basic_subject event_subject_;\r
+ monitor::basic_subject foreground_event_subject_;\r
+ monitor::basic_subject background_event_subject_;\r
spl::shared_ptr<frame_producer> foreground_;\r
spl::shared_ptr<frame_producer> background_;\r
int64_t frame_number_;\r
struct stage::impl : public std::enable_shared_from_this<impl>\r
{ \r
spl::shared_ptr<diagnostics::graph> graph_;\r
- monitor::subject event_subject_;\r
+ monitor::basic_subject event_subject_;\r
std::map<int, layer> layers_; \r
std::map<int, tweened_transform> tweens_; \r
executor executor_;\r
\r
struct transition_producer : public frame_producer\r
{ \r
- monitor::subject event_subject_;\r
+ monitor::basic_subject event_subject_;\r
const field_mode mode_;\r
int current_frame_;\r
\r
struct video_channel::impl sealed : public frame_factory\r
{\r
reactive::basic_subject<spl::shared_ptr<const data_frame>> frame_subject_;\r
- monitor::subject event_subject_;\r
+ monitor::basic_subject event_subject_;\r
\r
const int index_;\r
\r
\r
struct ffmpeg_producer : public core::frame_producer\r
{\r
- monitor::subject event_subject_;\r
+ monitor::basic_subject event_subject_;\r
const std::wstring filename_;\r
\r
const spl::shared_ptr<diagnostics::graph> graph_;\r
auto server = spl::make_shared<protocol::osc::server>(5253);\r
caspar_server.subscribe(server);\r
\r
- auto console_obs = reactive::make_observer([](const monitor::event& e)\r
- {\r
- CASPAR_LOG(trace) << e.path().str().c_str();\r
- });\r
-\r
- caspar_server.subscribe(console_obs);\r
-\r
-\r
-\r
+ //auto console_obs = reactive::make_observer([](const monitor::event& e)\r
+ //{\r
+ // std::stringstream str;\r
+ // str << e;\r
+ // CASPAR_LOG(trace) << str.str().c_str();\r
+ //});\r
+\r
+ //caspar_server.subscribe(console_obs);\r
+ \r
// Create a amcp parser for console commands.\r
protocol::amcp::AMCPProtocolStrategy amcp(caspar_server.get_channels());\r
\r
\r
struct server::impl : boost::noncopyable\r
{\r
- monitor::subject event_subject_;\r
+ monitor::basic_subject event_subject_;\r
accelerator::accelerator accelerator_;\r
std::vector<spl::shared_ptr<IO::AsyncEventServer>> async_servers_; \r
std::vector<spl::shared_ptr<video_channel>> channels_;\r
class video_channel;\r
}\r
\r
-class server sealed : public monitor::subject\r
+class server sealed : public monitor::observable\r
, boost::noncopyable\r
{\r
public:\r