File indexing completed on 2025-01-18 10:10:31
0001
0002
0003
0004
0005
0006
0007
0008
0009 #ifndef ROOT7_Browsable_RShared
0010 #define ROOT7_Browsable_RShared
0011
0012 #include <ROOT/Browsable/RHolder.hxx>
0013
0014 namespace ROOT {
0015 namespace Browsable {
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025 template<class T>
0026 class RShared : public RHolder {
0027 std::shared_ptr<T> fShared;
0028 protected:
0029 void *GetShared() const final { return &fShared; }
0030 RHolder* DoCopy() const final { return new RShared<T>(fShared); }
0031 public:
0032 RShared(T *obj) { fShared.reset(obj); }
0033 RShared(std::shared_ptr<T> obj) { fShared = obj; }
0034 RShared(std::shared_ptr<T> &&obj) { fShared = std::move(obj); }
0035 virtual ~RShared() = default;
0036
0037 const TClass *GetClass() const final { return TClass::GetClass<T>(); }
0038 const void *GetObject() const final { return fShared.get(); }
0039 };
0040
0041 }
0042 }
0043
0044
0045 #endif