proxygen
folly::observer::TLObserver< T > Class Template Reference

#include <Observer.h>

Public Member Functions

 TLObserver (Observer< T > observer)
 
 TLObserver (const TLObserver< T > &other)
 
const Snapshot< T > & getSnapshotRef () const
 
const Snapshot< T > & operator* () const
 

Private Attributes

Observer< Tobserver_
 
folly::ThreadLocal< Snapshot< T > > snapshot_
 

Detailed Description

template<typename T>
class folly::observer::TLObserver< T >

Definition at line 192 of file Observer.h.

Constructor & Destructor Documentation

template<typename T >
folly::observer::TLObserver< T >::TLObserver ( Observer< T observer)
explicit

Definition at line 57 of file Observer-inl.h.

References folly::observer::TLObserver< T >::observer_.

58  : observer_(observer),
59  snapshot_([&] { return new Snapshot<T>(observer_.getSnapshot()); }) {}
Observer< T > observer_
Definition: Observer.h:203
folly::ThreadLocal< Snapshot< T > > snapshot_
Definition: Observer.h:204
template<typename T >
folly::observer::TLObserver< T >::TLObserver ( const TLObserver< T > &  other)

Definition at line 62 of file Observer-inl.h.

63  : TLObserver(other.observer_) {}
TLObserver(Observer< T > observer)
Definition: Observer-inl.h:57

Member Function Documentation

template<typename T >
const Snapshot< T > & folly::observer::TLObserver< T >::getSnapshotRef ( ) const

Definition at line 66 of file Observer-inl.h.

References folly::observer_detail::ObserverManager::inManagerThread(), folly::observer::TLObserver< T >::observer_, and folly::observer::TLObserver< T >::snapshot_.

66  {
67  auto& snapshot = *snapshot_;
68  if (observer_.needRefresh(snapshot) ||
70  snapshot = observer_.getSnapshot();
71  }
72 
73  return snapshot;
74 }
Observer< T > observer_
Definition: Observer.h:203
folly::ThreadLocal< Snapshot< T > > snapshot_
Definition: Observer.h:204
template<typename T>
const Snapshot<T>& folly::observer::TLObserver< T >::operator* ( ) const
inline

Definition at line 198 of file Observer.h.

198  {
199  return getSnapshotRef();
200  }
const Snapshot< T > & getSnapshotRef() const
Definition: Observer-inl.h:66

Member Data Documentation

template<typename T>
Observer<T> folly::observer::TLObserver< T >::observer_
private
template<typename T>
folly::ThreadLocal<Snapshot<T> > folly::observer::TLObserver< T >::snapshot_
private

Definition at line 204 of file Observer.h.

Referenced by folly::observer::TLObserver< T >::getSnapshotRef().


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