Gaudi Framework, version v25r2

Home   Generated: Wed Jun 4 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
17 #include "GaudiKernel/DataObject.h"
18 
46 template<class TYPE> class SmartDataPtr : public SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader> {
47 public:
48 
50 #if !defined(__ICC) && !defined(__COVERITY__)
51  // icc and Coverity do not like this line, they fail with
52  // SmartDataPtr.h(147): internal error: assertion failed: add_symbol_to_overload_list:
53  // symbol not in symbol header list (shared/edgcpfe/symbol_tbl.c, line 4804)
55 #endif
56 
64  SmartDataPtr(IDataProviderSvc* pService, const std::string& fullPath)
65  : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( pService,0,fullPath)
66  {
67  }
68 
77  SmartDataPtr(IDataProviderSvc* pService, IRegistry* pDirectory)
78  : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( pService,pDirectory,"")
79  {
80  }
81 
93  SmartDataPtr(IDataProviderSvc* pService, DataObject* pObject, const std::string& path)
94  : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( pService,0,path)
95  {
96  if ( 0 != pObject ) {
97  this->m_pRegistry = pObject->registry();
98  }
99  }
100 
110  SmartDataPtr(SmartDataObjectPtr& refObject, IRegistry* pDirectory)
111  : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( refObject.service(), pDirectory, "")
112  {
113  }
114 
124  SmartDataPtr(SmartDataObjectPtr& refObject, const std::string& path)
125  : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(), path)
126  {
127  }
128 
134  {
135  }
136 
139  virtual ~SmartDataPtr() {
140  }
141 
143  template <class OTHER>
144  SmartDataPtr& operator=( OTHER* pObj ) {
145  this->m_pObject = dynamic_cast<TYPE*>(pObj);
146  return *this;
147  }
148 
150  template <class OTHER>
151  SmartDataPtr& operator=( const OTHER* pObj ) {
152  this->m_pObject = dynamic_cast<TYPE*>(const_cast<OTHER*>(pObj));
153  return *this;
154  }
155 };
156 
157 #endif // GAUDIKERNEL_SMARTDATAPTR_H

Generated at Wed Jun 4 2014 14:48:57 for Gaudi Framework, version v25r2 by Doxygen version 1.8.2 written by Dimitri van Heesch, © 1997-2004