Gaudi Framework, version v25r2

Home   Generated: Wed Jun 4 2014
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
SmartDataObjectPtr Class Reference

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

#include <GaudiKernel/SmartDataObjectPtr.h>

Inheritance diagram for SmartDataObjectPtr:
Inheritance graph
[legend]
Collaboration diagram for SmartDataObjectPtr:
Collaboration graph
[legend]

Classes

class  ObjectFinder
 Helper class to configure smart pointer functionality. More...
 
class  ObjectLoader
 Helper class to configure smart pointer functionality. More...
 

Public Types

typedef DataObject *(* AccessFunction )(SmartDataObjectPtr *ptr)
 

Public Member Functions

 SmartDataObjectPtr (AccessFunction access, IDataProviderSvc *pService, IRegistry *pDir, const std::string &path)
 Standard constructor: Construct an SmartDataObjectPtr instance.
 
 SmartDataObjectPtr (const SmartDataObjectPtr &copy)
 Copy constructor: Construct an copy of a SmartDataStorePtr instance.
 
virtual ~SmartDataObjectPtr ()
 Standard Destructor.
 
virtual SmartDataObjectPtroperator= (const SmartDataObjectPtr &copy)
 Assignment operator.
 
 operator IRegistry * ()
 Automatic conversion to data directory.
 
const std::string & path () const
 Path name.
 
IRegistrydirectory ()
 Access to data directory.
 
void setService (IDataProviderSvc *svc)
 Assign data service.
 
IDataProviderSvcservice ()
 Retrieve data service.
 
StatusCode getLastError () const
 Access to potential errors during data accesses.
 
DataObjectaccessData ()
 Static Object retrieval method: must call specific function.
 
DataObjectretrieveObject ()
 Object retrieve method.
 
DataObjectfindObject ()
 Object find method.
 
DataObjectupdateObject ()
 Object update method.
 

Static Public Member Functions

static DataObjectretrieve (SmartDataObjectPtr *ptr)
 Static Object retrieval method.
 
static DataObjectfind (SmartDataObjectPtr *ptr)
 Static Object find method.
 
static DataObjectupdate (SmartDataObjectPtr *ptr)
 Static Object update method.
 

Protected Member Functions

StatusCode find (IRegistry *pDirectory, const std::string &path, DataObject *&refpObject)
 Find the specified object from the data store.
 
StatusCode find (const std::string &fullPath, DataObject *&refpObject)
 Find the specified object from the data store.
 
StatusCode retrieve (IRegistry *pDirectory, const std::string &path, DataObject *&refpObject)
 Retrieve the specified object from the data store.
 
StatusCode retrieve (const std::string &fullPath, DataObject *&refpObject)
 Retrieve the specified object from the data store.
 
StatusCode update (IRegistry *pDirectory)
 Update the specified object from the data store.
 
StatusCode update (const std::string &fullPath)
 Update the specified object from the data store.
 

Protected Attributes

IDataProviderSvcm_dataProvider
 Pointer to contained object.
 
IRegistrym_pRegistry
 Pointer to the data registry containing the object.
 
StatusCode m_status
 Keep track of the last error.
 
std::string m_path
 Path to object.
 
AccessFunction m_accessFunc
 Data access function.
 

Detailed Description

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

The class is meant as configurable base class for real Smart pointer instances. Here mainly the access of the data store is handled. It is important to keep as less functions as possible NON-VIRTUAL in particular those, which handle the data access - they might be called very often and hence the compiler must be able to inline them.

Author
M.Frank
Version
1.0

Definition at line 33 of file SmartDataObjectPtr.h.

Member Typedef Documentation

typedef DataObject*(* SmartDataObjectPtr::AccessFunction)(SmartDataObjectPtr *ptr)

Definition at line 35 of file SmartDataObjectPtr.h.

Constructor & Destructor Documentation

SmartDataObjectPtr::SmartDataObjectPtr ( AccessFunction  access,
IDataProviderSvc pService,
IRegistry pDir,
const std::string &  path 
)
inline

Standard constructor: Construct an SmartDataObjectPtr instance.

Parameters
svcPointer to the data service interface used to interact with the store.
pDirPointer to data directory
pathpath to object relative to data directory

Definition at line 55 of file SmartDataObjectPtr.h.

