The Gaudi Framework
master (1a7a3838)
Toggle main menu visibility
Loading...
Searching...
No Matches
TestObjectVersion.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2026 CERN for the benefit of the LHCb and ATLAS collaborations *
3
* *
4
* This software is distributed under the terms of the Apache version 2 licence, *
5
* copied verbatim in the file "LICENSE". *
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
#include <
Gaudi/Functional/Consumer.h
>
12
#include <
Gaudi/Functional/Producer.h
>
13
#include <
GaudiKernel/KeyedContainer.h
>
14
15
namespace
Gaudi
{
16
namespace
TestSuite
{
17
namespace
TestObjectVersion
{
18
// using ObjectType = DataObject;
19
using
ObjectType
=
KeyedContainer<KeyedObject<std::size_t>
>;
20
21
struct
CreateObject
:
Gaudi::Functional::Producer
<ObjectType()> {
22
CreateObject
(
const
std::string& name,
ISvcLocator
* svcLoc )
23
: Producer( name, svcLoc, {
"OutputLocation"
,
"/Event/SomeData"
} ) {}
24
ObjectType
operator()
()
const override
{
25
ObjectType
o;
26
o.
setVersion
( 42 );
27
info() <<
"Created object with version "
<<
static_cast<
int
>
( o.
version
() ) <<
endmsg
;
28
return
o;
29
}
30
};
31
DECLARE_COMPONENT
( CreateObject )
32
33
struct
UseObject
:
Gaudi
::
Functional
::Consumer<
void
( const
ObjectType
& )> {
34
UseObject
(
const
std::string& name,
ISvcLocator
* svcLoc )
35
: Consumer( name, svcLoc, {
"InputLocation"
,
"/Event/SomeData"
} ) {}
36
void
operator()
(
const
ObjectType
& o )
const override
{
37
info() <<
"Retrieved object with version "
<<
static_cast<
int
>
( o.
version
() ) <<
endmsg
;
38
if
( o.
version
() != 42 )
throw
GaudiException
(
"Wrong object version"
, name(),
StatusCode::FAILURE
);
39
}
40
};
41
DECLARE_COMPONENT
( UseObject )
42
}
// namespace TestObjectVersion
43
}
// namespace TestSuite
44
}
// namespace Gaudi
Consumer.h
KeyedContainer.h
endmsg
MsgStream & endmsg(MsgStream &s)
MsgStream Modifier: endmsg. Calls the output method of the MsgStream.
Definition
MsgStream.h:198
DECLARE_COMPONENT
#define DECLARE_COMPONENT(type)
Definition
PluginServiceV1.h:45
Producer.h
DataObject::version
unsigned char version() const
Retrieve version number of this object representation.
Definition
DataObject.h:84
DataObject::setVersion
void setVersion(unsigned char vsn)
Set version number of this object representation.
Definition
DataObject.h:86
GaudiException
Define general base for Gaudi exception.
Definition
GaudiException.h:29
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition
ISvcLocator.h:42
KeyedContainer
template class KeyedContainer, KeyedContainer.h
Definition
KeyedContainer.h:61
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition
StatusCode.h:100
Gaudi::Functional
Definition
Consumer.h:15
Gaudi::Functional::Producer
details::Producer< Signature, Traits_, details::isLegacy< Traits_ > > Producer
Definition
Producer.h:37
Gaudi::TestSuite::TestObjectVersion
Definition
TestObjectVersion.cpp:17
Gaudi::TestSuite::TestObjectVersion::ObjectType
KeyedContainer< KeyedObject< std::size_t > > ObjectType
Definition
TestObjectVersion.cpp:19
Gaudi::TestSuite
Definition
ConditionAccessorHolder.h:21
Gaudi
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition
__init__.py:1
Gaudi::TestSuite::TestObjectVersion::CreateObject::CreateObject
CreateObject(const std::string &name, ISvcLocator *svcLoc)
Definition
TestObjectVersion.cpp:22
Gaudi::TestSuite::TestObjectVersion::CreateObject::operator()
ObjectType operator()() const override
Definition
TestObjectVersion.cpp:24
Gaudi::TestSuite::TestObjectVersion::UseObject::operator()
void operator()(const ObjectType &o) const override
Definition
TestObjectVersion.cpp:36
Gaudi::TestSuite::TestObjectVersion::UseObject::UseObject
UseObject(const std::string &name, ISvcLocator *svcLoc)
Definition
TestObjectVersion.cpp:34
GaudiTestSuite
src
FunctionalAlgorithms
TestObjectVersion.cpp
Generated on
for The Gaudi Framework by
1.17.0