| The Gaudi Framework v29r0 (ff2e7097)

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

- File List
- File Members

SmartDataLocator.h
Go to the documentation of this file.
1 // ====================================================================
2 // SmartDataLocator.h
3 // --------------------------------------------------------------------
4 //
5 // Package : GaudiKernel ( The LHCb Offline System)
6 //
7 // Description: Implementation of a smart pointer class to access
8 // easily (and efficiently) data stores.
9 //
10 // Author : M.Frank
11 // ====================================================================
12 #ifndef GAUDIKERNEL_SMARTDATALOCATOR_H
13 #define GAUDIKERNEL_SMARTDATALOCATOR_H 1
14
15 // Framework include files
16 #include "GaudiKernel/SmartDataPtr.h"
17
45 template <class TYPE>
46 class SmartDataLocator : public SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>
47 {
48 public:
57 SmartDataLocator( IDataProviderSvc* pService, const std::string& fullPath )
58 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, 0, fullPath )
59 {
60 }
61
70 SmartDataLocator( IDataProviderSvc* pService, IRegistry* pDirectory )
71 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, pDirectory, "" )
72 {
73 }
74
86 SmartDataLocator( IDataProviderSvc* pService, DataObject* pObject, const std::string& path )
87 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, 0, path )
88 {
89 if ( 0 != pObject ) {
90 this->m_pDirectory = pObject->registry();
91 }
92 }
93
103 SmartDataLocator( SmartDataObjectPtr& refObject, IRegistry* pDirectory )
104 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), pDirectory, "" )
105 {
106 }
107
117 SmartDataLocator( SmartDataObjectPtr& refObject, const std::string& path )
118 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(), path )
119 {
120 }
121
124 virtual ~SmartDataLocator() {}
125
127 template <class OTHER>
128 SmartDataPtr<OTHER>& operator=( OTHER* pObj )
129 {
130 this->m_pObject = dynamic_cast<TYPE*>( pObj );
131 return *this;
132 }
133
135 template <class OTHER>
136 SmartDataPtr<OTHER>& operator=( const OTHER* pObj )
137 {
138 this->m_pObject = dynamic_cast<TYPE*>( const_cast<OTHER*>( pObj ) );
139 return *this;
140 }
141 };
142
143 #endif // GAUDIKERNEL_SMARTDATALOCATOR_H
SmartDataLocator::SmartDataLocator
SmartDataLocator(IDataProviderSvc *pService, DataObject *pObject, const std::string &path)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
Definition: SmartDataLocator.h:86
SmartDataLocator::SmartDataLocator
SmartDataLocator(IDataProviderSvc *pService, const std::string &fullPath)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
Definition: SmartDataLocator.h:57
SmartDataLocator
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataLocator.h:46
IDataProviderSvc
Data provider interface definition.
Definition: IDataProviderSvc.h:45
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
SmartDataObjectPtr::service
IDataProviderSvc * service()
Retrieve data service.
Definition: SmartDataObjectPtr.h:85
std::string
STL class.
SmartDataObjectPtr::ObjectLoader
Helper class to configure smart pointer functionality.
Definition: SmartDataObjectPtr.h:37
SmartDataLocator::SmartDataLocator
SmartDataLocator(SmartDataObjectPtr &refObject, const std::string &path)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
Definition: SmartDataLocator.h:117
SmartDataLocator::SmartDataLocator
SmartDataLocator(IDataProviderSvc *pService, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
Definition: SmartDataLocator.h:70
SmartDataPtr.h
SmartDataObjectPtr::path
const std::string & path() const
Path name.
Definition: SmartDataObjectPtr.h:76
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
SmartDataLocator::SmartDataLocator
SmartDataLocator(SmartDataObjectPtr &refObject, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
Definition: SmartDataLocator.h:103
SmartDataObjectPtr
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataObjectPtr.h:32
SmartDataStorePtr
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataStorePtr.h:45
SmartDataPtr
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:47
SmartDataLocator::~SmartDataLocator
virtual ~SmartDataLocator()
Standard destructor.
Definition: SmartDataLocator.h:124
SmartDataObjectPtr::directory
IRegistry * directory()
Access to data directory.
Definition: SmartDataObjectPtr.h:79
SmartDataLocator::operator=
SmartDataPtr< OTHER > & operator=(const OTHER *pObj)
Automatic conversion to data type.
Definition: SmartDataLocator.h:136
SmartDataLocator::operator=
SmartDataPtr< OTHER > & operator=(OTHER *pObj)
Automatic conversion to data type.
Definition: SmartDataLocator.h:128
DataObject
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:29
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >::m_pObject
TYPE * m_pObject
Pointer to data store object.
Definition: SmartDataStorePtr.h:129