| # Gaudi Framework, version v25r0 |

Home |  | Generated: Mon Feb 17 2014

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

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 <vector>
6 #include <string>
7 // Gaudi
8 #include "GaudiKernel/Kernel.h"
9
10 class DataObject;
11 class IOpaqueAddress;
12
20 class GAUDI_API LinkManager {
21
22 public:
24 enum DirLinkType {INVALID, VALID};
25
30 class Link {
32 friend class LinkManager;
33 protected:
35 std::string m_path;
37 DataObject* m_pObject;
39 long m_id;
40 public:
42 Link(long id, const std::string& path, const DataObject* pObject=0)
43 : m_path(path), m_id(id) {
44 setObject(pObject);
45 }
47 Link() : m_path(""), m_pObject(0), m_id(INVALID) {
48 }
50 Link& operator=(const Link& link) {
51 setObject(link.m_pObject);
52 m_path = link.m_path;
53 m_id = link.m_id;
54 return *this;
55 }
57 virtual ~Link() {
58 }
60 void set(long id, const std::string& path, const DataObject* pObject) {
61 setObject(pObject);
62 m_path = path;
63 m_id = id;
64 }
66 bool operator==(const Link& link) const {
67 return link.m_path == m_path;
68 }
70 void setObject(const DataObject* pObject) {
71 m_pObject = const_cast<DataObject*>(pObject);
72 }
74 DataObject* object() const {
75 return m_pObject;
76 }
78 const std::string& path() const {
79 return m_path;
80 }
82 long ID() const {
83 return m_id;
84 }
86 virtual IOpaqueAddress* address();
87 };
88 typedef std::vector<Link*> LinkVector;
90 typedef LinkVector::iterator LinkIterator;
92 typedef LinkVector::const_iterator ConstLinkIterator;
93
95 mutable LinkVector m_linkVector;
96
97 public:
99 LinkManager();
101 virtual ~LinkManager();
103 static LinkManager* newInstance();
105 static void setInstantiator( LinkManager* (*newInstance)() );
107 long size() const {
108 return m_linkVector.size();
109 }
111 Link* link(long id);
113 Link* link(const DataObject* pObject);
115 Link* link(const std::string& path);
117 long addLink(const std::string& path, const DataObject* pObject) const;
119 long removeLink(const DataObject* pObject) const;
121 long removeLink(const std::string& fullPath) const;
123 long removeLink(long id) const;
125 void clearLinks();
126 };
127 #endif // GAUDIKERNEL_LINKMANAGER_H