| The Gaudi Framework v32r1 (f65d50dc)

Classes | Public Types | Public Member Functions | Static Public Member Functions | Private Attributes | Friends | List of all members
LinkManager Class Reference

A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of non-tree like links. More...

`#include <GaudiKernel/LinkManager.h>`

Collaboration diagram for LinkManager:
[legend]

## Classes
class | Link
| Embedded class defining a symbolic link Note: No copy constructor; bitwise copy (done by the compiler) is just fine. More...

## Public Types
enum | DirLinkType { INVALID, VALID }
| Directory link types. More...

## Public Member Functions
| LinkManager ()=default
| Standard Constructor. More...
virtual | ~LinkManager ()
| Standard Destructor. More...
long | size () const
| Retrieve number of link present. More...
bool | empty () const
Link * | link (long id)
| Retrieve symbolic link identified by ID. More...
Link * | link (const DataObject *pObject)
| Retrieve symbolic link identified by object. More...
Link * | link (const std::string &path)
| Retrieve symbolic link identified by path. More...
long | addLink (const std::string &path, const DataObject *pObject) const
| Add link by object reference and path. More...
long | removeLink (const DataObject *pObject) const
| Remove link by object reference. More...
long | removeLink (const std::string &fullPath) const
| Remove link by object reference. More...
long | removeLink (long id) const
| Remove link by link ID. More...
void | clearLinks ()
| Remove all possibly existing symbolic links. More...

## Static Public Member Functions
static LinkManager * | newInstance ()
| Static instantiation. More...
static void | setInstantiator (LinkManager *(*newInstance)())
| Assign new instantiator. More...

## Private Attributes
std::vector< Link * > | m_linkVector
| @ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion from T* to std::unique_ptr<T>... More...

## Friends
class | MergeEventAlg
| @ TODO: provide interface to let MergeEvntAlg do its thing More...

## Detailed Description

A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of non-tree like links.

Author
  M.Frank

Definition at line 21 of file LinkManager.h.

## Member Enumeration Documentation

## ◆ DirLinkType

enum LinkManager::DirLinkType

Directory link types.

Enumerator
INVALID |
VALID |

Definition at line 25 of file LinkManager.h.

25 { INVALID, VALID };
LinkManager::INVALID
Definition: LinkManager.h:25
LinkManager::VALID
Definition: LinkManager.h:25

## Constructor & Destructor Documentation

## ◆ LinkManager()

LinkManager::LinkManager | ( |  | ) |
| default

Standard Constructor.

## ◆ ~LinkManager()

LinkManager::~LinkManager | ( |  | ) |
| virtual

Standard Destructor.

destructor

Definition at line 9 of file LinkManager.cpp.

9 {
10 for ( auto& i : m_linkVector ) delete i;
11 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88

## Member Function Documentation

## ◆ addLink()

long LinkManager::addLink | ( | const std::string & | path,
|  | const DataObject * | pObject
| ) |  | const

Add link by object reference and path.

Add link by object reference and path string.

Definition at line 54 of file LinkManager.cpp.

54 {
55 long n = 0;
56 for ( auto& lnk : m_linkVector ) {
57 const DataObject* pO = lnk->object();
58 if ( pO && pO == pObject ) return n;
59 if ( lnk->path() == path ) {
60 if ( pObject && pObject != pO ) { lnk->setObject( const_cast<DataObject*>( pObject ) ); }
61 return n;
62 }
63 ++n;
64 }
65 // Link is completely unknown
66 m_linkVector.emplace_back( new Link( m_linkVector.size(), path, const_cast<DataObject*>( pObject ) ) );
67 return m_linkVector.back()->ID();
68 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:210
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

## ◆ clearLinks()

void LinkManager::clearLinks | ( |  | ) |

Remove all possibly existing symbolic links.

Definition at line 107 of file LinkManager.cpp.

107 {
108 for ( auto& i : m_linkVector ) delete i;
109 m_linkVector.clear();
110 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88

## ◆ empty()

bool LinkManager::empty | ( |  | ) | const
| inline

Definition at line 101 of file LinkManager.h.

101 { return m_linkVector.empty(); }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88

## ◆ link() [1/3]

LinkManager::Link * LinkManager::link | ( | long | id | ) |

Retrieve symbolic link identified by ID.

Definition at line 29 of file LinkManager.cpp.

29 {
30 return ( 0 <= id && (unsigned)id < m_linkVector.size() ) ? m_linkVector[id] : nullptr;
31 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88

## ◆ link() [2/3]

LinkManager::Link * LinkManager::link | ( | const DataObject * | pObject | ) |

Retrieve symbolic link identified by object.

Retrieve symbolic link identified by Object pointer.

Definition at line 34 of file LinkManager.cpp.

34 {
35 if ( pObject ) {
36 for ( auto& i : m_linkVector ) {
37 if ( i->object() == pObject ) return i;
38 }
39 }
40 return nullptr;
41 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88

## ◆ link() [3/3]

LinkManager::Link * LinkManager::link | ( | const std::string & | path | ) |

Retrieve symbolic link identified by path.

Retrieve symbolic link identified by Object path.

Definition at line 44 of file LinkManager.cpp.

44 {
45 if ( 0 != path.length() ) {
46 for ( auto& i : m_linkVector ) {
47 if ( i->path() == path ) return i;
48 }
49 }
50 return nullptr;
51 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88

## ◆ newInstance()

LinkManager * LinkManager::newInstance | ( |  | ) |
| static

Static instantiation.

Definition at line 26 of file LinkManager.cpp.

26 { return s_newInstance ? ( *s_newInstance )() : new LinkManager(); }
LinkManager::LinkManager
LinkManager()=default
Standard Constructor.

## ◆ removeLink() [1/3]

long LinkManager::removeLink | ( | const DataObject * | pObject | ) | const

Remove link by object reference.

Definition at line 71 of file LinkManager.cpp.

71 {
72 long n = 0;
73 for ( auto i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
74 if ( ( *i )->object() == pObject ) {
75 delete *i;
76 m_linkVector.erase( i );
77 return n;
78 }
79 ++n;
80 }
81 return INVALID;
82 }
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:210
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88
LinkManager::INVALID
Definition: LinkManager.h:25

## ◆ removeLink() [2/3]

long LinkManager::removeLink | ( | const std::string & | fullPath | ) | const

Remove link by object reference.

Definition at line 85 of file LinkManager.cpp.

85 {
86 long n = 0;
87 for ( auto i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
88 if ( ( *i )->path() == path ) {
89 delete *i;
90 m_linkVector.erase( i );
91 return n;
92 }
93 n++;
94 }
95 return INVALID;
96 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:932
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:210
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88
LinkManager::INVALID
Definition: LinkManager.h:25

## ◆ removeLink() [3/3]

long LinkManager::removeLink | ( | long | id | ) | const

Remove link by link ID.

Definition at line 99 of file LinkManager.cpp.

99 {
100 auto i = std::next( m_linkVector.begin(), id );
101 delete *i;
102 m_linkVector.erase( i );
103 return id;
104 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88
std::next
T next(T... args)

## ◆ setInstantiator()

void LinkManager::setInstantiator | ( | LinkManager *(*)() | newInstance | ) |
| static

Assign new instantiator.

Definition at line 23 of file LinkManager.cpp.

23 { s_newInstance = newInstance; }
LinkManager::newInstance
static LinkManager * newInstance()
Static instantiation.
Definition: LinkManager.cpp:26

## ◆ size()

long LinkManager::size | ( |  | ) | const
| inline

Retrieve number of link present.

Definition at line 100 of file LinkManager.h.

100 { return m_linkVector.size(); }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:88

## Friends And Related Function Documentation

## ◆ MergeEventAlg

friend class MergeEventAlg
| friend

@ TODO: provide interface to let MergeEvntAlg do its thing

Definition at line 79 of file LinkManager.h.

## Member Data Documentation

## ◆ m_linkVector

std::vector<Link*> LinkManager::m_linkVector
| mutable private

@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does 'automatic' schema conversion from T* to std::unique_ptr<T>...

Or, even better, just std::vector<Link>, given that Link is barely larger than a pointer (40 vs. 8 bytes) – but that requires more invasive schema evolution.

The vector containing all links which are non-tree like

Definition at line 88 of file LinkManager.h.

The documentation for this class was generated from the following files:

- GaudiKernel/GaudiKernel/LinkManager.h
- GaudiKernel/src/Lib/LinkManager.cpp