16#ifndef ROOT7_TDirectory
17#define ROOT7_TDirectory
25#include <unordered_map>
30namespace Experimental {
40 const char *
what() const noexcept final {
return fKeyName.c_str(); }
52 const char *
what() const noexcept final {
return fKeyName.c_str(); }
75 using ContentMap_t = std::unordered_map<std::string, Internal::TDirectoryEntry>;
84 typename std::enable_if<!std::is_pointer<decaytype>::value && !std::is_member_pointer<decaytype>::value &&
85 !std::is_void<decaytype>::value,
97 template <
class T,
class...
ARGS>
100 auto ptr = std::make_shared<ToContentType_t<T>>(std::forward<ARGS>(args)...);
155 const auto &pair = Find<T>(
name);
176 std::string sName(
name);
180 idx->second.swap(entry);
#define R__LOG_HERE(LEVEL, GROUP)
std::shared_ptr< U > CastPointer() const
std::shared_ptr< void > & GetPointer()
Retrieve the shared_ptr of the referenced object.
Objects of this class are thrown to signal that the value known under the given name .
TDirectoryTypeMismatch(std::string_view keyName)
const char * what() const noexcept final
Objects of this class are thrown to signal that no key with that name exists.
TDirectoryUnknownKey(std::string_view keyName)
const char * what() const noexcept final
Key/value store of objects.
static TDirectory & Heap()
Dedicated, process-wide TDirectory.
std::shared_ptr< ToContentType_t< T > > Create(std::string_view name, ARGS &&... args)
Create an object of type T (passing some arguments to its constructor).
typename ToContentType< T >::type ToContentType_t
EFindStatus
Status of the call to Find<T>(name).
@ kValidValue
Value known for this key name and type.
@ kValidValueBase
Value known for this key name and base type.
@ kTypeMismatch
The provided type does not match the value's type.
@ kKeyNameNotFound
No key is known for this name.
ContentMap_t fContent
The TDirectory's content.
void Add(std::string_view name, const std::shared_ptr< T > &ptr)
Add an existing object (rather a shared_ptr to it) to the TDirectory.
Internal::TDirectoryEntry Find(std::string_view name) const
Find the TDirectoryEntry associated to the name.
std::pair< Internal::TDirectoryEntry, EFindStatus > Find(std::string_view name) const
Find the TDirectoryEntry associated with the name.
std::unordered_map< std::string, Internal::TDirectoryEntry > ContentMap_t
The directory content is a hashed map of name => Internal::TDirectoryEntry.
std::shared_ptr< ToContentType_t< T > > Get(std::string_view name)
Get the object for a key.
@ kWarning
Warnings about likely unexpected behavior.
Namespace for new ROOT classes and functions.
basic_string_view< char > string_view
typename std::enable_if<!std::is_pointer< decaytype >::value &&!std::is_member_pointer< decaytype >::value &&!std::is_void< decaytype >::value, decaytype >::type type
typename std::decay< T >::type decaytype