| The Gaudi Framework v30r0 (c919700c)

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

- File List
- File Members

LinkManager.h
Go to the documentation of this file.
1 #ifndef GAUDIKERNEL_LINKMANAGER_H
2 #define GAUDIKERNEL_LINKMANAGER_H
3
4 // STL includes
5 #include <memory>
6 #include <string>
7 #include <vector>
8 // Gaudi
9 #include "GaudiKernel/Kernel.h"
10
11 class DataObject;
12 class IOpaqueAddress;
13
21 class GAUDI_API LinkManager
22 {
23
24 public:
26 enum DirLinkType { INVALID, VALID };
27
32 class Link final
33 {
35 // friend class LinkManager;
37 std::string m_path;
39 DataObject* m_pObject = nullptr;
41 long m_id = INVALID;
42
43 public:
45 Link( long id, std::string path, DataObject* pObject = nullptr )
46 : m_path( std::move( path ) ), m_pObject( pObject ), m_id( id )
47 {
48 }
50 Link() = default;
52 void set( long id, std::string path, DataObject* pObject )
53 {
54 setObject( pObject );
55 m_path = std::move( path );
56 m_id = id;
57 }
59 bool operator==( const Link& link ) const { return link.m_path == m_path; }
61 void setObject( const DataObject* pObject ) { m_pObject = const_cast<DataObject*>( pObject ); }
63 const DataObject* object() const { return m_pObject; }
64 DataObject* object() { return m_pObject; }
66 const std::string& path() const { return m_path; }
68 long ID() const { return m_id; }
70 IOpaqueAddress* address();
71 };
72
73 private:
75 // without the need for friendship. It needs to 'shunt'
76 // all contained links to a new prefix...
77 // The steps to get there are
78 // 1) provide friend access for backwards compatibility
79 // 2) add new interface here
80 // 3) once released, update MergeEventAlg to use the new
81 // interface
82 // 4) revoke friendship.
83 // Now we're at stage 1...
84 friend class MergeEventAlg;
93 mutable std::vector<Link*> m_linkVector;
94
95 public:
97 LinkManager() = default;
99 virtual ~LinkManager();
101 static LinkManager* newInstance();
103 static void setInstantiator( LinkManager* ( *newInstance )() );
105 long size() const { return m_linkVector.size(); }
106 bool empty() const { return m_linkVector.empty(); }
108 Link* link( long id );
110 Link* link( const DataObject* pObject );
112 Link* link( const std::string& path );
114 long addLink( const std::string& path, const DataObject* pObject ) const;
116 long removeLink( const DataObject* pObject ) const;
118 long removeLink( const std::string& fullPath ) const;
120 long removeLink( long id ) const;
122 void clearLinks();
123 };
124 #endif // GAUDIKERNEL_LINKMANAGER_H
LinkManager::Link::path
const std::string & path() const
Access to path of object.
Definition: LinkManager.h:66
Kernel.h
std::vector::empty
T empty(T...args)
GaudiPython.HistoUtils.path
path
Definition: HistoUtils.py:895
Io::INVALID
Definition: IFileMgr.h:37
std
STL namespace.
std::string
STL class.
LinkManager::Link::setObject
void setObject(const DataObject *pObject)
Update object pointer.
Definition: LinkManager.h:61
LinkManager::DirLinkType
DirLinkType
Directory link types.
Definition: LinkManager.h:26
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::empty
bool empty() const
Definition: LinkManager.h:106
LinkManager::Link::object
DataObject * object()
Definition: LinkManager.h:64
std::move
T move(T...args)
LinkManager::Link::Link
Link(long id, std::string path, DataObject *pObject=nullptr)
Standard constructor.
Definition: LinkManager.h:45
std::vector::size
T size(T...args)
std::vector
STL class.
LinkManager::Link::ID
long ID() const
Link identifier.
Definition: LinkManager.h:68
LinkManager::Link::object
const DataObject * object() const
Const access to data object.
Definition: LinkManager.h:63
LinkManager::Link
Embedded class defining a symbolic link Note: No copy constructor; bitwise copy (done by the compiler...
Definition: LinkManager.h:32
LinkManager::Link::operator==
bool operator==(const Link &link) const
Equality operator: check paths only.
Definition: LinkManager.h:59
IOpaqueAddress
Opaque address interface definition.
Definition: IOpaqueAddress.h:23
GAUDI_API
#define GAUDI_API
Definition: Kernel.h:110
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30
LinkManager
A LinkManager is the object aggregated into a DataObject, which is responsible for the handling of no...
Definition: LinkManager.h:21
LinkManager::Link::m_path
std::string m_path
DataObject is a friend.
Definition: LinkManager.h:37
LinkManager::size
long size() const
Retrieve number of link present.
Definition: LinkManager.h:105