The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
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
41
42template <class TYPE>
43class SmartDataLocator : public SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader> {
44public:
53 SmartDataLocator( IDataProviderSvc* pService, const std::string& fullPath )
54 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, 0, fullPath ) {}
55
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
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>
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};
A DataObject is the base class of any identifiable object on any data store.
Definition DataObject.h:37
IRegistry * registry() const
Get pointer to Registry.
Definition DataObject.h:79
Data provider interface definition.
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition IRegistry.h:29
SmartDataLocator(IDataProviderSvc *pService, IRegistry *pDirectory)
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...
SmartDataLocator(IDataProviderSvc *pService, DataObject *pObject, const std::string &path)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
SmartDataLocator(SmartDataObjectPtr &refObject, const std::string &path)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
SmartDataLocator(SmartDataObjectPtr &refObject, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataLocator instance which is able to connect to a DataObject...
virtual ~SmartDataLocator()
Standard destructor.
SmartDataPtr< OTHER > & operator=(OTHER *pObj)
Automatic conversion to data type.
SmartDataPtr< OTHER > & operator=(const OTHER *pObj)
Automatic conversion to data type.
Helper class to configure smart pointer functionality.
const std::string & path() const
Path name.
IDataProviderSvc * service()
Retrieve data service.
SmartDataObjectPtr(AccessFunction access, IDataProviderSvc *pService, IRegistry *pDir, std::string path)
Standard constructor: Construct an SmartDataObjectPtr instance.
IRegistry * directory()
Access to data directory.
A small class used to access easily (and efficiently) data items residing in data stores.
SmartDataStorePtr(IDataProviderSvc *pService, IRegistry *pRegistry, std::string path)