Skip to content
Snippets Groups Projects
Commit d493b976 authored by Vakhtang Tsulaia's avatar Vakhtang Tsulaia
Browse files

Merge branch 'constcnv.AthenaBaseComps-20201007' into 'master'

AthenaBaseComps: Add AthConstConverter.

See merge request atlas/athena!37046
parents ef6da54a 384bfd08
No related branches found
No related tags found
No related merge requests found
// This file's extension implies that it's C, but it's really -*- C++ -*-.
/*
* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
*/
/**
* @file AthenaBaseComps/AthConstConverter.h
* @author scott snyder <snyder@bnl.gov>
* @date Oct, 2020
* @brief Gaudi converter base class with const interfaces.
*/
#ifndef ATHENABASECOMPS_ATHCONSTCONVERTER_H
#define ATHENABASECOMPS_ATHCONSTCONVERTER_H
#include "AthenaBaseComps/AthMessaging.h"
#include "AthenaBaseComps/AthMsgStreamMacros.h"
#include "GaudiKernel/Converter.h"
/**
* @brief Gaudi converter base class with const interfaces.
*
* This is a version of Gaudi Converter which uses const
* @c createRepConst and @c createObjConst methods instead
* of @c createObj and @c createRep. This can be used for converters
* that one wants to execute concurrently in MT jobs.
*
* As a bonus, we also include @c AthMessaging functionality.
*/
class AthConstConverter : public Converter, public AthMessaging
{
public:
AthConstConverter (long storage_type,
const CLID& class_type,
ISvcLocator* svc,
const std::string& name)
: Converter (storage_type, class_type, svc),
AthMessaging (msgSvc().get(), name),
m_name (name)
{
}
/// Create the transient representation of an object.
virtual StatusCode createObjConst( IOpaqueAddress* pAddress,
DataObject*& refpObject ) const;
/// Convert the transient object to the requested representation.
virtual StatusCode createRepConst( DataObject* pObject,
IOpaqueAddress*& refpAddress ) const;
/// Create the transient representation of an object.
// Non-const version; just calls the const version.
virtual StatusCode createObj( IOpaqueAddress* pAddress,
DataObject*& refpObject ) override final;
/// Convert the transient object to the requested representation.
// Non-const version; just calls the const version.
virtual StatusCode createRep( DataObject* pObject,
IOpaqueAddress*& refpAddress ) override final;
std::string name() const { return m_name; }
private:
std::string m_name;
};
#endif // not ATHENABASECOMPS_ATHCONSTCONVERTER_H
/*
* Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration.
*/
/**
* @file AthenaBaseComps/AthConstConverter.h
* @author scott snyder <snyder@bnl.gov>
* @date Oct, 2020
* @brief Gaudi converter base class with const interfaces.
*/
#include "AthenaBaseComps/AthConstConverter.h"
/**
* @brief Create the transient representation of an object.
*
* The default implementation is a no-op.
*/
StatusCode AthConstConverter::createObjConst( IOpaqueAddress* /*pAddress*/,
DataObject*& /*refpObject*/ ) const
{
return StatusCode::SUCCESS;
}
/**
* @brief Convert the transient object to the requested representation.
*
* The default implementation is a no-op.
*/
StatusCode AthConstConverter::createRepConst( DataObject* /*pObject*/,
IOpaqueAddress*& /*refpAddress*/ ) const
{
return StatusCode::SUCCESS;
}
/**
* @brief Create the transient representation of an object.
*
* Non-const version; just calls the const version.
*/
StatusCode AthConstConverter::createObj( IOpaqueAddress* pAddress,
DataObject*& refpObject )
{
return createObjConst (pAddress, refpObject);
}
/**
* @brief Convert the transient object to the requested representation.
*
* Non-const version; just calls the const version.
*/
StatusCode AthConstConverter::createRep( DataObject* pObject,
IOpaqueAddress*& refpAddress )
{
return createRepConst (pObject, refpAddress);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment