| The Gaudi Framework v29r1 (5cd95fa2)

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

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
SmartDataPtr< TYPE > Class Template Reference

A small class used to access easily (and efficiently) data items residing in data stores. More...

`#include <GaudiKernel/SmartDataPtr.h>`

Inheritance diagram for SmartDataPtr< TYPE >:
[legend]
Collaboration diagram for SmartDataPtr< TYPE >:
[legend]

## Public Member Functions
| SmartDataPtr (IDataProviderSvc *pService, const std::string &fullPath)
| Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its parent object and the path relative to the parent. More...
| SmartDataPtr (IDataProviderSvc *pService, IRegistry *pDirectory)
| Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its directory entry. More...
| SmartDataPtr (IDataProviderSvc *pService, DataObject *pObject, const std::string &path)
| Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its parent object and the path relative to the parent. More...
| SmartDataPtr (SmartDataObjectPtr &refObject, IRegistry *pDirectory)
| Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its parent object and the path relative to the parent. More...
| SmartDataPtr (SmartDataObjectPtr &refObject, const std::string &path)
| Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its parent object and the path relative to the parent. More...
| SmartDataPtr (const SmartDataObjectPtr &copy)
| Copy constructor: Construct an copy of a SmartDataPtr instance. More...
virtual | ~SmartDataPtr ()=default
| Standard destructor. More...
template<class OTHER >
SmartDataPtr & | operator= (OTHER *pObj)
| Automatic conversion to data type. More...
template<class OTHER >
SmartDataPtr & | operator= (const OTHER *pObj)
| Automatic conversion to data type. More...
Public Member Functions inherited from SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >
| SmartDataStorePtr (IDataProviderSvc *pService, IRegistry *pRegistry, const std::string &path)
| Standard constructor: Construct an SmartDataStorePtr instance which is able to connect to a DataObject instance which is identified by its directory entry. More...
| SmartDataStorePtr (const SmartDataObjectPtr &copy)
| Copy constructor: Construct an copy of a SmartDataStorePtr instance. More...
virtual | ~SmartDataStorePtr ()
| Standard Destructor. More...
SmartDataStorePtr & | operator= (DataObject *pObj)
| Automatic conversion to data type. More...
SmartDataStorePtr & | operator= (const DataObject *pObj)
| Automatic conversion to data type. More...
SmartDataStorePtr & | operator= (const SmartDataObjectPtr &copy) override
| unhides assignment operator of base class More...
TYPE * | ptr ()
| Automatic conversion to data type. More...
TYPE * | operator-> ()
| Dereference operator: the heart of the smart pointer. More...
TYPE & | operator* ()
| Dereference operator: the heart of the smart pointer. More...
| operator TYPE * ()
| Automatic conversion to data type. More...
| operator TYPE & ()
| Automatic conversion to data type. More...
| operator int ()
| operator int for statements like: if ( SmartDataStorePtr<XXX>(...) ) {} More...
bool | operator! ()
| operator ! for statements like: if ( !SmartDataStorePtr<XXX>(...) ) {} More...
TYPE * | accessTypeSafeData ()
| Internal type safe accessor to data. More...
Public Member Functions inherited from SmartDataObjectPtr
| SmartDataObjectPtr (AccessFunction access, IDataProviderSvc *pService, IRegistry *pDir, std::string path)
| Standard constructor: Construct an SmartDataObjectPtr instance. More...
| SmartDataObjectPtr (const SmartDataObjectPtr &)=default
| Copy constructor: Construct an copy of a SmartDataStorePtr instance. More...
virtual | ~SmartDataObjectPtr ()=default
| Standard Destructor. More...
| operator IRegistry * ()
| Automatic conversion to data directory. More...
const std::string & | path () const
| Path name. More...
IRegistry * | directory ()
| Access to data directory. More...
void | setService (IDataProviderSvc *svc)
| Assign data service. More...
IDataProviderSvc * | service ()
| Retrieve data service. More...
const StatusCode & | getLastError () const
| Access to potential errors during data accesses. More...
DataObject * | accessData ()
| Static Object retrieval method: must call specific function. More...
DataObject * | retrieveObject ()
| Object retrieve method. More...
DataObject * | findObject ()
| Object find method. More...
DataObject * | updateObject ()
| Object update method. More...

## Additional Inherited Members
Public Types inherited from SmartDataObjectPtr
using | AccessFunction = DataObject *(*)(SmartDataObjectPtr *ptr)
Static Public Member Functions inherited from SmartDataObjectPtr
static DataObject * | retrieve (SmartDataObjectPtr *ptr)
| Static Object retrieval method. More...
static DataObject * | find (SmartDataObjectPtr *ptr)
| Static Object find method. More...
static DataObject * | update (SmartDataObjectPtr *ptr)
| Static Object update method. More...
Protected Member Functions inherited from SmartDataObjectPtr
StatusCode | find (IRegistry *pDirectory, const std::string &path, DataObject *&refpObject)
| Find the specified object from the data store. More...
StatusCode | find (const std::string &fullPath, DataObject *&refpObject)
| Find the specified object from the data store. More...
StatusCode | retrieve (IRegistry *pDirectory, const std::string &path, DataObject *&refpObject)
| Retrieve the specified object from the data store. More...
StatusCode | retrieve (const std::string &fullPath, DataObject *&refpObject)
| Retrieve the specified object from the data store. More...
StatusCode | update (IRegistry *pDirectory)
| Update the specified object from the data store. More...
StatusCode | update (const std::string &fullPath)
| Update the specified object from the data store. More...
Protected Attributes inherited from SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >
TYPE * | m_pObject
| Pointer to data store object. More...
Protected Attributes inherited from SmartDataObjectPtr
IDataProviderSvc * | m_dataProvider = nullptr
| Pointer to contained object. More...
IRegistry * | m_pRegistry = nullptr
| Pointer to the data registry containing the object. More...
StatusCode | m_status = {StatusCode::SUCCESS, true}
| Keep track of the last error. More...
std::string | m_path
| Path to object. More...
AccessFunction | m_accessFunc
| Data access function. More...

## Detailed Description

### template<class TYPE>
class SmartDataPtr< TYPE >

A small class used to access easily (and efficiently) data items residing in data stores.

The class constructors take several arguments neccessary to be passed tyo the data services in order to automatically load objects in case they are not yet loaded. This is achieved through a smart pointer mechanism i.e. by overloading the operator->() at dereferencing time the the object will be requested from the store.

The SmartDataPtr is meant to be "short living". It only makes sense to keep an object instance within e.g. the scope of one method. "long living" instances do not make sense and in the contrary would be harmful, because the information passed during construction to would be invalid and returned object pointers would actually point to hyperspace.

The intrinsic functionality, wether the object will be retrieved or loaded from the data store is defined by the LOADER::.

Base Class: SmartDataStorePtr

Author
  M.Frank

Version
  1.0

Definition at line 47 of file SmartDataPtr.h.

## Constructor & Destructor Documentation

template<class TYPE>

SmartDataPtr< TYPE >::SmartDataPtr | ( | IDataProviderSvc * | pService,
|  | const std::string & | fullPath
| ) |  |
| inline

Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its parent object and the path relative to the parent.

Parameters

  pService | Pointer to the data service interface which should be used to load the object.
  fullPath | Full path leading to the data object.

Definition at line 65 of file SmartDataPtr.h.

66 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, fullPath )
67 {
68 }
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >
template<class TYPE>

SmartDataPtr< TYPE >::SmartDataPtr | ( | IDataProviderSvc * | pService,
|  | IRegistry * | pDirectory
| ) |  |
| inline

Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its directory entry.

FASTEST ACCESS TO THE DATA STORE ***

Parameters

  pService | Pointer to the data service interface which should be used to load the object.
  pDirectory | Pointer to the data directory entry.

Definition at line 78 of file SmartDataPtr.h.

79 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, pDirectory, "" )
80 {
81 }
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >
template<class TYPE>

SmartDataPtr< TYPE >::SmartDataPtr | ( | IDataProviderSvc * | pService,
|  | DataObject * | pObject,
|  | const std::string & | path
| ) |  |
| inline

Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its parent object and the path relative to the parent.

The path is meant to address only ONE level, multiple path layers are invalid.

Parameters

  pService | Pointer to the data service interface which should be used to load the object.
  pObject | Pointer to the parent object.
  path | Path to the data object relative to the parent object.

Definition at line 94 of file SmartDataPtr.h.

95 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( pService, nullptr, path )
96 {
97 if ( pObject ) this->m_pRegistry = pObject->registry();
98 }
DataObject::registry
IRegistry * registry() const
Get pointer to Registry.
Definition: DataObject.h:72
SmartDataObjectPtr::path
const std::string & path() const
Path name.
Definition: SmartDataObjectPtr.h:76
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >
SmartDataObjectPtr::m_pRegistry
IRegistry * m_pRegistry
Pointer to the data registry containing the object.
Definition: SmartDataObjectPtr.h:167
template<class TYPE>

SmartDataPtr< TYPE >::SmartDataPtr | ( | SmartDataObjectPtr & | refObject,
|  | IRegistry * | pDirectory
| ) |  |
| inline

Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its parent object and the path relative to the parent.

The path is meant to address only ONE level, multiple path layers are invalid.

Parameters

  refObject | Smart Pointer to the parent object.
  pDirectory | Pointer to the data directory entry.

Definition at line 109 of file SmartDataPtr.h.

110 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), pDirectory, "" )
111 {
112 }
SmartDataObjectPtr::service
IDataProviderSvc * service()
Retrieve data service.
Definition: SmartDataObjectPtr.h:85
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >
template<class TYPE>

SmartDataPtr< TYPE >::SmartDataPtr | ( | SmartDataObjectPtr & | refObject,
|  | const std::string & | path
| ) |  |
| inline

Standard constructor: Construct an SmartDataPtr instance which is able to connect to a DataObject instance which is identified by its parent object and the path relative to the parent.

The path is meant to address only ONE level, multiple path layers are invalid.

Parameters

  refObject | Smart Pointer to the parent object.
  path | Path to the data object relative to the parent object.

Definition at line 123 of file SmartDataPtr.h.

124 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(), path )
125 {
126 }
SmartDataObjectPtr::service
IDataProviderSvc * service()
Retrieve data service.
Definition: SmartDataObjectPtr.h:85
SmartDataObjectPtr::path
const std::string & path() const
Path name.
Definition: SmartDataObjectPtr.h:76
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >
SmartDataObjectPtr::directory
IRegistry * directory()
Access to data directory.
Definition: SmartDataObjectPtr.h:79
template<class TYPE>

SmartDataPtr< TYPE >::SmartDataPtr | ( | const SmartDataObjectPtr & | copy | ) |
| inline

Copy constructor: Construct an copy of a SmartDataPtr instance.

Parameters

  copy | Copy Smart Pointer to object.

Definition at line 131 of file SmartDataPtr.h.

131 : SmartDataStorePtr<TYPE, SmartDataObjectPtr::ObjectLoader>( copy ) {}
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >
template<class TYPE>

virtual SmartDataPtr< TYPE >::~SmartDataPtr | ( |  | ) |
| virtual default

Standard destructor.

## Member Function Documentation

template<class TYPE>
template<class OTHER >

SmartDataPtr& SmartDataPtr< TYPE >::operator= | ( | OTHER * | pObj | ) |
| inline

Automatic conversion to data type.

Definition at line 139 of file SmartDataPtr.h.

140 {
141 this->m_pObject = dynamic_cast<TYPE*>( pObj );
142 return *this;
143 }
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >::m_pObject
TYPE * m_pObject
Pointer to data store object.
Definition: SmartDataStorePtr.h:129
template<class TYPE>
template<class OTHER >

SmartDataPtr& SmartDataPtr< TYPE >::operator= | ( | const OTHER * | pObj | ) |
| inline

Automatic conversion to data type.

Definition at line 147 of file SmartDataPtr.h.

148 {
149 this->m_pObject = dynamic_cast<TYPE*>( const_cast<OTHER*>( pObj ) );
150 return *this;
151 }
SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >::m_pObject
TYPE * m_pObject
Pointer to data store object.
Definition: SmartDataStorePtr.h:129

The documentation for this class was generated from the following file:

- GaudiKernel/GaudiKernel/SmartDataPtr.h