15 #ifndef ROOT7_TDrawable 16 #define ROOT7_TDrawable 21 namespace Experimental {
62 fIsShared(uniweak.fIsWeak) {
64 fShared = uniweak.
fWeak.lock();
71 fShared.swap(rhs.fShared);
76 T*
operator->()
const {
return fIsShared ? fRaw : fShared.get(); }
78 operator bool()
const {
return fIsShared ? (bool)fRaw : (
bool)fShared; }
82 fShared.~shared_ptr();
86 TUniWeakPtr(
const std::shared_ptr<T>& ptr): fWeak(ptr), fIsWeak(true) {}
87 TUniWeakPtr(std::unique_ptr<T>&& ptr): fUnique(
std::move(ptr)), fIsWeak(false) {}
90 fWeak.swap(rhs.fWeak);
92 fUnique.swap(rhs.fUnique);
99 fUnique.~unique_ptr();
102 Accessor
Get()
const {
return Accessor(*
this); }
Accessor(const TUniWeakPtr &uniweak)
Namespace for new ROOT classes and functions.
TUniWeakPtr(TUniWeakPtr &&rhs)
Graphic container for TDrawable-s.
virtual void Paint(TCanvas &onCanv)=0
Paint the object.
bool fIsShared
fRaw or fShared?
Gives transparent access to the shared or unique pointer.
std::unique_ptr< T > fUnique
std::shared_ptr< T > fShared
TUniWeakPtr(std::unique_ptr< T > &&ptr)
TUniWeakPtr(const std::shared_ptr< T > &ptr)
bool fIsWeak
fUnique or fWeak?
Base class for drawable entities: objects that can be painted on a TPad.