68 #ifndef GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ 69 #define GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ 113 while (p->next_ != ptr) {
114 assert(p->next_ !=
this &&
115 "Trying to join() a linked ring we are already in. " 116 "Is GMock thread safety enabled?");
129 if (next_ ==
this)
return true;
131 while (p->next_ !=
this) {
132 assert(p->next_ != next_ &&
133 "Trying to depart() a linked ring we are not in. " 134 "Is GMock thread safety enabled?");
145 template <
typename T>
158 assert(&ptr !=
this);
182 T*
get()
const {
return value_; }
188 template <
typename U>
190 return value_ == ptr.
get();
192 template <
typename U>
194 return value_ != ptr.
get();
198 template <
typename U>
205 if (link_.
depart())
delete value_;
208 void capture(T* ptr) {
216 link_.
join(&ptr->link_);
222 template<
typename T>
inline 224 return ptr == x.
get();
227 template<
typename T>
inline 229 return ptr != x.
get();
235 template <
typename T>
243 #endif // GTEST_INCLUDE_GTEST_INTERNAL_GTEST_LINKED_PTR_H_ Definition: gtest-port.h:2154
Definition: gmock-actions.h:53
linked_ptr(linked_ptr< U > const &ptr)
Definition: gtest-linked_ptr.h:156
linked_ptr(linked_ptr const &ptr)
Definition: gtest-linked_ptr.h:157
bool operator!=(T *p) const
Definition: gtest-linked_ptr.h:187
bool operator==(T *ptr, const linked_ptr< T > &x)
Definition: gtest-linked_ptr.h:223
GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex)
#define GTEST_API_
Definition: gtest-port.h:934
#define GTEST_LOCK_EXCLUDED_(locks)
Definition: gtest-port.h:2534
void reset(T *ptr=NULL)
Definition: gtest-linked_ptr.h:178
~linked_ptr()
Definition: gtest-linked_ptr.h:153
T & operator*() const
Definition: gtest-linked_ptr.h:184
void join(linked_ptr_internal const *ptr) GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex)
Definition: gtest-linked_ptr.h:108
Definition: gtest-linked_ptr.h:146
bool operator==(T *p) const
Definition: gtest-linked_ptr.h:186
linked_ptr & operator=(linked_ptr< U > const &ptr)
Definition: gtest-linked_ptr.h:163
bool depart() GTEST_LOCK_EXCLUDED_(g_linked_ptr_mutex)
Definition: gtest-linked_ptr.h:125
Definition: gtest-linked_ptr.h:89
linked_ptr< T > make_linked_ptr(T *ptr)
Definition: gtest-linked_ptr.h:236
linked_ptr(T *ptr=NULL)
Definition: gtest-linked_ptr.h:152
T * operator->() const
Definition: gtest-linked_ptr.h:183
bool operator==(linked_ptr< U > const &ptr) const
Definition: gtest-linked_ptr.h:189
void join_new()
Definition: gtest-linked_ptr.h:92
T * get() const
Definition: gtest-linked_ptr.h:182
bool operator!=(T *ptr, const linked_ptr< T > &x)
Definition: gtest-linked_ptr.h:228
linked_ptr & operator=(linked_ptr const &ptr)
Definition: gtest-linked_ptr.h:169
T element_type
Definition: gtest-linked_ptr.h:148
bool operator!=(linked_ptr< U > const &ptr) const
Definition: gtest-linked_ptr.h:193