ATLAS Offline Software
Loading...
Searching...
No Matches
SG::WithEventContext Class Reference

Temporarily change the current EventContext. More...

#include <WithEventContext.h>

Collaboration diagram for SG::WithEventContext:

Public Member Functions

 WithEventContext ()
 Save current EventContext.
 WithEventContext (const EventContext &ctx)
 Save current EventContext and switch to a new one.
 WithEventContext (IProxyDict *sg)
 Save current EventContext and update the IProxyDict pointer.
 ~WithEventContext ()
 Destructor.

Private Attributes

EventContext m_oldCtx
 The saved original EventContext.

Detailed Description

Temporarily change the current EventContext.

The original EventContext will be restored when this object is destroyed.

Definition at line 31 of file WithEventContext.h.

Constructor & Destructor Documentation

◆ WithEventContext() [1/3]

SG::WithEventContext::WithEventContext ( )

Save current EventContext.

This will save the current EventContext, but not change it. The original EventContext will be restored when this object is destroyed.

Definition at line 26 of file WithEventContext.cxx.

27 : m_oldCtx (Gaudi::Hive::currentContext())
28{
29}
EventContext m_oldCtx
The saved original EventContext.

◆ WithEventContext() [2/3]

SG::WithEventContext::WithEventContext ( const EventContext & ctx)

Save current EventContext and switch to a new one.

Parameters
ctxThe new EventContext.

This will save the current EventContext and install a new one. The original EventContext will be restored when this object is destroyed.

Definition at line 39 of file WithEventContext.cxx.

41{
42 Gaudi::Hive::setCurrentContext (ctx);
43}
WithEventContext()
Save current EventContext.

◆ WithEventContext() [3/3]

SG::WithEventContext::WithEventContext ( IProxyDict * sg)

Save current EventContext and update the IProxyDict pointer.

Parameters
sgThe new IProxyDcit.

This will save the current EventContext and then update the current context's IProxyDict pointer to sg. The original EventContext will be restored when this object is destroyed.

Definition at line 54 of file WithEventContext.cxx.

56{
57 EventContext ctx = m_oldCtx;
58
59 Atlas::ExtendedEventContext* ectx = Atlas::tryGetExtendedEventContext(ctx);
60 if (ectx) {
61 ectx->setProxy (sg);
62 }
63 else {
64 ctx.setExtension (Atlas::ExtendedEventContext (sg));
65 }
66 Gaudi::Hive::setCurrentContext (std::move (ctx));
67}
void setProxy(IProxyDict *proxy)
const ExtendedEventContext * tryGetExtendedEventContext(const EventContext &ctx)
Retrieve an extended context from a context object.

◆ ~WithEventContext()

SG::WithEventContext::~WithEventContext ( )

Destructor.

Restore the original EventContext.

Definition at line 73 of file WithEventContext.cxx.

74{
75 Gaudi::Hive::setCurrentContext (m_oldCtx);
76}

Member Data Documentation

◆ m_oldCtx

EventContext SG::WithEventContext::m_oldCtx
private

The saved original EventContext.

Definition at line 72 of file WithEventContext.h.


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