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

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

- Search for |

- File List
- File Members

# SmartDataObjectPtr.cpp File Reference

`#include "GaudiKernel/DataObject.h"`
`#include "GaudiKernel/IDataProviderSvc.h"`
`#include "GaudiKernel/SmartDataObjectPtr.h"`

Include dependency graph for SmartDataObjectPtr.cpp:

Go to the source code of this file.

## Defines
#define | GAUDIKERNEL_SMARTDATAOBJECTPTR_CPP 1
## Functions
bool | operator && (SmartDataObjectPtr &object_1, SmartDataObjectPtr &object_2)
| Helper to test Smart data objects efficiently This construct allows statements like: SmartEvtDataPtr<MCVertexVector> mcvertices (evt,"/MC/MCVertices"); SmartEvtDataPtr<MCParticleVector> mctracks (evt,"/MC/MCParticles"); if ( mctracks && mcvertices ) { .
bool | operator|| (SmartDataObjectPtr &object_1, SmartDataObjectPtr &object_2)
| Helper to test Smart data objects efficiently This construct allows statements like: SmartEvtDataPtr<MCVertexVector> mcvertices (evt,"/MC/MCVertices"); SmartEvtDataPtr<MCParticleVector> mctracks (evt,"/MC/MCParticles"); if ( mctracks || mcvertices ) { .

## Define Documentation

#define GAUDIKERNEL_SMARTDATAOBJECTPTR_CPP 1

Definition at line 11 of file SmartDataObjectPtr.cpp.

## Function Documentation

bool operator && | ( | SmartDataObjectPtr & | object_1,
|  | SmartDataObjectPtr & | object_2 |
| ) |  |  |

Helper to test Smart data objects efficiently This construct allows statements like: SmartEvtDataPtr<MCVertexVector> mcvertices (evt,"/MC/MCVertices"); SmartEvtDataPtr<MCParticleVector> mctracks (evt,"/MC/MCParticles"); if ( mctracks && mcvertices ) { .

.. } and tests the existence of BOTH objects in the data store. This is not done inline due to danger of code explosion.

Parameters:

  | object_1 | Smart pointer to object 1
  | object_2 | Smart pointer to second object

Returns:
  Boolean indicating existence of both objects

Definition at line 145 of file SmartDataObjectPtr.cpp.

References SmartDataObjectPtr::accessData().

    00145                                                                               {
    00146   if ( 0 != object_1.accessData() )    {      // Test existence of the first object
    00147     if ( 0 != object_2.accessData() )    {    // Test existence of the second object
    00148       return true;                            // Fine: Both objects exist
    00149     }
    00150   }
    00151   return false;                               // Tough luck: One is missing.
    00152 }

bool operator|| | ( | SmartDataObjectPtr & | object_1,
|  | SmartDataObjectPtr & | object_2 |
| ) |  |  |

Helper to test Smart data objects efficiently This construct allows statements like: SmartEvtDataPtr<MCVertexVector> mcvertices (evt,"/MC/MCVertices"); SmartEvtDataPtr<MCParticleVector> mctracks (evt,"/MC/MCParticles"); if ( mctracks || mcvertices ) { .

.. } and tests the existence of at least one objects in the data store. The second object will then NOT be loaded. It is assumed that the second choice is only an alternative usable in case the first object cannot be retrieved.

This is not done inline due to danger of code explosion.

Parameters:

  | object_1 | Smart pointer to object 1
  | object_2 | Smart pointer to second object

Returns:
  Boolean indicating existence of both objects

Definition at line 170 of file SmartDataObjectPtr.cpp.

References SmartDataObjectPtr::accessData().

    00170                                                                               {
    00171   if ( 0 != object_1.accessData() )    {      // Test existence of the first object
    00172     return true;
    00173   }
    00174   if ( 0 != object_2.accessData() )    {      // Test existence of the second object
    00175     return true;
    00176   }
    00177   return false;                               // Tough luck: Both are missing.
    00178 }