ATLAS Offline Software
Loading...
Searching...
No Matches
xAODTestWriteCView.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
3*/
4
5// $Id$
12
13
14#include "xAODTestWriteCView.h"
15#include "xAODTestWriteHelper.h"
20
21
22namespace DMTest {
23
24
31 ISvcLocator *pSvcLocator)
32 : AthReentrantAlgorithm (name, pSvcLocator),
33 m_cvecKey ("cvec"),
34 m_cviewKey ("cview")
35{
36 declareProperty ("CVecKey", m_cvecKey);
37 declareProperty ("CViewKey", m_cviewKey);
38}
39
40
45{
46 ATH_CHECK( m_cvecKey.initialize() );
47 ATH_CHECK( m_cviewKey.initialize() );
48 return StatusCode::SUCCESS;
49}
50
51
55StatusCode xAODTestWriteCView::execute (const EventContext& ctx) const
56{
58 auto cview = std::make_unique<ConstDataVector<DMTest::CView> >(SG::VIEW_ELEMENTS);
59 for (int i = cvec->size()-1; i >= 0; --i)
60 cview->push_back ((*cvec)[i]);
61
63 CHECK( DMTest::recordView1 (cviewH, std::move(cview)) );
64
65 return StatusCode::SUCCESS;
66}
67
68
73{
74 return StatusCode::SUCCESS;
75}
76
77
78} // namespace DMTest
79
#define ATH_CHECK
Evaluate an expression and check for errors.
Class used for testing xAOD data reading/writing.
Class used for testing ViewVector reading/writing.
DataVector adapter that acts like it holds const pointers.
Helpers for checking error return status codes and reporting errors.
#define CHECK(...)
Evaluate an expression and check for errors.
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
An algorithm that can be simultaneously executed in multiple threads.
SG::WriteHandleKey< ConstDataVector< DMTest::CView > > m_cviewKey
xAODTestWriteCView(const std::string &name, ISvcLocator *pSvcLocator)
Constructor.
virtual StatusCode finalize() override
Algorithm finalization; called at the end of the job.
virtual StatusCode initialize() override
Algorithm initialization; called at the beginning of the job.
virtual StatusCode execute(const EventContext &ctx) const override
Algorithm event processing.
SG::ReadHandleKey< DMTest::CVec > m_cvecKey
Definition B.h:23
StatusCode recordView1(SG::WriteHandle< ConstDataVector< ViewVector< DMTest::CVec > > > &h, std::unique_ptr< ConstDataVector< ViewVector< DMTest::CVec > > > view)
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
Algorithm to test writing an xAOD view vector (cview)
Test recording ViewVector w/o having CLASS_DEF visible in compilation unit.