Loading [MathJax]/extensions/tex2jax.js
The Gaudi Framework  v31r0 (aeb156f0)
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
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
17 
45 template <class TYPE>
46 class SmartDataLocator : public SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader> {
47 public:
56  SmartDataLocator( IDataProviderSvc* pService, const std::string& fullPath )
57  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, 0, fullPath ) {}
58 
67  SmartDataLocator( IDataProviderSvc* pService, IRegistry* pDirectory )
68  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, pDirectory, "" ) {}
69 
82  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, 0, path ) {
83  if ( 0 != pObject ) { this->m_pDirectory = pObject->registry(); }
84  }
85 
95  SmartDataLocator( SmartDataObjectPtr& refObject, IRegistry* pDirectory )
96  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), pDirectory, "" ) {}
97 
108  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(), path ) {}
109 
112  virtual ~SmartDataLocator() {}
113 
115  template <class OTHER>
116  SmartDataPtr<OTHER>& operator=( OTHER* pObj ) {
117  this->m_pObject = dynamic_cast<TYPE*>( pObj );
118  return *this;
119  }
120 
122  template <class OTHER>
123  SmartDataPtr<OTHER>& operator=( const OTHER* pObj ) {
124  this->m_pObject = dynamic_cast<TYPE*>( const_cast<OTHER*>( pObj ) );
125  return *this;
126  }
127 };
128 
129 #endif // GAUDIKERNEL_SMARTDATALOCATOR_H
SmartDataLocator(IDataProviderSvc *pService, DataObject *pObject, const std::string &path)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
SmartDataLocator(IDataProviderSvc *pService, const std::string &fullPath)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
A small class used to access easily (and efficiently) data items residing in data stores...
Data provider interface definition.
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
IDataProviderSvc * service()
Retrieve data service.
STL class.
Helper class to configure smart pointer functionality.
SmartDataLocator(SmartDataObjectPtr &refObject, const std::string &path)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
SmartDataLocator(IDataProviderSvc *pService, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
const std::string & path() const
Path name.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
SmartDataLocator(SmartDataObjectPtr &refObject, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
A small class used to access easily (and efficiently) data items residing in data stores...
A small class used to access easily (and efficiently) data items residing in data stores...
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:47
virtual ~SmartDataLocator()
Standard destructor.
IRegistry * directory()
Access to data directory.
SmartDataPtr< OTHER > & operator=(const OTHER *pObj)
Automatic conversion to data type.
SmartDataPtr< OTHER > & operator=(OTHER *pObj)
Automatic conversion to data type.
A DataObject is the base class of any identifiable object on any data store.
Definition: DataObject.h:30