ATLAS Offline Software
Loading...
Searching...
No Matches
TgcRdoContByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
3*/
4
6
7#include <inttypes.h>
8
9#include <sstream>
10
15#include "GaudiKernel/DataObject.h"
16#include "GaudiKernel/IToolSvc.h"
17#include "GaudiKernel/MsgStream.h"
18#include "GaudiKernel/StatusCode.h"
21
22const std::string const_cnvName = "TgcRdoContByteStreamCnv";
23
24// constructor
26 AthConstConverter(storageType(), classID(), svcloc, "TgcRdoContByteStreamCnv"), m_tool("Muon::TgcRdoContByteStreamTool") {}
27
28// class ID
30
32
33// initialize
35 ATH_MSG_DEBUG(" initialize ");
36 ATH_CHECK(Converter::initialize());
37 ATH_CHECK(m_tool.retrieve());
38 return StatusCode::SUCCESS;
39}
40
41// convert TGC RDOs in the container into ByteStream
42StatusCode TgcRdoContByteStreamCnv::createRepConst(DataObject* pObj, IOpaqueAddress*& pAddr) const {
43 // retrieve TGC RDO container
44 TgcRdoContainer* cont(nullptr);
45 SG::fromStorable(pObj, cont);
46 if (!cont) {
47 ATH_MSG_ERROR(" Can not cast to TgcRdoContainer");
48 return StatusCode::FAILURE;
49 }
50
51 // create address
52 std::string nm = pObj->registry()->name();
53 pAddr = new ByteStreamAddress(classID(), nm, "");
54
55 // convert
56 return m_tool->convert(cont);
57}
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_DEBUG(x)
uint32_t CLID
The Class ID type.
convert to and from a SG storable
const std::string const_cnvName
AthConstConverter(long storage_type, const CLID &class_type, ISvcLocator *svc, const std::string &name)
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
static constexpr long storageType()
virtual StatusCode createRepConst(DataObject *pObj, IOpaqueAddress *&pAddr) const override
Convert the transient object to the requested representation.
virtual StatusCode initialize() override
TgcRdoContByteStreamCnv(ISvcLocator *svcloc)
ToolHandle< Muon::ITGC_RDOtoByteStreamTool > m_tool
bool fromStorable(DataObject *pDObj, T *&pTrans, bool quiet=false, IRegisterTransient *irt=0, bool isConst=true)