15 #ifndef ROOT7_TDirectory
16 #define ROOT7_TDirectory
22 #include <unordered_map>
23 #include <experimental/string_view>
47 using Value_t = std::shared_ptr<Internal::TCoopPtrTypeErasedBase>;
64 template <
class T,
class...
ARGS>
75 auto idx = fContent.find(name);
76 if (idx == fContent.end())
86 ContentMap_t::iterator idx = fContent.find(name);
87 if (idx != fContent.end()) {
89 <<
"Replacing object with name " <<
name;
90 idx->second = std::make_unique<Internal::TCoopPtrTypeErased<T>>(ptr);
92 const_cast<TKey&
>(idx->first).SetChanged();
95 return fContent.insert({
name,
96 std::make_shared<Internal::TCoopPtrTypeErased<T>>(ptr)})
TCoopPtr< T > Create(const std::string &name, ARGS...args)
Create an object of type T (passing some arguments to its constructor).
Namespace for new ROOT classes and functions.
const TKey & Add(const std::string &name, TCoopPtr< T > ptr)
Add an existing object (rather a TCoopPtr to it) to the TDirectory.
const TKey * FindKey(const std::string &name) const
#define R__LOG_HERE(LEVEL, GROUP)
Key/value store of objects.
static TDirectory & Heap()
Dedicated, process-wide TDirectory.
Describe directory structure in memory.
std::shared_ptr< Internal::TCoopPtrTypeErasedBase > Value_t
The values referenced by a TDirectory are type erased TCoopPtrs: they can be of any type; the actual ...
ContentMap_t fContent
The TDirectory's content.
std::unordered_map< TKey, Value_t > ContentMap_t
The directory content is a hashed map of TKey => Value_t.
Warnings about likely unexpected behavior.
Several pointers point to the same object, any of them can delete the object, setting all of them to ...