| # Gaudi Framework, version v21r8 |

Home |  | Generated: 17 Mar 2010

# Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 > Struct Template Reference

Helper structure for implementation of "getOrCreate"-functions for GaudiCommon<BASE>. More...

`#include <GetData.h>`

Inheritance diagram for Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >:

[legend]

List of all members.

## Public Types
typedef Getter::Type | Type
typedef Getter::return_type | return_type
| the actual return type
## Public Member Functions
template<class COMMON>
return_type | operator() (const COMMON &common, IDataProviderSvc *service, const std::string &location, const std::string &location2) const
| the only one essential method
## Private Types
typedef GetData< TYPE > | Getter
| the actual data getter

## Detailed Description

### template<class TYPE, class TYPE2>
struct Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >

Helper structure for implementation of "getOrCreate"-functions for GaudiCommon<BASE>.

Author:
  Vanya BELYAEV Ivan.Belyaev@nikhef.nl

Date:
  2008-07-22

Definition at line 360 of file GetData.h.

## Member Typedef Documentation

template<class TYPE, class TYPE2>

typedef GetData<TYPE> Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >::Getter`[private]`

the actual data getter

Definition at line 365 of file GetData.h.

template<class TYPE, class TYPE2>

typedef Getter::Type Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >::Type

Definition at line 369 of file GetData.h.

template<class TYPE, class TYPE2>

typedef Getter::return_type Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >::return_type

the actual return type

Definition at line 371 of file GetData.h.

## Member Function Documentation

template<class TYPE, class TYPE2>
template<class COMMON>

return_type Gaudi::Utils::GetOrCreateData< TYPE, TYPE2 >::operator() | ( | const COMMON & | common,
|  | IDataProviderSvc * | service,
|  | const std::string & | location,
|  | const std::string & | location2 |
| ) |  |  | const`[inline]`

the only one essential method

Parameters:

  | common | the actual "worker"
  | service | pointer to Data Provider Service
  | location | location of objects in TES

Returns:
  the data

check the data

Definition at line 383 of file GetData.h.

    00387       {
    00388         SmartDataPtr<TYPE> obj ( service , location ) ;
    00389         if ( !obj )
    00390         {
    00391           TYPE2* o = new TYPE2() ;
    00392           common.put ( service , o , location2 ) ;
    00393           if ( common.msgLevel ( MSG::DEBUG ) )
    00394           { common.debug() << "The object of type '"
    00395                            << System::typeinfoName(typeid(*o))
    00396                            << "' has been created from TS at address '"
    00397                            << location2 << "'" << endmsg ; }
    00398           return_type _o = o ;
    00399           return _o ;
    00400         }
    00401         return_type ret = obj ;
    00403         common.Assert ( !(!ret) , "get():: No valid data at '" + location + "'"  ) ;
    00404         if ( common.msgLevel ( MSG::DEBUG ) )
    00405         { common.debug() << "The object of type '"
    00406                          << System::typeinfoName(typeid(*ret))
    00407                          << "' has been retrieved from TS at address '"
    00408                          << location << "'" << endmsg ; }
    00409         // return *VALID* data
    00410         return ret ;
    00411         // ====================================================================
    00412       }

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

- /afs/cern.ch/sw/Gaudi/releases/GAUDI/GAUDI_v21r8/GaudiAlg/GaudiAlg/GetData.h