ROOT 6.18/05 Reference Guide |
The RooSTLRefCountList is a simple collection of pointers to the template objects with reference counters.
The pointees are not owned, hence not deleted when removed from the collection. Objects can be searched for either by pointer or by name (confusion possible when objects with same name are present). This replicates the behaviour of the RooRefCountList.
Definition at line 35 of file RooSTLRefCountList.h.
Public Types | |
using | Container_t = std::vector< T * > |
Public Member Functions | |
RooSTLRefCountList () | |
RooSTLRefCountList (const RooSTLRefCountList &)=default | |
virtual | ~RooSTLRefCountList () |
void | Add (T *obj, std::size_t initialCount=1) |
Add an object or increase refCount if it is already present. More... | |
Container_t::const_iterator | begin () const |
Iterator over contained objects. More... | |
const Container_t & | containedObjects () const |
Direct reference to container of objects held by this list. More... | |
bool | containsByNamePtr (const T *obj) const |
Check if list contains an item using findByNamePointer(). More... | |
template<typename Obj_t > | |
bool | containsByPointer (const Obj_t *obj) const |
Check if list contains an item using findByPointer(). More... | |
bool | containsSameName (const char *name) const |
Check if list contains an item using findByName(). More... | |
bool | empty () const |
Check if empty. More... | |
Container_t::const_iterator | end () const |
End of contained objects. More... | |
Container_t::const_iterator | findByName (const char *name) const |
Find an item by comparing strings returned by RooAbsArg::GetName() More... | |
Container_t::const_iterator | findByNamePointer (const T *item) const |
Find an item by comparing RooAbsArg::namePtr() adresses. More... | |
template<typename Obj_t > | |
Container_t::const_iterator | findByPointer (const Obj_t *item) const |
Find an item by comparing its adress. More... | |
RooSTLRefCountList & | operator= (const RooSTLRefCountList &)=default |
RooSTLRefCountList & | operator= (RooSTLRefCountList &&)=default |
template<typename Obj_t > | |
std::size_t | refCount (const Obj_t *obj) const |
Return ref count of item with given address. More... | |
std::size_t | refCount (typename Container_t::const_iterator item) const |
Return ref count of item that iterator points to. More... | |
void | Remove (const T *obj, bool force=false) |
Decrease ref count of given object. More... | |
void | RemoveAll (const T *obj) |
Remove from list irrespective of ref count. More... | |
void | reserve (std::size_t amount) |
std::size_t | size () const |
Number of contained objects (neglecting the ref count). More... | |
Private Attributes | |
std::vector< std::size_t > | _refCount |
Container_t | _storage |
#include <RooSTLRefCountList.h>
using RooSTLRefCountList< T >::Container_t = std::vector<T*> |
Definition at line 37 of file RooSTLRefCountList.h.
|
inline |
Definition at line 39 of file RooSTLRefCountList.h.
|
default |
|
inlinevirtual |
Definition at line 44 of file RooSTLRefCountList.h.
|
inline |
Add an object or increase refCount if it is already present.
Only compares pointers to check for existing objects
Definition at line 49 of file RooSTLRefCountList.h.
|
inline |
Iterator over contained objects.
Definition at line 77 of file RooSTLRefCountList.h.
|
inline |
Direct reference to container of objects held by this list.
Definition at line 88 of file RooSTLRefCountList.h.
|
inline |
Check if list contains an item using findByNamePointer().
Definition at line 155 of file RooSTLRefCountList.h.
|
inline |
Check if list contains an item using findByPointer().
Definition at line 149 of file RooSTLRefCountList.h.
|
inline |
Check if list contains an item using findByName().
Definition at line 161 of file RooSTLRefCountList.h.
|
inline |
Check if empty.
Definition at line 107 of file RooSTLRefCountList.h.
|
inline |
End of contained objects.
Definition at line 82 of file RooSTLRefCountList.h.
|
inline |
Find an item by comparing strings returned by RooAbsArg::GetName()
Definition at line 124 of file RooSTLRefCountList.h.
|
inline |
Find an item by comparing RooAbsArg::namePtr() adresses.
Definition at line 137 of file RooSTLRefCountList.h.
|
inline |
Find an item by comparing its adress.
Definition at line 114 of file RooSTLRefCountList.h.
|
default |
|
default |
|
inline |
Return ref count of item with given address.
Definition at line 72 of file RooSTLRefCountList.h.
|
inline |
Return ref count of item that iterator points to.
Definition at line 63 of file RooSTLRefCountList.h.
|
inline |
Decrease ref count of given object.
Shrink list if ref count reaches 0.
obj | Decrease ref count of given object. Compare by pointer. |
force | If true, remove irrespective of ref count. |
Definition at line 169 of file RooSTLRefCountList.h.
|
inline |
Remove from list irrespective of ref count.
Definition at line 186 of file RooSTLRefCountList.h.
|
inline |
Definition at line 100 of file RooSTLRefCountList.h.
|
inline |
Number of contained objects (neglecting the ref count).
Definition at line 94 of file RooSTLRefCountList.h.
|
private |
Definition at line 193 of file RooSTLRefCountList.h.
|
private |
Definition at line 192 of file RooSTLRefCountList.h.