| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

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

- Search for |

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# SmartDataPtr< TYPE > Class Template Reference

`#include <SmartDataPtr.h>`

Inheritance diagram for SmartDataPtr< TYPE >:

[legend]
Collaboration diagram for SmartDataPtr< TYPE >:

[legend]
List of all members.

## 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 46 of file SmartDataPtr.h.

## 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.
| 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.
| 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.
| 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.
| 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.
| SmartDataPtr (const SmartDataObjectPtr &copy)
| Copy constructor: Construct an copy of a SmartDataPtr instance.
virtual | ~SmartDataPtr ()
| Standard destructor.
template<class OTHER>
SmartDataPtr & | operator= (OTHER *pObj)
| Automatic conversion to data type.
template<class OTHER>
SmartDataPtr & | operator= (const OTHER *pObj)
| Automatic conversion to data type.

## 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 60 of file SmartDataPtr.h.

    00061     : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( pService,0,fullPath)
    00062   {
    00063   }

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 73 of file SmartDataPtr.h.

    00074     : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( pService,pDirectory,"")
    00075   {
    00076   }

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 89 of file SmartDataPtr.h.

References SmartDataObjectPtr::m_pRegistry, and DataObject::registry().

    00090     : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( pService,0,path)
    00091   {
    00092     if ( 0 != pObject )   {
    00093       this->m_pRegistry = pObject->registry();
    00094     }
    00095   }

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 106 of file SmartDataPtr.h.

    00107     : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( refObject.service(), pDirectory, "")
    00108   {
    00109   }

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 120 of file SmartDataPtr.h.

    00121     : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( refObject.service(), refObject.directory(), path)
    00122   {
    00123   }

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 128 of file SmartDataPtr.h.

    00129     : SmartDataStorePtr<TYPE,SmartDataObjectPtr::ObjectLoader>( copy )
    00130   {
    00131   }

template<class TYPE>

virtual SmartDataPtr< TYPE >::~SmartDataPtr | ( |  | ) | `[inline, virtual]`

Standard destructor.

Definition at line 135 of file SmartDataPtr.h.

    00135                             {
    00136   }

## Member Function Documentation

template<class TYPE>
template<class OTHER>

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

Automatic conversion to data type.

Definition at line 140 of file SmartDataPtr.h.

References SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >::m_pObject.

    00140                                             {
    00141     this->m_pObject = dynamic_cast<TYPE*>(pObj);
    00142     return *this;
    00143   }

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.

References SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >::m_pObject.

    00147                                                   {
    00148     this->m_pObject = dynamic_cast<TYPE*>(const_cast<OTHER*>(pObj));
    00149     return *this;
    00150   }

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v20r2/GaudiKernel/v25r2/GaudiKernel/SmartDataPtr.h