SmartDataObjectPtr::SmartDataObjectPtr ( const SmartDataObjectPtr copy)
inline

Copy constructor: Construct an copy of a SmartDataStorePtr instance.

Parameters
copyCopy of Smart Pointer to object.

Definition at line 66 of file SmartDataObjectPtr.h.

virtual SmartDataObjectPtr::~SmartDataObjectPtr ( )
inlinevirtual

Standard Destructor.

Definition at line 75 of file SmartDataObjectPtr.h.

{
}

Member Function Documentation

DataObject* SmartDataObjectPtr::accessData ( )
inline

Static Object retrieval method: must call specific function.

Definition at line 111 of file SmartDataObjectPtr.h.

{
return m_accessFunc(this);
}
IRegistry* SmartDataObjectPtr::directory ( )
inline

Access to data directory.

Definition at line 91 of file SmartDataObjectPtr.h.

{
return m_pRegistry;
}
static DataObject* SmartDataObjectPtr::find ( SmartDataObjectPtr ptr)
inlinestatic

Static Object find method.

Definition at line 121 of file SmartDataObjectPtr.h.

{
return ptr->findObject();
}
StatusCode SmartDataObjectPtr::find ( IRegistry pDirectory,
const std::string &  path,
DataObject *&  refpObject 
)
protected

Find the specified object from the data store.

Retrieve the object from the data store.

Parameters
pDirectoryPointer to the directory entry holding the object.
refpObjectReference to the pointer finally holding the object
Returns
StatusCode indicating success or failure.

Definition at line 53 of file SmartDataObjectPtr.cpp.

{
if ( 0 != m_dataProvider && 0 != pDirectory ) {
status = m_dataProvider->findObject(pDirectory, path, refpObject);
}
return status;
}
StatusCode SmartDataObjectPtr::find ( const std::string &  fullPath,
DataObject *&  refpObject 
)
protected

Find the specified object from the data store.

Retrieve the object from the data store.

Parameters
fullPathString containing the full path necessary to locate the object.
refpObjectReference to the pointer finally holding the object
Returns
StatusCode indicating success or failure.

Definition at line 62 of file SmartDataObjectPtr.cpp.

{
if ( 0 != m_dataProvider ) {
status = m_dataProvider->findObject(fullPath, refpObject);
}
return status;
}
DataObject * SmartDataObjectPtr::findObject ( )

Object find method.

If the object is not known to the local object, it is requested from the data service either using the full path if there is no directory information present.

Definition at line 109 of file SmartDataObjectPtr.cpp.

{
DataObject* pObj = 0;
if ( m_status.isSuccess() ) {
m_pRegistry = pObj->registry();
m_path = "";
}
return pObj;
}
StatusCode SmartDataObjectPtr::getLastError ( ) const
inline

Access to potential errors during data accesses.

Definition at line 106 of file SmartDataObjectPtr.h.

{
return m_status;
}
SmartDataObjectPtr::operator IRegistry * ( )
inline

Automatic conversion to data directory.

Definition at line 81 of file SmartDataObjectPtr.h.

{
return m_pRegistry;
}
SmartDataObjectPtr & SmartDataObjectPtr::operator= ( const SmartDataObjectPtr copy)
virtual

Assignment operator.

Reimplemented in SmartDataStorePtr< TYPE, LOADER >, and SmartDataStorePtr< TYPE, SmartDataObjectPtr::ObjectLoader >.

Definition at line 27 of file SmartDataObjectPtr.cpp.

{
m_path = copy.m_path;
return *this;
}
const std::string& SmartDataObjectPtr::path ( ) const
inline

Path name.

Definition at line 86 of file SmartDataObjectPtr.h.

{
return m_path;
}
static DataObject* SmartDataObjectPtr::retrieve ( SmartDataObjectPtr ptr)
inlinestatic

Static Object retrieval method.

Definition at line 116 of file SmartDataObjectPtr.h.

{
return ptr->retrieveObject();
}
StatusCode SmartDataObjectPtr::retrieve ( IRegistry pDirectory,
const std::string &  path,
DataObject *&  refpObject 
)
protected

Retrieve the specified object from the data store.

Retrieve the object from the data store.

