| The Gaudi Framework v29r0 (ff2e7097)

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

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

enum LinkManager::DirLinkType

Directory link types.

Enumerator
INVALID |
VALID |

Definition at line 26 of file LinkManager.h.

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

## Constructor & Destructor Documentation

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

Standard Constructor.

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

Standard Destructor.

destructor

Definition at line 9 of file LinkManager.cpp.

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

## Member Function Documentation

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 59 of file LinkManager.cpp.

60 {
61 long n = 0;
62 for ( auto& lnk : m_linkVector ) {
63 const DataObject* pO = lnk->object();
64 if ( pO && pO == pObject ) return n;
65 if ( lnk->path() == path ) {
66 if ( pObject && pObject != pO ) {
67 lnk->setObject( const_cast<DataObject*>( pObject ) );
68 }
69 return n;
70 }
71 ++n;
72 }
73 // Link is completely unknown
74 m_linkVector.emplace_back( new Link( m_linkVector.size(), path, const_cast<DataObject*>( pObject ) ) );
75 return m_linkVector.back()->ID();
76 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:895
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29

void LinkManager::clearLinks | ( |  | ) |

Remove all possibly existing symbolic links.

Definition at line 118 of file LinkManager.cpp.

119 {
120 for ( auto& i : m_linkVector ) delete i;
121 m_linkVector.clear();
122 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93

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

Definition at line 106 of file LinkManager.h.

106 { return m_linkVector.empty(); }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93

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

Retrieve symbolic link identified by ID.

Definition at line 31 of file LinkManager.cpp.

32 {
33 return ( 0 <= id && (unsigned)id < m_linkVector.size() ) ? m_linkVector[id] : nullptr;
34 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93

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

Retrieve symbolic link identified by object.

Retrieve symbolic link identified by Object pointer.

Definition at line 37 of file LinkManager.cpp.

38 {
39 if ( pObject ) {
40 for ( auto& i : m_linkVector ) {
41 if ( i->object() == pObject ) return i;
42 }
43 }
44 return nullptr;
45 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93

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

Retrieve symbolic link identified by path.

Retrieve symbolic link identified by Object path.

Definition at line 48 of file LinkManager.cpp.

49 {
50 if ( 0 != path.length() ) {
51 for ( auto& i : m_linkVector ) {
52 if ( i->path() == path ) return i;
53 }
54 }
55 return nullptr;
56 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:895
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93
std::string::length
T length(T...args)

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

Static instantiation.

Definition at line 28 of file LinkManager.cpp.

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

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

Remove link by object reference.

Definition at line 79 of file LinkManager.cpp.

80 {
81 long n = 0;
82 for ( auto i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
83 if ( ( *i )->object() == pObject ) {
84 delete *i;
85 m_linkVector.erase( i );
86 return n;
87 }
88 ++n;
89 }
90 return INVALID;
91 }
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93
LinkManager::INVALID
Definition: LinkManager.h:26

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

Remove link by object reference.

Definition at line 94 of file LinkManager.cpp.

95 {
96 long n = 0;
97 for ( auto i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
98 if ( ( *i )->path() == path ) {
99 delete *i;
100 m_linkVector.erase( i );
101 return n;
102 }
103 n++;
104 }
105 return INVALID;
106 }
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:895
GaudiPluginService.cpluginsvc.n
n
Definition: cpluginsvc.py:228
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93
LinkManager::INVALID
Definition: LinkManager.h:26

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

Remove link by link ID.

Definition at line 109 of file LinkManager.cpp.

110 {
111 auto i = std::next( m_linkVector.begin(), id );
112 delete *i;
113 m_linkVector.erase( i );
114 return id;
115 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93
std::next
T next(T...args)

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

Assign new instantiator.

Definition at line 25 of file LinkManager.cpp.

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

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

Retrieve number of link present.

Definition at line 105 of file LinkManager.h.

105 { return m_linkVector.size(); }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector<std::unique_ptr<Link>> once ROOT does &#39;automatic&#39; schema conversion fr...
Definition: LinkManager.h:93

## Friends And Related Function Documentation

friend class MergeEventAlg
| friend

@ TODO: provide interface to let MergeEvntAlg do its thing

Definition at line 84 of file LinkManager.h.

## Member Data Documentation

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 93 of file LinkManager.h.

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

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