The Gaudi Framework  master (82fdf313)
Loading...
Searching...
No Matches
SmartDataPtr.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
15
42
43template <class TYPE>
44class SmartDataPtr : public SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader> {
45public:
47#if !defined( __ICC ) && !defined( __COVERITY__ )
48 // icc and Coverity do not like this line, they fail with
49 // SmartDataPtr.h(147): internal error: assertion failed: add_symbol_to_overload_list:
50 // symbol not in symbol header list (shared/edgcpfe/symbol_tbl.c, line 4804)
52#endif
61 SmartDataPtr( IDataProviderSvc* pService, std::string fullPath )
62 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, std::move( fullPath ) ) {}
63
72 SmartDataPtr( IDataProviderSvc* pService, IRegistry* pDirectory )
73 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, pDirectory, "" ) {}
74
86 SmartDataPtr( IDataProviderSvc* pService, DataObject* pObject, std::string path )
87 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, std::move( path ) ) {
88 if ( pObject ) this->m_pRegistry = pObject->registry();
89 }
90
100 SmartDataPtr( SmartDataObjectPtr& refObject, IRegistry* pDirectory )
101 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), pDirectory, "" ) {}
102
112 SmartDataPtr( SmartDataObjectPtr& refObject, std::string path )
113 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(),
114 std::move( path ) ) {}
115
120
121 virtual ~SmartDataPtr() = default;
122
124 template <class OTHER>
125 SmartDataPtr& operator=( OTHER* pObj ) {
126 this->m_pObject = dynamic_cast<TYPE*>( pObj );
127 return *this;
128 }
129
131 template <class OTHER>
132 SmartDataPtr& operator=( const OTHER* pObj ) {
133 this->m_pObject = dynamic_cast<TYPE*>( const_cast<OTHER*>( pObj ) );
134 return *this;
135 }
136};
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
Helper class to configure smart pointer functionality.
A small class used to access easily (and efficiently) data items residing in data stores.
const std::string & path() const
Path name.
IDataProviderSvc * service()
Retrieve data service.
IRegistry * directory()
Access to data directory.
IRegistry * m_pRegistry
Pointer to the data registry containing the object.
SmartDataPtr(SmartDataObjectPtr &refObject, std::string path)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
SmartDataPtr(IDataProviderSvc *pService, std::string fullPath)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
SmartDataPtr & operator=(OTHER *pObj)
Automatic conversion to data type.
SmartDataPtr & operator=(const OTHER *pObj)
Automatic conversion to data type.
virtual ~SmartDataPtr()=default
SmartDataPtr(IDataProviderSvc *pService, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
SmartDataPtr(IDataProviderSvc *pService, DataObject *pObject, std::string path)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
SmartDataPtr(const SmartDataObjectPtr &copy)
Copy constructor: Construct an copy of a SmartDataPtr instance.
SmartDataPtr(SmartDataObjectPtr &refObject, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
SmartDataStorePtr(IDataProviderSvc *pService, IRegistry *pRegistry, std::string path)
TYPE * m_pObject
Pointer to data store object.
STL namespace.