16#ifndef ROOT7_RDirectory
17#define ROOT7_RDirectory
25#include <unordered_map>
30namespace Experimental {
43 const char *
what() const noexcept final {
return fKeyName.c_str(); }
55 const char *
what() const noexcept final {
return fKeyName.c_str(); }
78 using ContentMap_t = std::unordered_map<std::string, Internal::RDirectoryEntry>;
87 typename std::enable_if<!std::is_pointer<decaytype>::value && !std::is_member_pointer<decaytype>::value &&
88 !std::is_void<decaytype>::value,
100 template <
class T,
class...
ARGS>
101 std::shared_ptr<ToContentType_t<T>>
Create(std::string_view
name,
ARGS &&... args)
103 auto ptr = std::make_shared<ToContentType_t<T>>(std::forward<ARGS>(args)...);
136 std::pair<Internal::RDirectoryEntry, EFindStatus>
Find(std::string_view
name)
const
156 std::shared_ptr<ToContentType_t<T>>
Get(std::string_view
name)
158 const auto &pair = Find<T>(
name);
175 void Add(std::string_view
name,
const std::shared_ptr<T> &ptr)
179 std::string sName(
name);
183 idx->second.swap(entry);
192 std::string sName(
name);
#define R__LOG_WARNING(...)
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 .
const char * what() const noexcept final
RDirectoryTypeMismatch(std::string_view keyName)
Objects of this class are thrown to signal that no key with that name exists.
const char * what() const noexcept final
RDirectoryUnknownKey(std::string_view keyName)
Key/value store of objects.
typename ToContentType< T >::type ToContentType_t
bool Remove(std::string_view name)
Remove entry from RDirectory (if exists)
static RDirectory & Heap()
Dedicated, process-wide RDirectory.
Internal::RDirectoryEntry Find(std::string_view name) const
Find the RDirectoryEntry associated to the name.
std::shared_ptr< ToContentType_t< T > > Get(std::string_view name)
Get the object for a key.
void Add(std::string_view name, const std::shared_ptr< T > &ptr)
Add an existing object (rather a shared_ptr to it) to the RDirectory.
std::unordered_map< std::string, Internal::RDirectoryEntry > ContentMap_t
The directory content is a hashed map of name => Internal::RDirectoryEntry.
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 RDirectory's content.
std::pair< Internal::RDirectoryEntry, EFindStatus > Find(std::string_view name) const
Find the RDirectoryEntry associated with the name.
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).
A log configuration for a channel, e.g.
RLogChannel & IOLog()
Logging for generic IO functionality.
tbb::task_arena is an alias of tbb::interface7::task_arena, which doesn't allow to forward declare tb...
typename std::decay< T >::type decaytype
typename std::enable_if<!std::is_pointer< decaytype >::value &&!std::is_member_pointer< decaytype >::value &&!std::is_void< decaytype >::value, decaytype >::type type