Go to the documentation of this file.00001 #ifndef OMG_DDS_CORE_WEAK_REFERENCE_HPP_
00002 #define OMG_DDS_CORE_WEAK_REFERENCE_HPP_
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <dds/core/corefwd.hpp>
00023 #include <dds/core/Exception.hpp>
00024 #include <dds/core/Reference.hpp>
00025
00026 namespace dds { namespace core {
00033 template <typename T>
00034 class WeakReference {
00035 public:
00036 typedef T ReferenceType;
00037
00038 public:
00043 WeakReference(const T& t) : impl_(t.delegate()) { }
00044
00045 ~WeakReference() { }
00046
00052 bool expired() {
00053 return impl_.expired();
00054 }
00055
00060 T lock() {
00061 return T(impl_.lock());
00062 }
00063
00064 private:
00065 typename T::DELEGATE_WEAK_REF_T impl_;
00066 };
00067 }}
00068
00069 #endif