Skip to content
Snippets Groups Projects
Commit 1d17d5b5 authored by Takashi Yamanaka's avatar Takashi Yamanaka
Browse files

Merge branch 'cnvname.InDetEventAthenaPool-20170420' into 'master'

AthenaPoolCnvSvc+InDetEventAthenaPool: Allow specifying name used for error messages to avoid undefined behavior.

See merge request !1052
parents 0d0f59b1 3d84e7e4
No related merge requests found
Showing
with 31 additions and 73 deletions
......@@ -69,7 +69,8 @@ public:
protected:
/// Standard Service Constructor
AthenaPoolConverter(const CLID& id, ISvcLocator* pSvcLocator);
AthenaPoolConverter(const CLID& id, ISvcLocator* pSvcLocator,
const char* name = nullptr);
/// Write an object into POOL.
/// @param pObj [IN] pointer to the transient object.
......
......@@ -25,7 +25,8 @@ class T_AthenaPoolCnvBase : public AthenaPoolConverter {
protected:
/// Constructor
T_AthenaPoolCnvBase(ISvcLocator* svcloc);
T_AthenaPoolCnvBase(ISvcLocator* svcloc,
const char* name = nullptr);
/// Gaudi Service Interface method implementations:
virtual StatusCode initialize();
......
......@@ -23,7 +23,9 @@
//__________________________________________________________________________
template <class T>
T_AthenaPoolCnvBase<T>::T_AthenaPoolCnvBase(ISvcLocator* svcloc) : AthenaPoolConverter(classID(), svcloc) {
T_AthenaPoolCnvBase<T>::T_AthenaPoolCnvBase(ISvcLocator* svcloc,
const char* name /*= nullptr*/)
: AthenaPoolConverter(classID(), svcloc, name) {
}
//______________________________________________________________________________
template <class T>
......
......@@ -36,7 +36,8 @@ class T_AthenaPoolCustCnv : public T_AthenaPoolCnvBase<TRANS> {
protected:
/// Constructor
T_AthenaPoolCustCnv(ISvcLocator* pSvcLocator);
T_AthenaPoolCustCnv(ISvcLocator* pSvcLocator,
const char* name = nullptr);
/// Gaudi Service Interface method implementations:
virtual StatusCode initialize();
......
......@@ -23,7 +23,9 @@
//__________________________________________________________________________
template <class TRANS, class PERS>
T_AthenaPoolCustCnv<TRANS, PERS>::T_AthenaPoolCustCnv(ISvcLocator* pSvcLocator) : T_AthenaPoolCnvBase<TRANS>(pSvcLocator) {
T_AthenaPoolCustCnv<TRANS, PERS>::T_AthenaPoolCustCnv(ISvcLocator* pSvcLocator,
const char* name /*= nullptr*/)
: T_AthenaPoolCnvBase<TRANS>(pSvcLocator, name) {
}
//______________________________________________________________________________
template <class TRANS, class PERS>
......
......@@ -34,7 +34,9 @@ public:
protected:
/// Constructor
/// @param svcloc [IN] Gaudi service locator
T_AthenaPoolCustomCnv(ISvcLocator* pSvcLocator);
/// @param name [IN] Optional name, for error reporting.
T_AthenaPoolCustomCnv(ISvcLocator* pSvcLocator,
const char* name = nullptr);
// the 2 following methods are allowed to throw std::runtime_error
......
......@@ -21,7 +21,8 @@
#include <stdexcept>
template <class TRANS, class PERS>
T_AthenaPoolCustomCnv<TRANS, PERS>::T_AthenaPoolCustomCnv(ISvcLocator* pSvcLocator) : BaseType(pSvcLocator) {
T_AthenaPoolCustomCnv<TRANS, PERS>::T_AthenaPoolCustomCnv(ISvcLocator* pSvcLocator,
const char* name /*= nullptr*/) : BaseType(pSvcLocator, name) {
}
template <class TRANS, class PERS>
......
......@@ -129,9 +129,11 @@ long AthenaPoolConverter::storageType() {
return(POOL_StorageType);
}
//__________________________________________________________________________
AthenaPoolConverter::AthenaPoolConverter(const CLID& myCLID, ISvcLocator* pSvcLocator) :
AthenaPoolConverter::AthenaPoolConverter(const CLID& myCLID, ISvcLocator* pSvcLocator,
const char* name /*= nullptr*/) :
::Converter(POOL_StorageType, myCLID, pSvcLocator),
::AthMessaging((pSvcLocator != nullptr ? msgSvc() : nullptr), "AthenaPoolConverter"),
::AthMessaging((pSvcLocator != nullptr ? msgSvc() : nullptr),
name ? name : "AthenaPoolConverter"),
m_athenaPoolCnvSvc("AthenaPoolCnvSvc", "AthenaPoolConverter"),
m_placement(nullptr),
m_placementHints(),
......
......@@ -4,10 +4,9 @@
#include "InDetLowBetaCandidateCnv.h"
#include "InDetEventTPCnv/InDetLowBetaInfo/InDetLowBetaCandidateCnv_tlp1.h"
#include "MsgUtil.h"
InDetLowBetaCandidateCnv::InDetLowBetaCandidateCnv(ISvcLocator* svcloc) :
T_AthenaPoolCustomCnv<InDet::InDetLowBetaCandidate, InDetLowBetaCandidate_PERS >( svcloc ),
T_AthenaPoolCustomCnv<InDet::InDetLowBetaCandidate, InDetLowBetaCandidate_PERS >( svcloc, "InDetLowBetaCandidateConverter" ),
m_TPConverter (new InDetLowBetaCandidateCnv_tlp1)
{ }
InDetLowBetaCandidateCnv::~InDetLowBetaCandidateCnv()
......@@ -18,9 +17,6 @@ InDetLowBetaCandidateCnv::~InDetLowBetaCandidateCnv()
InDetLowBetaCandidate_PERS* InDetLowBetaCandidateCnv::createPersistent(InDet::InDetLowBetaCandidate* transCont) {
IDEvtAthPool::setMsgName(this,"InDetLowBetaCandidateConverter");//So msg() won't use name "AthenaPoolConverter"
//do it in both createPersistent and createTransient since there is no initialize method (could add it of course)
ATH_MSG_DEBUG("InDetLowBetaCandidateCnv::createPersistent");
InDetLowBetaCandidate_PERS *persObj = m_TPConverter->createPersistent(transCont, msg());
......@@ -30,9 +26,6 @@ InDetLowBetaCandidate_PERS* InDetLowBetaCandidateCnv::createPersistent(InDet::In
InDet::InDetLowBetaCandidate* InDetLowBetaCandidateCnv::createTransient() {
IDEvtAthPool::setMsgName(this,"InDetLowBetaCandidateConverter");//So msg() won't use name "AthenaPoolConverter"
//do it in both createPersistent and createTransient since there is no initialize method (could add it of course)
ATH_MSG_DEBUG("InDetLowBetaCandidateCnv::createTransient ");
static pool::Guid tlp1_guid("8C24589F-FBAA-4686-9254-B5C360A94733");
......
......@@ -4,10 +4,9 @@
#include "InDetLowBetaContainerCnv.h"
#include "InDetEventTPCnv/InDetLowBetaInfo/InDetLowBetaContainerCnv_tlp1.h"
#include "MsgUtil.h"
InDetLowBetaContainerCnv::InDetLowBetaContainerCnv(ISvcLocator *svcloc)
: InDetLowBetaContainerCnvBase(svcloc),
: InDetLowBetaContainerCnvBase(svcloc, "InDetLowBetaContainerCnv"),
m_TPConverter_tlp1 (new InDetLowBetaContainerCnv_tlp1)
{ }
......@@ -19,9 +18,6 @@ InDetLowBetaContainerCnv::~InDetLowBetaContainerCnv()
// createPersistent
InDetLowBetaContainer_PERS *InDetLowBetaContainerCnv::createPersistent(InDet::InDetLowBetaContainer *transObj) {
//should really do it just once in ::initialize instead:
IDEvtAthPool::setMsgName(this,"InDetLowBetaContainerCnv");//So msg() won't use name "AthenaPoolConverter"
ATH_MSG_DEBUG("InDetLowBetaContainerCnv::createPersistent called");
InDetLowBetaContainer_PERS *p_InDetLowBetaCont = m_TPConverter_tlp1->createPersistent(transObj, msg());
......@@ -32,9 +28,6 @@ InDetLowBetaContainer_PERS *InDetLowBetaContainerCnv::createPersistent(InDet::In
// createTransient
InDet::InDetLowBetaContainer *InDetLowBetaContainerCnv::createTransient() {
//should really do it just once in ::initialize instead:
IDEvtAthPool::setMsgName(this,"InDetLowBetaContainerCnv");//So msg() won't use name "AthenaPoolConverter"
ATH_MSG_DEBUG("InDetLowBetaContainerCnv::createTransient called");
static pool::Guid tlp1_guid("2EBE2034-8157-477B-B327-D37BE8A0317D");
......
......@@ -8,7 +8,8 @@
// Persistent class and converter header file
#include "InDetEventAthenaPool/InDetSimData_p1.h"
#include "InDetSimDataCnv_p1.h"
#include "AthenaKernel/IProxyDict.h"
#include "AthenaBaseComps/AthMessaging.h"
typedef std::vector<InDetSimData::Deposit>::const_iterator depositIterator;
......
......@@ -5,26 +5,6 @@
#ifndef INDETEVENTATHENAPOOL_MSGFIX
#define INDETEVENTATHENAPOOL_MSGFIX
// A few utilities for using MSG service easily in converters. Here
// temporarily until someone comes up with a more general approach.
//
// Thomas Kittelmann March 2011
#include "AthenaBaseComps/AthMessaging.h"
#include "GaudiKernel/MsgStream.h"
namespace IDEvtAthPool {
//Small slightly dirty workaround so we can set the source name on the
//AthMessaging message streams to something else than "AthenaPoolConverter""
class MsgStreamSourceSettable : public MsgStream {
public:
void setSource(const char*c) { if (m_source!=c) m_source=c; }
};
inline void setMsgName(AthMessaging*a,const char*c) {
if (a&&c) static_cast<MsgStreamSourceSettable*>(&(a->msg()))->setSource(c);
}
}
//Defines similar to ATH_MSG_DEBUG and ATH_MSG_VERBOSE which accepts the MsgStream as an argument:
#ifdef MSG_DEBUG
#undef MSG_DEBUG
......
......@@ -5,14 +5,13 @@
#include "StoreGate/StoreGateSvc.h"
#include "PixelClusterContainerCnv.h"
#include "InDetIdentifier/PixelID.h"
#include "MsgUtil.h"
#include <memory>
#include <iostream>
PixelClusterContainerCnv::PixelClusterContainerCnv (ISvcLocator* svcloc)
: PixelClusterContainerCnvBase(svcloc),
: PixelClusterContainerCnvBase(svcloc, "PixelClusterContainerCnv"),
m_converter_p0(),
m_storeGate(nullptr)
{}
......@@ -21,8 +20,6 @@
StatusCode PixelClusterContainerCnv::initialize() {
IDEvtAthPool::setMsgName(this,"PixelClusterContainerCnv");//So msg() won't use name "AthenaPoolConverter"
ATH_MSG_INFO("PixelClusterContainerCnv::initialize()");
StatusCode sc = PixelClusterContainerCnvBase::initialize();
......
......@@ -11,14 +11,9 @@
#include "PixelGangedClusterAmbiguitiesCnv.h"
#include "InDetEventTPCnv/InDetPrepRawData/PixelGangedClusterAmbiguities_p1.h"
#include "InDetEventTPCnv/InDetPrepRawData/PixelGangedClusterAmbiguitiesCnv_p1.h"
#include "MsgUtil.h"
static PixelGangedClusterAmbiguitiesCnv_p1 TPconverter;
PixelGangedClusterAmbiguities_PERS* PixelGangedClusterAmbiguitiesCnv::createPersistent(InDet::PixelGangedClusterAmbiguities* transObj) {
//repeated twice, should really be in an initialize method
IDEvtAthPool::setMsgName(this,"PixelGangedClusterAmbiguitiesConverter");//So msg() won't use name "AthenaPoolConverter"
ATH_MSG_DEBUG("PixelGangedClusterAmbiguities write");
PixelGangedClusterAmbiguities_PERS *persObj = TPconverter.createPersistent( transObj, msg() );
ATH_MSG_DEBUG("Success");
......@@ -26,9 +21,6 @@ PixelGangedClusterAmbiguities_PERS* PixelGangedClusterAmbiguitiesCnv::createPers
}
InDet::PixelGangedClusterAmbiguities* PixelGangedClusterAmbiguitiesCnv::createTransient() {
//repeated twice, should really be in an initialize method
IDEvtAthPool::setMsgName(this,"PixelGangedClusterAmbiguitiesConverter");//So msg() won't use name "AthenaPoolConverter"
static pool::Guid p1_guid("FE36CE7E-EADF-481F-A55A-26DA0030DFAA");
// static pool::Guid p0_guid("380D8BB9-B34F-470F-92CC-06C3D60F7BE4");
if( compareClassGuid(p1_guid) ) {
......
......@@ -22,7 +22,7 @@ typedef T_AthenaPoolCustomCnv<InDet::PixelGangedClusterAmbiguities, PixelGanged
class PixelGangedClusterAmbiguitiesCnv : public PixelGangedClusterAmbiguitiesCnvBase {
friend class CnvFactory<PixelGangedClusterAmbiguitiesCnv >;
protected:
PixelGangedClusterAmbiguitiesCnv (ISvcLocator* svcloc) : PixelGangedClusterAmbiguitiesCnvBase(svcloc) {}
PixelGangedClusterAmbiguitiesCnv (ISvcLocator* svcloc) : PixelGangedClusterAmbiguitiesCnvBase(svcloc, "PixelGangedClusterAmbiguitiesConverter") {}
virtual PixelGangedClusterAmbiguities_PERS* createPersistent (InDet::PixelGangedClusterAmbiguities* transObj);
virtual InDet::PixelGangedClusterAmbiguities* createTransient ();
};
......
......@@ -33,8 +33,6 @@ namespace {
}
//================================================================
StatusCode PixelRDO_ContainerCnv::initialize() {
IDEvtAthPool::setMsgName(this,"PixelRDO_ContainerCnv");//So msg() won't use name "AthenaPoolConverter"
StatusCode sc = PixelRDO_ContainerCnvBase::initialize();
if (sc.isFailure()) {
ATH_MSG_FATAL("PixelRDO_ContainerCnvBase::initialize() returned failure !");
......
......@@ -38,7 +38,7 @@ class PixelRDO_ContainerCnv : public PixelRDO_ContainerCnvBase {
protected:
PixelRDO_ContainerCnv (ISvcLocator* svcloc)
: PixelRDO_ContainerCnvBase(svcloc),
: PixelRDO_ContainerCnvBase(svcloc, "PixelRDO_ContainerCnv"),
m_converter_p0(),
m_storeGate(nullptr)
{}
......
......@@ -13,7 +13,7 @@
#include <iostream>
SCT_ClusterContainerCnv::SCT_ClusterContainerCnv (ISvcLocator* svcloc)
: SCT_ClusterContainerCnvBase(svcloc),
: SCT_ClusterContainerCnvBase(svcloc, "SCT_ClusterContainerCnv"),
m_converter_p0(),
m_storeGate(nullptr)
{}
......@@ -22,8 +22,6 @@
StatusCode SCT_ClusterContainerCnv::initialize() {
IDEvtAthPool::setMsgName(this,"SCT_ClusterContainerCnv");//So msg() won't use name "AthenaPoolConverter"
ATH_MSG_INFO("SCT_ClusterContainerCnv::initialize()");
StatusCode sc = SCT_ClusterContainerCnvBase::initialize();
......
......@@ -5,7 +5,6 @@
#include "SCT_RDO_ContainerCnv.h"
#include "InDetIdentifier/SCT_ID.h"
#include "MsgUtil.h"
#include <memory>
......@@ -37,15 +36,13 @@ namespace {
}
SCT_RDO_ContainerCnv::SCT_RDO_ContainerCnv (ISvcLocator* svcloc)
: SCT_RDO_ContainerCnvBase(svcloc),
: SCT_RDO_ContainerCnvBase(svcloc, "SCT_RDO_ContainerCnv"),
m_converter_p0(),
m_storeGate(nullptr)
{}
//================================================================
StatusCode SCT_RDO_ContainerCnv::initialize() {
IDEvtAthPool::setMsgName(this,"SCT_RDO_ContainerCnv");//So msg() won't use name "AthenaPoolConverter"
StatusCode sc = SCT_RDO_ContainerCnvBase::initialize();
if (sc.isFailure()) {
ATH_MSG_FATAL("SCT_RDO_ContainerCnvBase::initialize() returned failure !");
......
......@@ -4,14 +4,13 @@
#include "TRT_DriftCircleContainerCnv.h"
#include "InDetIdentifier/TRT_ID.h"
#include "MsgUtil.h"
#include <memory>
#include <iostream>
TRT_DriftCircleContainerCnv::TRT_DriftCircleContainerCnv (ISvcLocator* svcloc)
: TRT_DriftCircleContainerCnvBase(svcloc),
: TRT_DriftCircleContainerCnvBase(svcloc, "TRT_DriftCircleContainerCnv"),
m_converter_p0(),
m_storeGate(nullptr)
{}
......@@ -20,8 +19,6 @@
StatusCode TRT_DriftCircleContainerCnv::initialize() {
IDEvtAthPool::setMsgName(this,"TRT_DriftCircleContainerCnv");//So msg() won't use name "AthenaPoolConverter"
ATH_MSG_INFO("TRT_DriftCircleContainerCnv::initialize()");
StatusCode sc = TRT_DriftCircleContainerCnvBase::initialize();
......
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