| The Gaudi Framework v29r0 (ff2e7097)

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

- File List
- File Members

SmartDataPtr.h
Go to the documentation of this file.
1 // ====================================================================
2 // SmartDataPtr.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_SMARTDATAPTR_H
13 #define GAUDIKERNEL_SMARTDATAPTR_H 1
14
15 // Framework include files
16 #include "GaudiKernel/DataObject.h"
17 #include "GaudiKernel/SmartDataStorePtr.h"
18
46 template <class TYPE>
47 class SmartDataPtr : public SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>
48 {
49 public:
51 #if !defined( __ICC ) && !defined( __COVERITY__ )
52 // icc and Coverity do not like this line, they fail with
53 // SmartDataPtr.h(147): internal error: assertion failed: add_symbol_to_overload_list:
54 // symbol not in symbol header list (shared/edgcpfe/symbol_tbl.c, line 4804)
55 using SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>::operator=;
56 #endif
57
65 SmartDataPtr( IDataProviderSvc* pService, const std::string& fullPath )
66 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, fullPath )
67 {
68 }
69
78 SmartDataPtr( IDataProviderSvc* pService, IRegistry* pDirectory )
79 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, pDirectory, "" )
80 {
81 }
82
94 SmartDataPtr( IDataProviderSvc* pService, DataObject* pObject, const std::string& path )
95 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, path )
96 {
97 if ( pObject ) this->m_pRegistry = pObject->registry();
98 }
99
109 SmartDataPtr( SmartDataObjectPtr& refObject, IRegistry* pDirectory )
110 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), pDirectory, "" )
111 {
112 }
113
123 SmartDataPtr( SmartDataObjectPtr& refObject, const std::string& path )
124 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(), path )
125 {
126 }
127
131 SmartDataPtr( const SmartDataObjectPtr& copy ) : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( copy ) {}
132
135 virtual ~SmartDataPtr() = default;
136
138 template <class OTHER>
139 SmartDataPtr& operator=( OTHER* pObj )
140 {
141 this->m_pObject = dynamic_cast<TYPE*>( pObj );
142 return *this;
143 }
144
146 template <class OTHER>
147 SmartDataPtr& operator=( const OTHER* pObj )
148 {
149 this->m_pObject = dynamic_cast<TYPE*>( const_cast<OTHER*>( pObj ) );
150 return *this;
151 }
152 };
153
154 #endif // GAUDIKERNEL_SMARTDATAPTR_H
SmartDataPtr::SmartDataPtr
SmartDataPtr(SmartDataObjectPtr &refObject, const std::string &path)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
Definition: SmartDataPtr.h:123
SmartDataPtr::operator=
SmartDataPtr & operator=(const OTHER *pObj)
Automatic conversion to data type.
Definition: SmartDataPtr.h:147
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.
SmartDataPtr::~SmartDataPtr
virtual ~SmartDataPtr()=default
Standard destructor.
SmartDataObjectPtr::ObjectLoader
Helper class to configure smart pointer functionality.
Definition: SmartDataObjectPtr.h:37
SmartDataStorePtr.h
SmartDataObjectPtr::path
const std::string & path() const
Path name.
Definition: SmartDataObjectPtr.h:76
SmartDataPtr::SmartDataPtr
SmartDataPtr(const SmartDataObjectPtr &copy)
Copy constructor: Construct an copy of a SmartDataPtr instance.
Definition: SmartDataPtr.h:131
SmartDataPtr::SmartDataPtr
SmartDataPtr(IDataProviderSvc *pService, const std::string &fullPath)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
Definition: SmartDataPtr.h:65
IRegistry
The IRegistry represents the entry door to the environment any data object residing in a transient da...
Definition: IRegistry.h:22
SmartDataPtr::SmartDataPtr
SmartDataPtr(IDataProviderSvc *pService, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
Definition: SmartDataPtr.h:78
SmartDataPtr::operator=
SmartDataPtr & operator=(OTHER *pObj)
Automatic conversion to data type.
Definition: SmartDataPtr.h:139
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::SmartDataPtr
SmartDataPtr(SmartDataObjectPtr &refObject, IRegistry *pDirectory)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
Definition: SmartDataPtr.h:109
SmartDataPtr
A small class used to access easily (and efficiently) data items residing in data stores...
Definition: SmartDataPtr.h:47
SmartDataObjectPtr::directory
IRegistry * directory()
Access to data directory.
Definition: SmartDataObjectPtr.h:79
SmartDataPtr::SmartDataPtr
SmartDataPtr(IDataProviderSvc *pService, DataObject *pObject, const std::string &path)
Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject ins...
Definition: SmartDataPtr.h:94
SmartDataObjectPtr::m_pRegistry
IRegistry * m_pRegistry
Pointer to the data registry containing the object.
Definition: SmartDataObjectPtr.h:167
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
DataObject.h