Skip to content
Snippets Groups Projects
Commit 8ba95178 authored by Hadrien Benjamin Grasland's avatar Hadrien Benjamin Grasland
Browse files

Backport to legacy DataObjectHandles

parent 90048da8
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include "GaudiKernel/EventDataHandle.h" #include "GaudiKernel/DataObjectHandle.h"
#include "GaudiKernel/StatusCode.h" #include "GaudiKernel/StatusCode.h"
#include "ConditionAccessor.h" #include "ConditionAccessor.h"
...@@ -56,8 +56,8 @@ namespace DemoBackend ...@@ -56,8 +56,8 @@ namespace DemoBackend
// We must also provide a way for a reentrant algorithm to access the // We must also provide a way for a reentrant algorithm to access the
// condition handling context associated with this event. // condition handling context associated with this event.
const ConditionContext& getConditionContext( const EventContext& ctx ) const { const ConditionContext& getConditionContext( const EventContext& /* ctx */ ) const {
return m_ctxHandle.get( ctx ); return *m_ctxHandle.get();
} }
private: private:
...@@ -74,7 +74,7 @@ namespace DemoBackend ...@@ -74,7 +74,7 @@ namespace DemoBackend
private: private:
// We must declare a dependency on the condition context // We must declare a dependency on the condition context
// (which will be produced by the ConditionContextProducer alg). // (which will be produced by the ConditionContextProducer alg).
Gaudi::EventReadHandle<ConditionContext> m_ctxHandle{ DataObjectReadHandle<ConditionContext> m_ctxHandle{
detail::CONDITION_CONTEXT_PATH, this }; detail::CONDITION_CONTEXT_PATH, this };
// We must track some properties of our condition accessors to declare them // We must track some properties of our condition accessors to declare them
......
...@@ -4,6 +4,8 @@ ...@@ -4,6 +4,8 @@
#include <typeinfo> #include <typeinfo>
#include <unordered_map> #include <unordered_map>
#include "GaudiKernel/DataObject.h"
#include "ConditionKey.h" #include "ConditionKey.h"
namespace DemoBackend namespace DemoBackend
...@@ -19,7 +21,7 @@ namespace DemoBackend ...@@ -19,7 +21,7 @@ namespace DemoBackend
// Much like the EventContext gives access to event data, a ConditionContext // Much like the EventContext gives access to event data, a ConditionContext
// gives access to condition data. For technical reasons, the ConditionContext // gives access to condition data. For technical reasons, the ConditionContext
// may be produced during event processing and is stored in the TES. // may be produced during event processing and is stored in the TES.
class ConditionContext { class ConditionContext : public DataObject {
public: public:
// Normally, we would tell the backend that we're done processing a given // Normally, we would tell the backend that we're done processing a given
// event via RAII, but this is not necessary for this dummy implementation. // event via RAII, but this is not necessary for this dummy implementation.
......
#include <memory>
#include "ConditionBackendSvc.h" #include "ConditionBackendSvc.h"
#include "ConditionContextProducer.h" #include "ConditionContextProducer.h"
#include "EventTimestamp.h" #include "EventTimestamp.h"
...@@ -15,10 +17,11 @@ namespace DemoBackend ...@@ -15,10 +17,11 @@ namespace DemoBackend
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
StatusCode ConditionContextProducer::execute( const EventContext& ctx ) const { StatusCode ConditionContextProducer::execute( const EventContext& evCtx ) const {
// For this test, we just use the event number as an event timestamp // For this test, we just use the event number as an event timestamp
detail::EventTimestamp eventTime = ctx.evt(); detail::EventTimestamp eventTime = evCtx.evt();
m_ctxHandle.put( ctx, m_backendSvc->setupEvent( eventTime ) ); auto condCtx = std::make_unique<ConditionContext>( m_backendSvc->setupEvent( eventTime ) );
m_ctxHandle.put( std::move( condCtx ) );
return StatusCode::SUCCESS; return StatusCode::SUCCESS;
} }
......
#pragma once #pragma once
#include "GaudiKernel/Algorithm.h" #include "GaudiKernel/Algorithm.h"
#include "GaudiKernel/DataObjectHandle.h"
#include "GaudiKernel/EventContext.h" #include "GaudiKernel/EventContext.h"
#include "GaudiKernel/EventDataHandle.h"
#include "GaudiKernel/IService.h" #include "GaudiKernel/IService.h"
#include "GaudiKernel/SmartIF.h" #include "GaudiKernel/SmartIF.h"
#include "GaudiKernel/StatusCode.h" #include "GaudiKernel/StatusCode.h"
...@@ -39,7 +39,7 @@ namespace DemoBackend ...@@ -39,7 +39,7 @@ namespace DemoBackend
private: private:
// This DataHandle allows us to write down the ConditionContext in the TES // This DataHandle allows us to write down the ConditionContext in the TES
Gaudi::EventWriteHandle<ConditionContext> m_ctxHandle{ mutable DataObjectWriteHandle<ConditionContext> m_ctxHandle{
detail::CONDITION_CONTEXT_PATH, this }; detail::CONDITION_CONTEXT_PATH, this };
// These members allow us to contact the condition storage back-end // These members allow us to contact the condition storage back-end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment