ATLAS Offline Software
Loading...
Searching...
No Matches
xAOD::FillContainer< Cont_t, AuxCont_t > Class Template Reference

#include <FillContainer.h>

Collaboration diagram for xAOD::FillContainer< Cont_t, AuxCont_t >:

Public Types

using WriteHandle_t = SG::WriteHandle<Cont_t>
 Abrivation of the write handle type.

Public Member Functions

 FillContainer ()
 default constructor
 FillContainer (FillContainer &&other)=default
 Move constructor.
FillContaineroperator= (FillContainer &&other)=default
 Default move operator.
Cont_t * get () const
 get operator
Cont_t * operator-> () const
 Define the arrow operator.
Cont_t & operator* () const
 Define the dereference operator.
StatusCode record (const SG::WriteHandleKey< Cont_t > &key, const EventContext &ctx)
 Record the container to store gate using the passed write handle key.
StatusCode recordNonConst (const SG::WriteHandleKey< Cont_t > &key, const EventContext &ctx)
 Record the container to store gate using the passed write handle key.
WriteHandle_tgetHandle ()
 Returns the reference to the active write handle.
bool hasHandle () const
 Returns whether the record function has been called.

Private Attributes

std::unique_ptr< Cont_t > m_cont {std::make_unique<Cont_t>()}
 Unique pointer to the container type.
std::unique_ptr< AuxCont_t > m_auxCont {std::make_unique<AuxCont_t>()}
 Unique pointer to the aux container type.
std::unique_ptr< WriteHandle_tm_writeHandle {}
 Pointer to the write handle.

Detailed Description

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
class xAOD::FillContainer< Cont_t, AuxCont_t >

Definition at line 39 of file FillContainer.h.

Member Typedef Documentation

◆ WriteHandle_t

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
using xAOD::FillContainer< Cont_t, AuxCont_t >::WriteHandle_t = SG::WriteHandle<Cont_t>

Abrivation of the write handle type.

Definition at line 42 of file FillContainer.h.

Constructor & Destructor Documentation

◆ FillContainer() [1/2]

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
xAOD::FillContainer< Cont_t, AuxCont_t >::FillContainer ( )
inline

default constructor

Definition at line 44 of file FillContainer.h.

44 {
48 m_cont->setStore(m_auxCont.get());
49 }
50 }
std::unique_ptr< AuxCont_t > m_auxCont
Unique pointer to the aux container type.
std::unique_ptr< Cont_t > m_cont
Unique pointer to the container type.

◆ FillContainer() [2/2]

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
xAOD::FillContainer< Cont_t, AuxCont_t >::FillContainer ( FillContainer< Cont_t, AuxCont_t > && other)
default

Move constructor.

Member Function Documentation

◆ get()

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
Cont_t * xAOD::FillContainer< Cont_t, AuxCont_t >::get ( ) const
inline

get operator

Definition at line 57 of file FillContainer.h.

57 {
58 if (!hasHandle()) {
59 return m_cont.get();
60 }
62 return handle.ptr();
63 }
bool hasHandle() const
Returns whether the record function has been called.
SG::WriteHandle< Cont_t > WriteHandle_t
Abrivation of the write handle type.
std::unique_ptr< WriteHandle_t > m_writeHandle
Pointer to the write handle.

◆ getHandle()

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
WriteHandle_t & xAOD::FillContainer< Cont_t, AuxCont_t >::getHandle ( )
inline

Returns the reference to the active write handle.

Throws an exception if the handle has not been instantiated yet.

Definition at line 114 of file FillContainer.h.

114 {
115 if (!hasHandle()) {
116 THROW_EXCEPTION("The write handle has not been initialized. Please call record or"
117 <<" recordNonConst before calling getHandle()");
118 }
119 return *m_writeHandle;
120 }
#define THROW_EXCEPTION(MESSAGE)
Definition throwExcept.h:10

◆ hasHandle()

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
bool xAOD::FillContainer< Cont_t, AuxCont_t >::hasHandle ( ) const
inline

Returns whether the record function has been called.

Definition at line 122 of file FillContainer.h.

122{ return m_writeHandle != nullptr; }

◆ operator*()

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
Cont_t & xAOD::FillContainer< Cont_t, AuxCont_t >::operator* ( ) const
inline

Define the dereference operator.

Definition at line 67 of file FillContainer.h.

67{ return *get(); }
Cont_t * get() const
get operator

◆ operator->()

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
Cont_t * xAOD::FillContainer< Cont_t, AuxCont_t >::operator-> ( ) const
inline

Define the arrow operator.

Definition at line 65 of file FillContainer.h.

65{ return get(); }

◆ operator=()

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
FillContainer & xAOD::FillContainer< Cont_t, AuxCont_t >::operator= ( FillContainer< Cont_t, AuxCont_t > && other)
default

Default move operator.

◆ record()

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
StatusCode xAOD::FillContainer< Cont_t, AuxCont_t >::record ( const SG::WriteHandleKey< Cont_t > & key,
const EventContext & ctx )
inline

Record the container to store gate using the passed write handle key.

If the key is empty nothing is written

Parameters
keyReference to the StoreGate write handle key
ctxEvent context to be passed to the StoreGate instance

Definition at line 72 of file FillContainer.h.

73 {
74 if (key.empty()) {
76 }
77 if (hasHandle()) {
78 MsgStream msg{Athena::getMessageSvc(), "FillContainer"};
79 msg<<MSG::ERROR<<__func__<<"() - "<<__LINE__<<": Write handle under key "
80 <<m_writeHandle->key()<<" already exists."<<endmsg;
82 }
86 } else {
87 return m_writeHandle->record(std::move(m_cont));
88 }
89 }
IMessageSvc * getMessageSvc(bool quiet=false)

◆ recordNonConst()

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
StatusCode xAOD::FillContainer< Cont_t, AuxCont_t >::recordNonConst ( const SG::WriteHandleKey< Cont_t > & key,
const EventContext & ctx )
inline

Record the container to store gate using the passed write handle key.

If the key is empty nothing is written

Parameters
keyReference to the StoreGate write handle key
ctxEvent context to be passed to the StoreGate instance

Definition at line 94 of file FillContainer.h.

95 {
96 if (key.empty()) {
98 }
99 if (hasHandle()) {
100 MsgStream msg{Athena::getMessageSvc(), "FillContainer"};
101 msg<<MSG::ERROR<<__func__<<"() - "<<__LINE__<<": Write handle under key "
102 <<m_writeHandle->key()<<" already exists."<<endmsg;
103 return StatusCode::FAILURE;
104 }
106 if constexpr(!std::is_same_v<AuxCont_t, void*>) {
107 return m_writeHandle->recordNonConst(std::move(m_cont), std::move(m_auxCont));
108 } else {
109 return m_writeHandle->recordNonConst(std::move(m_cont));
110 }
111 }

Member Data Documentation

◆ m_auxCont

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
std::unique_ptr<AuxCont_t> xAOD::FillContainer< Cont_t, AuxCont_t >::m_auxCont {std::make_unique<AuxCont_t>()}
private

Unique pointer to the aux container type.

Definition at line 127 of file FillContainer.h.

◆ m_cont

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
std::unique_ptr<Cont_t> xAOD::FillContainer< Cont_t, AuxCont_t >::m_cont {std::make_unique<Cont_t>()}
private

Unique pointer to the container type.

Definition at line 125 of file FillContainer.h.

◆ m_writeHandle

template<detail::DataVectorConcept Cont_t, detail::AuxContainerConcept AuxCont_t>
std::unique_ptr<WriteHandle_t> xAOD::FillContainer< Cont_t, AuxCont_t >::m_writeHandle {}
private

Pointer to the write handle.

Is instantiated with a record call

Definition at line 129 of file FillContainer.h.

129{};

The documentation for this class was generated from the following file: