| # Gaudi Framework, version v23r0 |

Home |  | Generated: Mon Jan 30 2012

Public Member Functions | Protected Attributes

# SmartDataStorePtr< TYPE, LOADER > Class Template Reference

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

`#include <SmartDataStorePtr.h>`

Inheritance diagram for SmartDataStorePtr< TYPE, LOADER >:
[legend]
Collaboration diagram for SmartDataStorePtr< TYPE, LOADER >:
[legend]

List of all members.

## Public Member Functions
| 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.
| SmartDataStorePtr (const SmartDataObjectPtr &copy)
| Copy constructor: Construct an copy of a SmartDataStorePtr instance.
virtual | ~SmartDataStorePtr ()
| Standard Destructor.
SmartDataStorePtr & | operator= (DataObject *pObj)
| Automatic conversion to data type.
SmartDataStorePtr & | operator= (const DataObject *pObj)
| Automatic conversion to data type.
SmartDataStorePtr & | operator= (const SmartDataObjectPtr &copy)
| unhides assignment operator of base class
TYPE * | ptr ()
| Automatic conversion to data type.
TYPE * | operator-> ()
| Dereference operator: the heart of the smart pointer.
TYPE & | operator* ()
| Dereference operator: the heart of the smart pointer.
| operator TYPE * ()
| Automatic conversion to data type.
| operator TYPE & ()
| Automatic conversion to data type.
| operator int ()
| operator int for statements like: if ( SmartDataStorePtr<XXX>(...) ) {}
bool | operator! ()
| operator ! for statements like: if ( !SmartDataStorePtr<XXX>(...) ) {}
TYPE * | accessTypeSafeData ()
| Internal type safe accessor to data.
## Protected Attributes
TYPE * | m_pObject
| Pointer to data store object.

## Detailed Description

### template<class TYPE, class LOADER>
class SmartDataStorePtr< TYPE, LOADER >

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 SmartDataStorePtr 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: SmartDataObjectPtr

Author:
  M.Frank

Version:
  1.0

Definition at line 44 of file SmartDataStorePtr.h.

## Constructor & Destructor Documentation

template<class TYPE, class LOADER>

SmartDataStorePtr< TYPE, LOADER >::SmartDataStorePtr | ( | IDataProviderSvc * | pService,
|  | IRegistry * | pRegistry,
|  | const std::string & | path
| ) |  | `[inline]`

Standard constructor: Construct an SmartDataStorePtr 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 54 of file SmartDataStorePtr.h.

        : SmartDataObjectPtr(LOADER::access(),pService,pRegistry,path), m_pObject(0)
      {
      }

template<class TYPE, class LOADER>

SmartDataStorePtr< TYPE, LOADER >::SmartDataStorePtr | ( | const SmartDataObjectPtr & | copy ) | `[inline]`

Copy constructor: Construct an copy of a SmartDataStorePtr instance.

Parameters:

  copy | Copy of Smart Pointer to object.

Definition at line 61 of file SmartDataStorePtr.h.

        : SmartDataObjectPtr( copy ), m_pObject(0)
      {
      }

template<class TYPE, class LOADER>

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

Standard Destructor.

Definition at line 67 of file SmartDataStorePtr.h.

                                    {
      }

## Member Function Documentation

template<class TYPE, class LOADER>

TYPE* SmartDataStorePtr< TYPE, LOADER >::accessTypeSafeData | ( | ) | `[inline]`

Internal type safe accessor to data.

Definition at line 126 of file SmartDataStorePtr.h.

                                     {
        if ( 0 == m_pObject )   {
          m_pObject = dynamic_cast<TYPE*>(accessData());
        }
        return m_pObject;
      }

template<class TYPE, class LOADER>

SmartDataStorePtr< TYPE, LOADER >::operator int | ( | ) | `[inline]`

operator int for statements like: if ( SmartDataStorePtr<XXX>(...) ) {}

Definition at line 116 of file SmartDataStorePtr.h.

                       {
        return 0 != accessTypeSafeData();
      }

template<class TYPE, class LOADER>

SmartDataStorePtr< TYPE, LOADER >::operator TYPE & | ( | ) | `[inline]`

Automatic conversion to data type.

Definition at line 110 of file SmartDataStorePtr.h.

                          {
        TYPE* result = accessTypeSafeData();
        return *result;
      }

template<class TYPE, class LOADER>

SmartDataStorePtr< TYPE, LOADER >::operator TYPE * | ( | ) | `[inline]`

Automatic conversion to data type.

Definition at line 105 of file SmartDataStorePtr.h.

                          {
        return accessTypeSafeData();
      }

template<class TYPE, class LOADER>

bool SmartDataStorePtr< TYPE, LOADER >::operator! | ( | ) | `[inline]`

operator ! for statements like: if ( !SmartDataStorePtr<XXX>(...) ) {}

Definition at line 121 of file SmartDataStorePtr.h.

                          {
        return 0 == accessTypeSafeData();
      }

template<class TYPE, class LOADER>

TYPE& SmartDataStorePtr< TYPE, LOADER >::operator* | ( | ) | `[inline]`

Dereference operator: the heart of the smart pointer.

Definition at line 99 of file SmartDataStorePtr.h.

                           {
        TYPE* result = accessTypeSafeData();
        return *result;
      }

template<class TYPE, class LOADER>

TYPE* SmartDataStorePtr< TYPE, LOADER >::operator-> | ( | ) | `[inline]`

Dereference operator: the heart of the smart pointer.

Definition at line 94 of file SmartDataStorePtr.h.

                            {
        return accessTypeSafeData();
      }

template<class TYPE, class LOADER>

SmartDataStorePtr& SmartDataStorePtr< TYPE, LOADER >::operator= | ( | DataObject * | pObj ) | `[inline]`

Automatic conversion to data type.

Definition at line 71 of file SmartDataStorePtr.h.

                                                          {
        m_pObject = dynamic_cast<TYPE*>(pObj);
        return *this;
      }

template<class TYPE, class LOADER>

SmartDataStorePtr& SmartDataStorePtr< TYPE, LOADER >::operator= | ( | const DataObject * | pObj ) | `[inline]`

Automatic conversion to data type.

Definition at line 77 of file SmartDataStorePtr.h.

                                                                {
        m_pObject = dynamic_cast<TYPE*>(const_cast<DataObject*>(pObj));
        return *this;
      }

template<class TYPE, class LOADER>

SmartDataStorePtr& SmartDataStorePtr< TYPE, LOADER >::operator= | ( | const SmartDataObjectPtr & | copy ) | `[inline, virtual]`

unhides assignment operator of base class

Reimplemented from SmartDataObjectPtr.

Definition at line 83 of file SmartDataStorePtr.h.

                                                                     {
        this->m_pObject = dynamic_cast<TYPE*>(const_cast<SmartDataObjectPtr*>(&copy));
        return *this;
      }

template<class TYPE, class LOADER>

TYPE* SmartDataStorePtr< TYPE, LOADER >::ptr | ( | ) | `[inline]`

Automatic conversion to data type.

Definition at line 89 of file SmartDataStorePtr.h.

                     {
        return accessTypeSafeData();
      }

## Member Data Documentation

template<class TYPE, class LOADER>

TYPE* SmartDataStorePtr< TYPE, LOADER >::m_pObject`[mutable, protected]`

Pointer to data store object.

Definition at line 135 of file SmartDataStorePtr.h.

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v23r0/GaudiKernel/GaudiKernel/SmartDataStorePtr.h

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines