| The Gaudi Framework v27r1

- 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 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 | ( |  | ) |
| default

Standard Constructor.

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> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:100
ana.i
list i
Definition: ana.py:128

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

58 {
59 long n = 0;
60 for ( auto& lnk : m_linkVector ) {
61 const DataObject* pO = lnk->object();
62 if ( pO && pO == pObject ) return n;
63 if ( lnk->path() == path ) {
64 if ( pObject && pObject != pO ) {
65 lnk->setObject(const_cast<DataObject*>(pObject));
66 }
67 return n;
68 }
69 ++n;
70 }
71 // Link is completely unknown
72 m_linkVector.emplace_back( new Link(m_linkVector.size(), path, const_cast<DataObject*>(pObject)) );
73 return m_linkVector.back()->ID();
74 }
GaudiPluginService.cpluginsvc.n
list n
Definition: cpluginsvc.py:217
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:100
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30

void LinkManager::clearLinks | ( |  | ) |

Remove all possibly existing symbolic links.

Definition at line 113 of file LinkManager.cpp.

113 {
114 for (auto& i : m_linkVector) delete i;
115 m_linkVector.clear();
116 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:100
ana.i
list i
Definition: ana.py:128

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

Definition at line 113 of file LinkManager.h.

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

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

Retrieve symbolic link identified by ID.

Definition at line 33 of file LinkManager.cpp.

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

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

Retrieve symbolic link identified by object.

Retrieve symbolic link identified by Object pointer.

Definition at line 38 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> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:100
ana.i
list i
Definition: ana.py:128

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.

48 {
49 if ( 0 != path.length() ) {
50 for ( auto & i : m_linkVector ) {
51 if ( i->path() == path ) return i;
52 }
53 }
54 return nullptr;
55 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:100
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191
std::string::length
T length(T...args)
ana.i
list i
Definition: ana.py:128

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

Static instantiation.

Definition at line 28 of file LinkManager.cpp.

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

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

Remove link by object reference.

Definition at line 77 of file LinkManager.cpp.

77 {
78 long n = 0;
79 for ( auto i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
80 if ( (*i)->object() == pObject ) {
81 delete *i;
82 m_linkVector.erase(i);
83 return n;
84 }
85 ++n;
86 }
87 return INVALID;
88 }
GaudiPluginService.cpluginsvc.n
list n
Definition: cpluginsvc.py:217
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:100
LinkManager::INVALID
Definition: LinkManager.h:25
ana.i
list i
Definition: ana.py:128

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

Remove link by object reference.

Definition at line 91 of file LinkManager.cpp.

91 {
92 long n = 0;
93 for ( auto i = m_linkVector.begin(); i != m_linkVector.end(); i++ ) {
94 if ( (*i)->path() == path ) {
95 delete *i;
96 m_linkVector.erase(i);
97 return n;
98 }
99 n++;
100 }
101 return INVALID;
102 }
GaudiPluginService.cpluginsvc.n
list n
Definition: cpluginsvc.py:217
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:100
LinkManager::INVALID
Definition: LinkManager.h:25
Gaudi::Utils::Histos::path
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram
Definition: HistoTableFormat.cpp:191
ana.i
list i
Definition: ana.py:128

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

Remove link by link ID.

Definition at line 105 of file LinkManager.cpp.

105 {
106 auto i = std::next(m_linkVector.begin(), id );
107 delete *i;
108 m_linkVector.erase(i);
109 return id;
110 }
LinkManager::m_linkVector
std::vector< Link * > m_linkVector
@ TODO: replace by std::vector> once ROOT does 'automatic' schema conversion fr...
Definition: LinkManager.h:100
std::next
T next(T...args)
ana.i
list i
Definition: ana.py:128

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

Assign new instantiator.

Definition at line 23 of file LinkManager.cpp.

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

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

Retrieve number of link present.

Definition at line 112 of file LinkManager.h.

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

## Friends And Related Function Documentation

friend class MergeEventAlg
| friend

@ TODO: provide interface to let MergeEvntAlg do its thing

Definition at line 91 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 100 of file LinkManager.h.

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

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