| # 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
SmartDataObjectPtr.h
Go to the documentation of this file.
1 // $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/GaudiKernel/SmartDataObjectPtr.h,v 1.7 2007/11/21 09:29:31 marcocle Exp $
2 #ifndef GAUDIKERNEL_SMARTDATAOBJECTPTR_H
3 #define GAUDIKERNEL_SMARTDATAOBJECTPTR_H 1
4
5 // STL include files
6 #include <string>
7
8 // Framework include files
9 #include "GaudiKernel/Kernel.h"
10 #include "GaudiKernel/StatusCode.h"
11
12 // Forward declarations
13 class SmartDataObjectPtr;
14 class IDataProviderSvc;
15 class IRegistry;
16 class DataObject;
17
33 class GAUDI_API SmartDataObjectPtr {
34 public:
35 typedef DataObject* (* AccessFunction) (SmartDataObjectPtr* ptr);
37 class ObjectLoader {
38 public:
39 static AccessFunction access();
40 };
41
43 class ObjectFinder {
44 public:
45 static AccessFunction access();
46 };
47
48 public:
55 SmartDataObjectPtr(AccessFunction access, IDataProviderSvc* pService, IRegistry* pDir, const std::string& path)
56 : m_dataProvider(pService),
57 m_pRegistry(pDir),
58 m_status(StatusCode::SUCCESS,true),
59 m_path(path),
60 m_accessFunc(access)
61 {
62 }
66 SmartDataObjectPtr(const SmartDataObjectPtr& copy)
67 : m_dataProvider(copy.m_dataProvider),
68 m_pRegistry(copy.m_pRegistry),
69 m_status(copy.m_status),
70 m_path(copy.m_path),
71 m_accessFunc(copy.m_accessFunc)
72 {
73 }
75 virtual ~SmartDataObjectPtr() {
76 }
78 virtual SmartDataObjectPtr& operator=(const SmartDataObjectPtr& copy);
79
81 operator IRegistry*() {
82 return m_pRegistry;
83 }
84
86 const std::string& path() const {
87 return m_path;
88 }
89
91 IRegistry* directory() {
92 return m_pRegistry;
93 }
94
96 void setService( IDataProviderSvc* svc ) {
97 m_dataProvider = svc;
98 }
99
101 IDataProviderSvc* service() {
102 return m_dataProvider;
103 }
104
106 StatusCode getLastError() const {
107 return m_status;
108 }
109
111 DataObject* accessData() {
112 return m_accessFunc(this);
113 }
114
116 static DataObject* retrieve(SmartDataObjectPtr* ptr) {
117 return ptr->retrieveObject();
118 }
119
121 static DataObject* find(SmartDataObjectPtr* ptr) {
122 return ptr->findObject();
123 }
124
126 static DataObject* update(SmartDataObjectPtr* ptr) {
127 return ptr->updateObject();
128 }
129
135 DataObject* retrieveObject();
136
142 DataObject* findObject();
143
150 DataObject* updateObject();
151
152 protected:
153
159 StatusCode find(IRegistry* pDirectory, const std::string& path, DataObject*& refpObject);
160
166 StatusCode find(const std::string& fullPath, DataObject*& refpObject);
167
173 StatusCode retrieve(IRegistry* pDirectory, const std::string& path, DataObject*& refpObject);
179 StatusCode retrieve(const std::string& fullPath, DataObject*& refpObject);
180
185 StatusCode update(IRegistry* pDirectory);
190 StatusCode update(const std::string& fullPath);
191
192 protected:
194 mutable IDataProviderSvc* m_dataProvider;
196 mutable IRegistry* m_pRegistry;
198 mutable StatusCode m_status;
200 std::string m_path;
202 AccessFunction m_accessFunc;
203
204 };
205 #endif // GAUDIKERNEL_SMARTDATAOBJECTPTR_H