|
|
|||
File indexing completed on 2025-12-16 10:08:48
0001 // Boost.Signals2 library 0002 0003 // Copyright Frank Mori Hess 2007,2009. 0004 // Copyright Timmo Stange 2007. 0005 // Copyright Douglas Gregor 2001-2004. Use, modification and 0006 // distribution is subject to the Boost Software License, Version 0007 // 1.0. (See accompanying file LICENSE_1_0.txt or copy at 0008 // http://www.boost.org/LICENSE_1_0.txt) 0009 0010 // Compatibility class to ease porting from the original 0011 // Boost.Signals library. However, 0012 // boost::signals2::trackable is NOT thread-safe. 0013 0014 // For more information, see http://www.boost.org 0015 0016 #ifndef BOOST_SIGNALS2_TRACKABLE_HPP 0017 #define BOOST_SIGNALS2_TRACKABLE_HPP 0018 0019 #include <boost/assert.hpp> 0020 #include <boost/shared_ptr.hpp> 0021 #include <boost/weak_ptr.hpp> 0022 0023 namespace boost { 0024 namespace signals2 { 0025 namespace detail 0026 { 0027 class tracked_objects_visitor; 0028 0029 // trackable_pointee is used to identify the tracked shared_ptr 0030 // originating from the signals2::trackable class. These tracked 0031 // shared_ptr are special in that we shouldn't bother to 0032 // increment their use count during signal invocation, since 0033 // they don't actually control the lifetime of the 0034 // signals2::trackable object they are associated with. 0035 class trackable_pointee 0036 {}; 0037 } 0038 class trackable { 0039 protected: 0040 trackable(): _tracked_ptr(static_cast<detail::trackable_pointee*>(0)) {} 0041 trackable(const trackable &): _tracked_ptr(static_cast<detail::trackable_pointee*>(0)) {} 0042 trackable& operator=(const trackable &) 0043 { 0044 return *this; 0045 } 0046 ~trackable() {} 0047 private: 0048 friend class detail::tracked_objects_visitor; 0049 weak_ptr<detail::trackable_pointee> get_weak_ptr() const 0050 { 0051 return _tracked_ptr; 0052 } 0053 0054 shared_ptr<detail::trackable_pointee> _tracked_ptr; 0055 }; 0056 } // end namespace signals2 0057 } // end namespace boost 0058 0059 #endif // BOOST_SIGNALS2_TRACKABLE_HPP
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|