ATLAS Offline Software
Loading...
Searching...
No Matches
RodHeaderByteStreamCnv.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
3*/
4
5
6#include <vector>
7#include <stdint.h>
8
11
14
16
17#include "GaudiKernel/DataObject.h"
18#include "GaudiKernel/IOpaqueAddress.h"
19#include "GaudiKernel/ISvcLocator.h"
20#include "GaudiKernel/StatusCode.h"
21
25
27
29
31
32namespace LVL1BS {
33
35 : AthConstConverter( storageType(), classID(), svcloc, "RodHeaderByteStreamCnv" ),
36 m_tool("LVL1BS::RodHeaderByteStreamTool/RodHeaderByteStreamTool")
37{
38}
39
43
44// CLID
45
50
55
56// Init method gets all necessary services etc.
57
58
60{
61 ATH_CHECK( Converter::initialize() );
62 ATH_CHECK( m_tool.retrieve() );
63
64 return StatusCode::SUCCESS;
65}
66
67// createObj should create the RDO from bytestream.
68
69StatusCode RodHeaderByteStreamCnv::createObjConst( IOpaqueAddress* pAddr,
70 DataObject*& pObj ) const
71{
72 ByteStreamAddress *pBS_Addr;
73 pBS_Addr = dynamic_cast<ByteStreamAddress *>( pAddr );
74 if ( !pBS_Addr ) {
75 ATH_MSG_ERROR( " Can not cast to ByteStreamAddress " );
76 return StatusCode::FAILURE;
77 }
78
79 const std::string nm = *( pBS_Addr->par() );
80 // size check
81 auto rhCollection = std::make_unique<DataVector<LVL1::RODHeader> >();
82 ATH_CHECK( m_tool->convert(nm, rhCollection.get()) );
83
84 pObj = SG::asStorable(std::move(rhCollection));
85
86 return StatusCode::SUCCESS;
87}
88
89} // end namespace
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
std::vector< Identifier > ID
a traits class that associates a CLID to a type T It also detects whether T inherits from Gaudi DataO...
Helpers for checking error return status codes and reporting errors.
An STL vector of pointers that by default owns its pointed-to elements.
uint32_t CLID
The Class ID type.
Defines the ROB data entity. The ROB data is an abstract entity that is used to decouple the raw even...
convert to and from a SG storable
AthConstConverter(long storage_type, const CLID &class_type, ISvcLocator *svc, const std::string &name)
IOpaqueAddress for ByteStreamCnvSvc, with ROB ids.
static constexpr long storageType()
ToolHandle< LVL1BS::RodHeaderByteStreamTool > m_tool
Tool that does the actual work.
virtual StatusCode createObjConst(IOpaqueAddress *pAddr, DataObject *&pObj) const override
Create RodHeaders from ByteStream.
virtual StatusCode initialize() override
DataObject * asStorable(SG::DataObjectSharedPtr< T > pObject)
Default, invalid implementation of ClassID_traits.