The Gaudi Framework
v41r0 (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
IBinder.h
Go to the documentation of this file.
1
/*****************************************************************************\
2
* (c) Copyright 2021-2025 CERN for the benefit of the LHCb Collaboration *
3
* *
4
* This software is distributed under the terms of the GNU General Public *
5
* Licence version 3 (GPL Version 3), copied verbatim in the file "COPYING". *
6
* *
7
* In applying this licence, CERN does not waive the privileges and immunities *
8
* granted to it by virtue of its status as an Intergovernmental Organization *
9
* or submit itself to any jurisdiction. *
10
\*****************************************************************************/
11
#pragma once
12
#include <
GaudiKernel/IAlgTool.h
>
13
#include <
GaudiKernel/IInterface.h
>
14
#include <type_traits>
15
#include <utility>
16
17
class
EventContext
;
18
19
namespace
Gaudi::Interface::Bind
{
20
21
template
<
typename
IFace>
22
class
Box
final {
23
const
IFace*
m_ptr
=
nullptr
;
24
bool
m_owned
=
false
;
25
26
public
:
27
// identity binding: no actual binding is required...
28
Box
( IFace
const
* ptr ) :
m_ptr
{ ptr } { assert(
m_ptr
!=
nullptr
); }
29
// bind the arguments...
30
template
<std::derived_from<IFace> Ret,
typename
... Args>
31
Box
( std::in_place_type_t<Ret>, Args&&... args )
32
:
m_ptr
{ new Ret{
std
::forward<Args>( args )... } },
m_owned
{ true } {}
33
34
~Box
() {
35
if
(
m_owned
)
delete
m_ptr
;
36
}
37
Box
(
const
Box
& ) =
delete
;
38
Box
&
operator=
(
const
Box
& ) =
delete
;
39
Box
(
Box
&& rhs ) =
delete
;
40
Box
&
operator=
(
Box
&& ) =
delete
;
41
42
operator
IFace
const
&()
const
{
return
*
m_ptr
; }
43
// operator IFace&() && = delete;
44
};
45
46
template
<
typename
IFace>
47
struct
IBinder
:
extend_interfaces
<IAlgTool> {
48
DeclareInterfaceID
(
IBinder
, 1, 0 );
49
virtual
Box<IFace>
bind
(
const
EventContext
& ctx )
const
= 0;
50
};
51
52
template
<
typename
IFace>
53
struct
AlgToolStub
: IFace {
54
55
using
IFace::IFace;
56
AlgToolStub
(
const
AlgToolStub
& ) =
delete
;
57
AlgToolStub
&
operator=
(
const
AlgToolStub
& ) =
delete
;
58
AlgToolStub
(
AlgToolStub
&& ) =
delete
;
59
AlgToolStub
&
operator=
(
AlgToolStub
&& ) =
delete
;
60
61
const
std::string&
name
()
const override
{
62
static
std::string s{
"<STUB>"
};
63
return
s;
64
}
65
const
std::string&
type
()
const override
{
return
name
(); }
66
const
IInterface
*
parent
()
const override
{
return
nullptr
; }
67
68
StatusCode
configure
()
override
{
return
StatusCode::FAILURE
; }
69
StatusCode
initialize
()
override
{
return
StatusCode::FAILURE
; }
70
StatusCode
start
()
override
{
return
StatusCode::FAILURE
; }
71
StatusCode
stop
()
override
{
return
StatusCode::FAILURE
; }
72
StatusCode
finalize
()
override
{
return
StatusCode::FAILURE
; }
73
StatusCode
terminate
()
override
{
return
StatusCode::FAILURE
; }
74
StatusCode
reinitialize
()
override
{
return
StatusCode::FAILURE
; }
75
StatusCode
restart
()
override
{
return
StatusCode::FAILURE
; }
76
Gaudi::StateMachine::State
FSMState
()
const override
{
return
Gaudi::StateMachine::RUNNING
; }
77
StatusCode
sysInitialize
()
override
{
return
StatusCode::FAILURE
; }
78
StatusCode
sysStart
()
override
{
return
StatusCode::FAILURE
; }
79
StatusCode
sysStop
()
override
{
return
StatusCode::FAILURE
; }
80
StatusCode
sysFinalize
()
override
{
return
StatusCode::FAILURE
; }
81
StatusCode
sysReinitialize
()
override
{
return
StatusCode::FAILURE
; }
82
StatusCode
sysRestart
()
override
{
return
StatusCode::FAILURE
; }
83
};
84
85
template
<
typename
IFace>
86
struct
Stub
:
implements
<AlgToolStub<IFace>> {};
87
88
}
// namespace Gaudi::Interface::Bind
IAlgTool.h
IInterface.h
EventContext
This class represents an entry point to all the event specific data.
Definition
EventContext.h:35
Gaudi::Interface::Bind::Box
Definition
IBinder.h:22
Gaudi::Interface::Bind::Box::operator=
Box & operator=(const Box &)=delete
Gaudi::Interface::Bind::Box::Box
Box(std::in_place_type_t< Ret >, Args &&... args)
Definition
IBinder.h:31
Gaudi::Interface::Bind::Box::Box
Box(Box &&rhs)=delete
Gaudi::Interface::Bind::Box::operator=
Box & operator=(Box &&)=delete
Gaudi::Interface::Bind::Box::Box
Box(IFace const *ptr)
Definition
IBinder.h:28
Gaudi::Interface::Bind::Box::~Box
~Box()
Definition
IBinder.h:34
Gaudi::Interface::Bind::Box< IFace >(*)(void const *, Args const &...)::m_owned
bool m_owned
Definition
IBinder.h:24
Gaudi::Interface::Bind::Box< IFace >(*)(void const *, Args const &...)::m_ptr
const IFace * m_ptr
Definition
IBinder.h:23
Gaudi::Interface::Bind::Box::Box
Box(const Box &)=delete
IInterface
Definition of the basic interface.
Definition
IInterface.h:225
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition
StatusCode.h:100
Gaudi::Interface::Bind
Definition
IBinder.h:19
Gaudi::StateMachine::State
State
Allowed states for classes implementing the state machine (ApplicationMgr, Algorithm,...
Definition
StateMachine.h:21
Gaudi::StateMachine::RUNNING
@ RUNNING
Definition
StateMachine.h:25
std
STL namespace.
Gaudi::Interface::Bind::AlgToolStub::terminate
StatusCode terminate() override
Definition
IBinder.h:73
Gaudi::Interface::Bind::AlgToolStub::operator=
AlgToolStub & operator=(AlgToolStub &&)=delete
Gaudi::Interface::Bind::AlgToolStub::type
const std::string & type() const override
Definition
IBinder.h:65
Gaudi::Interface::Bind::AlgToolStub::initialize
StatusCode initialize() override
Definition
IBinder.h:69
Gaudi::Interface::Bind::AlgToolStub::name
const std::string & name() const override
Definition
IBinder.h:61
Gaudi::Interface::Bind::AlgToolStub::AlgToolStub
AlgToolStub(AlgToolStub &&)=delete
Gaudi::Interface::Bind::AlgToolStub::finalize
StatusCode finalize() override
Definition
IBinder.h:72
Gaudi::Interface::Bind::AlgToolStub::sysReinitialize
StatusCode sysReinitialize() override
Definition
IBinder.h:81
Gaudi::Interface::Bind::AlgToolStub::sysStart
StatusCode sysStart() override
Definition
IBinder.h:78
Gaudi::Interface::Bind::AlgToolStub::sysFinalize
StatusCode sysFinalize() override
Definition
IBinder.h:80
Gaudi::Interface::Bind::AlgToolStub::operator=
AlgToolStub & operator=(const AlgToolStub &)=delete
Gaudi::Interface::Bind::AlgToolStub::restart
StatusCode restart() override
Definition
IBinder.h:75
Gaudi::Interface::Bind::AlgToolStub::stop
StatusCode stop() override
Definition
IBinder.h:71
Gaudi::Interface::Bind::AlgToolStub::FSMState
Gaudi::StateMachine::State FSMState() const override
Definition
IBinder.h:76
Gaudi::Interface::Bind::AlgToolStub::sysStop
StatusCode sysStop() override
Definition
IBinder.h:79
Gaudi::Interface::Bind::AlgToolStub::sysRestart
StatusCode sysRestart() override
Definition
IBinder.h:82
Gaudi::Interface::Bind::AlgToolStub::AlgToolStub
AlgToolStub(const AlgToolStub &)=delete
Gaudi::Interface::Bind::AlgToolStub::configure
StatusCode configure() override
Definition
IBinder.h:68
Gaudi::Interface::Bind::AlgToolStub::sysInitialize
StatusCode sysInitialize() override
Definition
IBinder.h:77
Gaudi::Interface::Bind::AlgToolStub::reinitialize
StatusCode reinitialize() override
Definition
IBinder.h:74
Gaudi::Interface::Bind::AlgToolStub::parent
const IInterface * parent() const override
Definition
IBinder.h:66
Gaudi::Interface::Bind::AlgToolStub::start
StatusCode start() override
Definition
IBinder.h:70
Gaudi::Interface::Bind::IBinder
Definition
IBinder.h:47
Gaudi::Interface::Bind::IBinder::bind
virtual Box< IFace > bind(const EventContext &ctx) const =0
Gaudi::Interface::Bind::IBinder::DeclareInterfaceID
DeclareInterfaceID(IBinder, 1, 0)
Gaudi::Interface::Bind::Stub
Definition
IBinder.h:86
extend_interfaces
Base class to be used to extend an interface.
Definition
extend_interfaces.h:23
implements< AlgToolStub< IFace > >::implements
implements()=default
GaudiKernel
include
GaudiKernel
IBinder.h
Generated on
for The Gaudi Framework by
1.17.0