diff options
Diffstat (limited to 'include/comphelper/interfacecontainer3.hxx')
-rw-r--r-- | include/comphelper/interfacecontainer3.hxx | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/include/comphelper/interfacecontainer3.hxx b/include/comphelper/interfacecontainer3.hxx index 27008f064e8c..4b3d44bab69d 100644 --- a/include/comphelper/interfacecontainer3.hxx +++ b/include/comphelper/interfacecontainer3.hxx @@ -126,10 +126,8 @@ public: The lifetime must be longer than the lifetime of this object. */ - OInterfaceContainerHelper3(::osl::Mutex& rMutex_) - : mrMutex(rMutex_) - { - } + inline OInterfaceContainerHelper3(::osl::Mutex& rMutex_); + /** Return the number of Elements in the container. Only useful if you have acquired the mutex. @@ -224,6 +222,16 @@ private: OInterfaceContainerHelper3(const OInterfaceContainerHelper3&) = delete; OInterfaceContainerHelper3& operator=(const OInterfaceContainerHelper3&) = delete; + static o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>, + o3tl::ThreadSafeRefCountingPolicy>& + DEFAULT() + { + static o3tl::cow_wrapper<std::vector<css::uno::Reference<ListenerT>>, + o3tl::ThreadSafeRefCountingPolicy> + SINGLETON; + return SINGLETON; + } + private: template <typename EventT> class NotifySingleListener { @@ -247,6 +255,13 @@ private: }; template <class T> +inline OInterfaceContainerHelper3<T>::OInterfaceContainerHelper3(::osl::Mutex& rMutex_) + : maData(OInterfaceContainerHelper3<T>::DEFAULT()) + , mrMutex(rMutex_) +{ +} + +template <class T> template <typename FuncT> inline void OInterfaceContainerHelper3<T>::forEach(FuncT const& func) { |