![]() |
ROOT
6.06/09
Reference Guide
|
Key/value store of objects.
Given a name, a TDirectory
can store and retrieve an object. It will manage ownership through a TCoopPtr
: if you delete the object, the object will be gone from the TDirectory
. Once the TDirectory
is destructed, the objects it contains are destructed (unless other TCoopPtr
s reference the same object).
Example: TDirectory dirBackgrounds; TDirectory dirQCD; TDirectory dirHiggs;
Definition at line 42 of file TDirectory.h.
Public Member Functions | |
template<class T , class... ARGS> | |
TCoopPtr< T > | Create (const std::string &name, ARGS...args) |
Create an object of type T (passing some arguments to its constructor). More... | |
const TKey * | FindKey (const std::string &name) const |
template<class T > | |
const TKey & | Add (const std::string &name, TCoopPtr< T > ptr) |
Add an existing object (rather a TCoopPtr to it) to the TDirectory. More... | |
Static Public Member Functions | |
static TDirectory & | Heap () |
Dedicated, process-wide TDirectory. More... | |
Private Types | |
using | Value_t = std::shared_ptr< Internal::TCoopPtrTypeErasedBase > |
The values referenced by a TDirectory are type erased TCoopPtr s: they can be of any type; the actual type is determined through the virtual interface of Internal::TCoopPtrTypeErasedBase. More... | |
using | ContentMap_t = std::unordered_map< TKey, Value_t > |
The directory content is a hashed map of TKey => Value_t . More... | |
Private Attributes | |
ContentMap_t | fContent |
The TDirectory 's content. More... | |
#include <ROOT/TDirectory.h>
|
private |
The directory content is a hashed map of TKey
=> Value_t
.
TODO: really? Or just std::string => Value_t - that should be enough! Rather add some info (time stamp etc) to the Value_t.
Definition at line 52 of file TDirectory.h.
|
private |
The values referenced by a TDirectory are type erased TCoopPtr
s: they can be of any type; the actual type is determined through the virtual interface of Internal::TCoopPtrTypeErasedBase.
Definition at line 47 of file TDirectory.h.
|
inline |
Add an existing object (rather a TCoopPtr
to it) to the TDirectory.
The TDirectory will not delete the object but it will need to be notified once the object is deleted.
Definition at line 85 of file TDirectory.h.
|
inline |
Create an object of type T
(passing some arguments to its constructor).
The TDirectory
will register the object.
name | - Key of the object. |
args | - arguments to be passed to the constructor of T |
Definition at line 65 of file TDirectory.h.
|
inline |
Definition at line 74 of file TDirectory.h.
|
static |
Dedicated, process-wide TDirectory.
|
private |
The TDirectory
's content.
Definition at line 55 of file TDirectory.h.