Parameters
pDirectoryPointer to the directory entry holding the object.
refpObjectReference to the pointer finally holding the object
Returns
StatusCode indicating success or failure.

Definition at line 35 of file SmartDataObjectPtr.cpp.

{
if ( 0 != m_dataProvider && 0 != pRegistry ) {
status = m_dataProvider->retrieveObject(pRegistry, path, refpObject);
}
return status;
}
StatusCode SmartDataObjectPtr::retrieve ( const std::string &  fullPath,
DataObject *&  refpObject 
)
protected

Retrieve the specified object from the data store.

Retrieve the object from the data store.

Parameters
fullPathString containing the full path necessary to locate the object.
refpObjectReference to the pointer finally holding the object
Returns
StatusCode indicating success or failure.

Definition at line 44 of file SmartDataObjectPtr.cpp.

{
if ( 0 != m_dataProvider ) {
status = m_dataProvider->retrieveObject(fullPath, refpObject);
}
return status;
}
DataObject * SmartDataObjectPtr::retrieveObject ( )

Object retrieve method.

Object retrieval method.

If the object is not known to the local object, it is requested from the data service either using the full path if there is no directory information present.

Definition at line 94 of file SmartDataObjectPtr.cpp.

{
DataObject* pObj = 0;
if ( m_status.isSuccess() ) {
m_pRegistry = pObj->registry();
m_path = "";
}
return pObj;
}
IDataProviderSvc* SmartDataObjectPtr::service ( )
inline

Retrieve data service.

Definition at line 101 of file SmartDataObjectPtr.h.

{
}
void SmartDataObjectPtr::setService ( IDataProviderSvc svc)
inline

Assign data service.

Definition at line 96 of file SmartDataObjectPtr.h.

{
}
static DataObject* SmartDataObjectPtr::update ( SmartDataObjectPtr ptr)
inlinestatic

Static Object update method.

Definition at line 126 of file SmartDataObjectPtr.h.

{
return ptr->updateObject();
}
StatusCode SmartDataObjectPtr::update ( IRegistry pDirectory)
protected

Update the specified object from the data store.

update the object from the data store.

Parameters
pDirectoryPointer to the directory entry holding the object.
Returns
StatusCode indicating success or failure.

Definition at line 72 of file SmartDataObjectPtr.cpp.

{
if ( 0 != m_dataProvider && 0 != pRegistry ) {
status = m_dataProvider->updateObject(pRegistry);
}
return status;
}
StatusCode SmartDataObjectPtr::update ( const std::string &  fullPath)
protected

Update the specified object from the data store.

update the object from the data store.

Parameters
fullPathString containing the full path necessary to locate the object.
Returns
StatusCode indicating success or failure.

Definition at line 81 of file SmartDataObjectPtr.cpp.

{
if ( 0 != m_dataProvider ) {
status = m_dataProvider->updateObject(fullPath);
}
return status;
}
DataObject * SmartDataObjectPtr::updateObject ( )

Object update method.

If the object is not known to the local object, it is requested from the data service either using the full path if there is no directory information present. Needs to be virtual to to implicit object access.

If the object is not known to the local object, it is requested from the data service either using the full path if there is no directory information present.

Definition at line 124 of file SmartDataObjectPtr.cpp.

{
DataObject* pObj = accessData(); // Have to load AND update if not present.
if ( m_status.isSuccess() ) {
if ( !m_status.isSuccess() ) pObj = 0;
}
return pObj;
}

Member Data Documentation

AccessFunction SmartDataObjectPtr::m_accessFunc
protected

Data access function.

Definition at line 202 of file SmartDataObjectPtr.h.

IDataProviderSvc* SmartDataObjectPtr::m_dataProvider
mutableprotected

Pointer to contained object.

Definition at line 194 of file SmartDataObjectPtr.h.

std::string SmartDataObjectPtr::m_path
protected

Path to object.

Definition at line 200 of file SmartDataObjectPtr.h.

IRegistry* SmartDataObjectPtr::m_pRegistry
mutableprotected

Pointer to the data registry containing the object.

Definition at line 196 of file SmartDataObjectPtr.h.

StatusCode SmartDataObjectPtr::m_status
mutableprotected

Keep track of the last error.

Definition at line 198 of file SmartDataObjectPtr.h.


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

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