The Gaudi Framework  master (ff829712)
Loading...
Searching...
No Matches
LinkManager Class Referencefinal

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:

Classes

class  Link
 Embedded class defining a symbolic link Note: No explicit copy constructor; implicit compiler generated one is just fine. More...
 

Public Types

enum  DirLinkType { INVALID , VALID }
 Directory link types. More...
 

Public Member Functions

 LinkManager ()=default
 Standard Constructor.
 
 LinkManager (LinkManager &&)=default
 
LinkManageroperator= (LinkManager &&)=default
 
 LinkManager (LinkManager const &)=delete
 
LinkManageroperator= (LinkManager const &)=delete
 
 ~LinkManager ()
 Standard Destructor.
 
long size () const
 Retrieve number of link present.
 
bool empty () const
 
const Linklink (long id) const
 Retrieve symbolic link identified by ID.
 
Linklink (long id)
 
const Linklink (const DataObject *pObject) const
 Retrieve symbolic link identified by object.
 
Linklink (const DataObject *pObject)
 
const Linklink (std::string_view path) const
 Retrieve symbolic link identified by path.
 
Linklink (std::string_view path)
 
long addLink (const std::string &path, const DataObject *pObject)
 Add link by object reference and path.
 
auto end () const
 
auto begin () const
 

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>... Or, even better, just std::vector<Link>, given that Link is barely larger than a pointer (40 vs.
 

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

Member Enumeration Documentation

◆ DirLinkType

Directory link types.

Enumerator
INVALID 
VALID 

Definition at line 32 of file LinkManager.h.

Constructor & Destructor Documentation

◆ LinkManager() [1/3]

LinkManager::LinkManager ( )
default

Standard Constructor.

◆ LinkManager() [2/3]

LinkManager::LinkManager ( LinkManager && )
default

◆ LinkManager() [3/3]

LinkManager::LinkManager ( LinkManager const & )
delete

◆ ~LinkManager()

LinkManager::~LinkManager ( )

Standard Destructor.

destructor

Definition at line 26 of file LinkManager.cpp.

26 {
27 for ( auto& i : m_linkVector ) delete i;
28}

Member Function Documentation

◆ addLink()

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

Add link by object reference and path.

Add link by object reference and path string.

Definition at line 66 of file LinkManager.cpp.

66 {
67 long n = 0;
68 for ( auto& lnk : m_linkVector ) {
69 const DataObject* pO = lnk->object();
70 if ( pO && pO == pObject ) return n;
71 if ( lnk->path() == path ) {
72 if ( pObject && pObject != pO ) { lnk->setObject( const_cast<DataObject*>( pObject ) ); }
73 return n;
74 }
75 ++n;
76 }
77 // Link is completely unknown
78 return m_linkVector.emplace_back( new Link( m_linkVector.size(), path, const_cast<DataObject*>( pObject ) ) )->ID();
79}

◆ begin()

auto LinkManager::begin ( ) const
inline

Definition at line 103 of file LinkManager.h.

103 {
104 class Iterator {
105 int i;
106 LinkManager const* parent;
107
108 public:
109 Iterator( LinkManager const* p, int i ) : i{ i }, parent{ p } {}
110 bool operator==( std::default_sentinel_t ) const { return i == parent->size(); }
111 Iterator& operator++() {
112 ++i;
113 return *this;
114 }
115 const Link& operator*() const { return *parent->link( i ); }
116 };
117 return Iterator{ this, 0 };
118 }
bool operator==(const GaudiUtils::Allocator< T1 > &, const GaudiUtils::Allocator< T2 > &)
Definition Allocator.h:224
boost::spirit::classic::position_iterator2< ForwardIterator > Iterator
Definition Iterator.h:18
auto operator*(const std::chrono::duration< Rep1, Period > &lhs, const std::chrono::duration< Rep2, Period > &rhs)
Multiplication of two std::chrono::duration objects with same Period.
Definition Counters.h:40

◆ empty()

bool LinkManager::empty ( ) const
inline

Definition at line 89 of file LinkManager.h.

89{ return m_linkVector.empty(); }

◆ end()

auto LinkManager::end ( ) const
inline

Definition at line 102 of file LinkManager.h.

102{ return std::default_sentinel; }

◆ link() [1/6]

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

Definition at line 53 of file LinkManager.cpp.

53 {
54 return pObject ? findLink( m_linkVector, [=]( auto* j ) { return j->object() == pObject; } ) : nullptr;
55}

◆ link() [2/6]

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

Retrieve symbolic link identified by object.

Retrieve symbolic link identified by Object pointer.

Definition at line 49 of file LinkManager.cpp.

49 {
50 return pObject ? findLink( m_linkVector, [=]( auto* j ) { return j->object() == pObject; } ) : nullptr;
51}

◆ link() [3/6]

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

Definition at line 44 of file LinkManager.cpp.

44 {
45 return ( 0 <= id && (unsigned)id < m_linkVector.size() ) ? m_linkVector[id] : nullptr;
46}

◆ link() [4/6]

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

Retrieve symbolic link identified by ID.

Definition at line 40 of file LinkManager.cpp.

40 {
41 return ( 0 <= id && (unsigned)id < m_linkVector.size() ) ? m_linkVector[id] : nullptr;
42}

◆ link() [5/6]

LinkManager::Link * LinkManager::link ( std::string_view path)

Definition at line 61 of file LinkManager.cpp.

61 {
62 return !path.empty() ? findLink( m_linkVector, [=]( auto* j ) { return j->path() == path; } ) : nullptr;
63}
GAUDI_API std::string path(const AIDA::IBaseHistogram *aida)
get the path in THS for AIDA histogram

◆ link() [6/6]

const LinkManager::Link * LinkManager::link ( std::string_view path) const

Retrieve symbolic link identified by path.

Retrieve symbolic link identified by Object path.

Definition at line 58 of file LinkManager.cpp.

58 {
59 return !path.empty() ? findLink( m_linkVector, [=]( auto* j ) { return j->path() == path; } ) : nullptr;
60}

◆ operator=() [1/2]

LinkManager & LinkManager::operator= ( LinkManager && )
default

◆ operator=() [2/2]

LinkManager & LinkManager::operator= ( LinkManager const & )
delete

◆ size()

long LinkManager::size ( ) const
inline

Retrieve number of link present.

Definition at line 88 of file LinkManager.h.

88{ return m_linkVector.size(); }

Member Data Documentation

◆ m_linkVector

std::vector<Link*> LinkManager::m_linkVector
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 76 of file LinkManager.h.


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