From: Helge Norberg Date: Tue, 3 Nov 2015 10:08:19 +0000 (+0100) Subject: * Removed unused file X-Git-Tag: 2.1.0_Beta1~242 X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=f3502a35858f988fecc5f064bee31ff951d8fd40;p=casparcg * Removed unused file --- diff --git a/common/CMakeLists.txt b/common/CMakeLists.txt index cd1bfb9fa..de5c7c571 100644 --- a/common/CMakeLists.txt +++ b/common/CMakeLists.txt @@ -79,7 +79,6 @@ set(HEADERS param.h polling_filesystem_monitor.h prec_timer.h - reactive.h scope_exit.h semaphore.h stdafx.h diff --git a/common/reactive.h b/common/reactive.h deleted file mode 100644 index 4e91b5444..000000000 --- a/common/reactive.h +++ /dev/null @@ -1,365 +0,0 @@ -#pragma once - -#include "memory.h" -#include "lock.h" - -#include -#include - -#include -#include -#include -#include - -namespace caspar { namespace reactive { - -namespace detail { - -// function_traits which works with MSVC2010 lambdas. - -template -struct function_traits_impl; - -template -struct function_traits_impl -{ - typedef A1 arg1_type; -}; - -template -struct function_traits_impl -{ - typedef A1 arg1_type; -}; - -template -struct function_traits_impl -{ - typedef A1 arg1_type; -}; - -template -typename function_traits_impl::arg1_type arg1_type_helper(T); - -template -struct function_traits -{ - typedef decltype(detail::arg1_type_helper(&F::operator())) arg1_type; -}; - -} - -template -class observer -{ - observer(const observer&); - observer& operator=(const observer&); -public: - - // Static Members - - typedef T value_type; - - // Constructors - - observer() - { - } - - virtual ~observer() - { - } - - // Methods - - virtual void on_next(const T&) = 0; - - // Properties -}; - -template -class observable -{ - observable(const observable&); - observable& operator=(const observable&); -public: - - // Static Members - - typedef T value_type; - typedef reactive::observer observer; - typedef std::weak_ptr> observer_ptr; - - // Constructors - - observable() - { - } - - virtual ~observable() - { - } - - // Methods - - virtual void subscribe(const observer_ptr&) = 0; - virtual void unsubscribe(const observer_ptr&) = 0; - - // Properties -}; - -template -class subject : public observer, public observable -{ -public: - - // Static Members - - typedef typename observable::observer observer; - typedef typename observable::observer_ptr observer_ptr; - - // Constructors - - virtual ~subject() - { - } - - // Methods - - // Properties -}; - -template -class observer_function : public observer -{ -public: - - // Static Members - - // Constructors - - observer_function() - { - } - - observer_function(C func) - : func_(std::move(func)) - { - } - - observer_function(const observer_function& other) - : func_(other.func_) - { - } - - observer_function(observer_function&& other) - : func_(std::move(other.func_)) - { - } - - observer_function& operator=(observer_function other) - { - other.swap(*this); - } - - // Methods - - void swap(observer_function& other) - { - std::swap(func_, other.func_); - } - - void on_next(const T& e) override - { - func_(e); - } - - // Properties -private: - C func_; -}; - -template -class basic_subject_impl final : public subject -{ - template friend class basic_subject_impl; - - basic_subject_impl(const basic_subject_impl&); - basic_subject_impl& operator=(const basic_subject_impl&); -public: - // Static Members - - typedef typename subject::observer observer; - typedef typename subject::observer_ptr observer_ptr; - - // Constructors - - basic_subject_impl() - { - } - - basic_subject_impl(basic_subject_impl&& other) - : observers_(std::move(other.observers_)) - { - } - - basic_subject_impl& operator=(basic_subject_impl&& other) - { - observers_ = std::move(observers_); - return *this; - } - - // Methods - - void clear() - { - tbb::spin_rw_mutex::scoped_lock lock(mutex_, true); - - observers_.clear(); - } - - void subscribe(const observer_ptr& o) override - { - tbb::spin_rw_mutex::scoped_lock lock(mutex_, false); - - auto it = std::lower_bound(std::begin(observers_), std::end(observers_), o, comp_); - if (it == std::end(observers_) || comp_(o, *it)) - { - lock.upgrade_to_writer(); - observers_.insert(it, o); - } - } - - void unsubscribe(const observer_ptr& o) override - { - tbb::spin_rw_mutex::scoped_lock lock(mutex_, false); - - auto it = std::lower_bound(std::begin(observers_), std::end(observers_), o, comp_); - if(it != std::end(observers_) && !comp_(o, *it)) - { - lock.upgrade_to_writer(); - observers_.erase(it); - } - } - - void on_next(const I& e) override - { - std::vector> observers; - - { - tbb::spin_rw_mutex::scoped_lock lock(mutex_, false); - - auto expired = std::end(observers_); - - for(auto it = std::begin(observers_); it != std::end(observers_); ++it) - { - auto o = it->lock(); - if(o) - observers.push_back(spl::make_shared_ptr(std::move(o))); - else - expired = it; - } - - if(expired != std::end(observers_)) - { - lock.upgrade_to_writer(); - observers_.erase(expired); - } - } - - for(auto it = std::begin(observers); it != std::end(observers); ++it) - (*it)->on_next(e); - } - - // Properties - -private: - typedef tbb::cache_aligned_allocator> allocator; - - std::owner_less> comp_; - std::vector, allocator> observers_; - mutable tbb::spin_rw_mutex mutex_; -}; - -template -class basic_subject : public subject -{ - template friend class basic_subject; - - basic_subject(const basic_subject&); - basic_subject& operator=(const basic_subject&); - - typedef basic_subject_impl impl; -public: - - // Static Members - - typedef typename subject::observer observer; - typedef typename subject::observer_ptr observer_ptr; - - // Constructors - - basic_subject() - : impl_(std::make_shared()) - - { - } - - basic_subject(basic_subject&& other) - : impl_(std::move(other.impl_)) - { - } - - basic_subject& operator=(basic_subject&& other) - { - other.swap(*this); - } - - // Methods - - void swap(basic_subject& other) - { - impl_.swap(other.impl_); - } - - void subscribe(const observer_ptr& o) override - { - impl_->subscribe(o); - } - - void unsubscribe(const observer_ptr& o) override - { - impl_->unsubscribe(o); - } - - void on_next(const I& e) override - { - impl_->on_next(e); - } - - operator std::weak_ptr() - { - return impl_; - } - - // Properties - -private: - std::shared_ptr impl_; -}; - -template -spl::shared_ptr::arg1_type>::type, F>> -make_observer(F func) -{ - return spl::make_shared::arg1_type>::type, F>>(std::move(func)); -} - -template -basic_subject& operator<<(basic_subject& s, const T& val) -{ - s.on_next(val); - return s; -} - -}} diff --git a/core/consumer/output.h b/core/consumer/output.h index 05a37681f..85a925632 100644 --- a/core/consumer/output.h +++ b/core/consumer/output.h @@ -27,7 +27,6 @@ #include #include #include -#include #include diff --git a/core/video_channel.h b/core/video_channel.h index 0e7d6f994..b3ac548a7 100644 --- a/core/video_channel.h +++ b/core/video_channel.h @@ -22,7 +22,6 @@ #pragma once #include -#include #include #include "fwd.h" diff --git a/protocol/amcp/AMCPCommandQueue.cpp b/protocol/amcp/AMCPCommandQueue.cpp index 24a3f8af0..ea69ccb83 100644 --- a/protocol/amcp/AMCPCommandQueue.cpp +++ b/protocol/amcp/AMCPCommandQueue.cpp @@ -23,6 +23,8 @@ #include "AMCPCommandQueue.h" +#include + #include #include