proxygen
folly::detail::ReadMostlySharedPtrCore< T, RefCount > Class Template Reference

#include <ReadMostlySharedPtr.h>

Public Member Functions

Tget ()
 
std::shared_ptr< TgetShared ()
 
bool incref ()
 
void decref ()
 
void increfWeak ()
 
void decrefWeak ()
 
size_t useCount () const
 
 ~ReadMostlySharedPtrCore () noexcept
 

Private Member Functions

 ReadMostlySharedPtrCore (std::shared_ptr< T > ptr)
 

Private Attributes

TptrRaw_
 
RefCount count_
 
RefCount weakCount_
 
std::shared_ptr< Tptr_
 

Friends

class ReadMostlyMainPtr< T, RefCount >
 
class ReadMostlyMainPtrDeleter< RefCount >
 

Detailed Description

template<typename T, typename RefCount = DefaultRefCount>
class folly::detail::ReadMostlySharedPtrCore< T, RefCount >

Definition at line 39 of file ReadMostlySharedPtr.h.

Constructor & Destructor Documentation

template<typename T, typename RefCount = DefaultRefCount>
folly::detail::ReadMostlySharedPtrCore< T, RefCount >::~ReadMostlySharedPtrCore ( )
inlinenoexcept

Definition at line 77 of file ReadMostlySharedPtr.h.

77  {
78  assert(*count_ == 0);
79  assert(*weakCount_ == 0);
80  }
template<typename T, typename RefCount = DefaultRefCount>
folly::detail::ReadMostlySharedPtrCore< T, RefCount >::ReadMostlySharedPtrCore ( std::shared_ptr< T ptr)
inlineexplicitprivate

Definition at line 86 of file ReadMostlySharedPtr.h.

87  : ptrRaw_(ptr.get()), ptr_(std::move(ptr)) {}
void * ptr
constexpr detail::Map< Move > move
Definition: Base-inl.h:2567

Member Function Documentation

template<typename T, typename RefCount = DefaultRefCount>
void folly::detail::ReadMostlySharedPtrCore< T, RefCount >::decref ( )
inline
template<typename T, typename RefCount = DefaultRefCount>
void folly::detail::ReadMostlySharedPtrCore< T, RefCount >::decrefWeak ( )
inline

Definition at line 67 of file ReadMostlySharedPtr.h.

Referenced by folly::detail::ReadMostlySharedPtrCore< T, DefaultRefCount >::decref().

67  {
68  if (--weakCount_ == 0) {
69  delete this;
70  }
71  }
template<typename T, typename RefCount = DefaultRefCount>
T* folly::detail::ReadMostlySharedPtrCore< T, RefCount >::get ( )
inline

Definition at line 41 of file ReadMostlySharedPtr.h.

Referenced by folly::ReadMostlySharedPtr< T >::reset().

41  {
42  return ptrRaw_;
43  }
template<typename T, typename RefCount = DefaultRefCount>
std::shared_ptr<T> folly::detail::ReadMostlySharedPtrCore< T, RefCount >::getShared ( )
inline

Definition at line 45 of file ReadMostlySharedPtr.h.

45  {
46  return ptr_;
47  }
template<typename T, typename RefCount = DefaultRefCount>
bool folly::detail::ReadMostlySharedPtrCore< T, RefCount >::incref ( )
inline

Definition at line 49 of file ReadMostlySharedPtr.h.

Referenced by folly::ReadMostlySharedPtr< T >::reset().

49  {
50  return ++count_ > 0;
51  }
template<typename T, typename RefCount = DefaultRefCount>
void folly::detail::ReadMostlySharedPtrCore< T, RefCount >::increfWeak ( )
inline

Definition at line 62 of file ReadMostlySharedPtr.h.

Referenced by folly::ReadMostlyWeakPtr< T >::reset().

62  {
63  auto value = ++weakCount_;
64  DCHECK_GT(value, 0);
65  }
uint64_t value(const typename LockFreeRingBuffer< T, Atom >::Cursor &rbcursor)
template<typename T, typename RefCount = DefaultRefCount>
size_t folly::detail::ReadMostlySharedPtrCore< T, RefCount >::useCount ( ) const
inline

Definition at line 73 of file ReadMostlySharedPtr.h.

73  {
74  return *count_;
75  }

Friends And Related Function Documentation

template<typename T, typename RefCount = DefaultRefCount>
friend class ReadMostlyMainPtr< T, RefCount >
friend

Definition at line 83 of file ReadMostlySharedPtr.h.

template<typename T, typename RefCount = DefaultRefCount>
friend class ReadMostlyMainPtrDeleter< RefCount >
friend

Definition at line 84 of file ReadMostlySharedPtr.h.

Member Data Documentation

template<typename T, typename RefCount = DefaultRefCount>
T* folly::detail::ReadMostlySharedPtrCore< T, RefCount >::ptrRaw_
private

The documentation for this class was generated from the following file: