|
||||
File indexing completed on 2025-01-18 10:10:31
0001 /************************************************************************* 0002 * Copyright (C) 1995-2020, Rene Brun and Fons Rademakers. * 0003 * All rights reserved. * 0004 * * 0005 * For the licensing terms see $ROOTSYS/LICENSE. * 0006 * For the list of contributors see $ROOTSYS/README/CREDITS. * 0007 *************************************************************************/ 0008 0009 #ifndef ROOT7_Browsable_RUnique 0010 #define ROOT7_Browsable_RUnique 0011 0012 #include <ROOT/Browsable/RHolder.hxx> 0013 0014 namespace ROOT { 0015 namespace Browsable { 0016 0017 /** \class RUnique<T> 0018 \ingroup rbrowser 0019 \brief Holder of with unique_ptr<T> instance. Should be used to transfer unique_ptr<T> in browsable methods 0020 \author Sergey Linev <S.Linev@gsi.de> 0021 \date 2019-10-19 0022 \warning This is part of the ROOT 7 prototype! It will change without notice. It might trigger earthquakes. Feedback is welcome! 0023 */ 0024 0025 template<class T> 0026 class RUnique : public RHolder { 0027 std::unique_ptr<T> fUnique; ///<! holder without IO 0028 protected: 0029 void *TakeObject() final { return fUnique.release(); } 0030 public: 0031 RUnique(T *obj) { fUnique.reset(obj); } 0032 RUnique(std::unique_ptr<T> &&obj) { fUnique = std::move(obj); } 0033 virtual ~RUnique() = default; 0034 0035 const TClass *GetClass() const final { return TClass::GetClass<T>(); } 0036 const void *GetObject() const final { return fUnique.get(); } 0037 }; 0038 0039 } // namespace Browsable 0040 } // namespace ROOT 0041 0042 0043 #endif
[ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |