The Gaudi Framework  v40r0 (475e45c1)
SmartDataLocator.h
Go to the documentation of this file.
1 /***********************************************************************************\
2 * (c) Copyright 1998-2025 CERN for the benefit of the LHCb and ATLAS collaborations *
3 * *
4 * This software is distributed under the terms of the Apache version 2 licence, *
5 * copied verbatim in the file "LICENSE". *
6 * *
7 * In applying this licence, CERN does not waive the privileges and immunities *
8 * granted to it by virtue of its status as an Intergovernmental Organization *
9 * or submit itself to any jurisdiction. *
10 \***********************************************************************************/
11 #pragma once
12 
14 
42 template <class TYPE>
43 class SmartDataLocator : public SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader> {
44 public:
53  SmartDataLocator( IDataProviderSvc* pService, const std::string& fullPath )
54  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, 0, fullPath ) {}
55 
64  SmartDataLocator( IDataProviderSvc* pService, IRegistry* pDirectory )
65  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, pDirectory, "" ) {}
66 
78  SmartDataLocator( IDataProviderSvc* pService, DataObject* pObject, const std::string& path )
79  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, 0, path ) {
80  if ( 0 != pObject ) { this->m_pDirectory = pObject->registry(); }
81  }
82 
92  SmartDataLocator( SmartDataObjectPtr& refObject, IRegistry* pDirectory )
93  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), pDirectory, "" ) {}
94 
104  SmartDataLocator( SmartDataObjectPtr& refObject, const std::string& path )
105  : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(), path ) {}
106 
109  virtual ~SmartDataLocator() {}
110 
112  template <class OTHER>
113  SmartDataPtr<OTHER>& operator=( OTHER* pObj ) {
114  this->m_pObject = dynamic_cast<TYPE*>( pObj );
115  return *this;
116  }
117 
119  template <class OTHER>
120  SmartDataPtr<OTHER>& operator=( const OTHER* pObj ) {
121  this->m_pObject = dynamic_cast<TYPE*>( const_cast<OTHER*>( pObj ) );
122  return *this;
123  }
124 };
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:78
IRegistry
Definition: IRegistry.h:29
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:53
SmartDataObjectPtr::directory
IRegistry * directory()
Access to data directory.
Definition: SmartDataObjectPtr.h:79
SmartDataLocator::SmartDataLocator
SmartDataLocator(IDataProviderSvc *pService, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
Definition: SmartDataLocator.h:64
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:104
SmartDataPtr.h
SmartDataObjectPtr
Definition: SmartDataObjectPtr.h:37
SmartDataLocator::SmartDataLocator
SmartDataLocator(SmartDataObjectPtr &refObject, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
Definition: SmartDataLocator.h:92
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >::m_pObject
TYPE * m_pObject
Pointer to data store object.
Definition: SmartDataStorePtr.h:115
SmartDataLocator
A small class used to access easily (and efficiently) data items residing in data stores.
Definition: SmartDataLocator.h:43
SmartDataObjectPtr::ObjectLoader
Helper class to configure smart pointer functionality.
Definition: SmartDataObjectPtr.h:41
SmartDataPtr
A small class used to access easily (and efficiently) data items residing in data stores.
Definition: SmartDataPtr.h:44
SmartDataLocator::operator=
SmartDataPtr< OTHER > & operator=(const OTHER *pObj)
Automatic conversion to data type.
Definition: SmartDataLocator.h:120
SmartDataLocator::operator=
SmartDataPtr< OTHER > & operator=(OTHER *pObj)
Automatic conversion to data type.
Definition: SmartDataLocator.h:113
SmartDataStorePtr
A small class used to access easily (and efficiently) data items residing in data stores.
Definition: SmartDataStorePtr.h:42
DataObject
Definition: DataObject.h:37
IDataProviderSvc
Definition: IDataProviderSvc.h:48
SmartDataObjectPtr::path
const std::string & path() const
Path name.
Definition: SmartDataObjectPtr.h:76
SmartDataLocator::~SmartDataLocator
virtual ~SmartDataLocator()
Standard destructor.
Definition: SmartDataLocator.h:109
SmartDataObjectPtr::service
IDataProviderSvc * service()
Retrieve data service.
Definition: SmartDataObjectPtr.h:85
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:79