The Gaudi Framework
v41r0 (bdbe7744)
Toggle main menu visibility
Loading...
Searching...
No Matches
HelloWorld.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2024 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 files
12
#include "
HelloWorld.h
"
13
#include <
GaudiKernel/DataObject.h
>
14
#include <
GaudiKernel/IDataProviderSvc.h
>
15
16
// Static Factory declaration
17
18
DECLARE_COMPONENT
(
HelloWorld
)
19
20
// Constructor
21
//------------------------------------------------------------------------------
22
HelloWorld
::
HelloWorld
( const
std
::
string
&
name
,
ISvcLocator
* ploc ) :
Algorithm
(
name
, ploc ) {
23
//------------------------------------------------------------------------------
24
m_initialized
=
false
;
25
}
26
27
//------------------------------------------------------------------------------
28
StatusCode
HelloWorld::initialize
() {
29
//------------------------------------------------------------------------------
30
// avoid calling initialize more than once
31
if
(
m_initialized
)
return
StatusCode::SUCCESS
;
32
33
info
() <<
"initializing...."
<<
endmsg
;
34
35
Gaudi::Property<int>
m_int
;
36
Gaudi::Property<double>
m_double
;
37
Gaudi::Property<std::string>
m_string
;
38
39
declareInfo
(
"int_value"
,
t_int
,
"description"
);
40
declareInfo
(
"double_value"
,
t_double
,
"description"
);
41
declareInfo
(
"string_value"
,
t_string
,
"description"
);
42
43
m_initialized
=
true
;
44
return
StatusCode::SUCCESS
;
45
}
46
47
//------------------------------------------------------------------------------
48
StatusCode
HelloWorld::execute
() {
49
//------------------------------------------------------------------------------
50
info
() <<
"executing...."
<<
endmsg
;
51
52
return
StatusCode::SUCCESS
;
53
}
54
55
//------------------------------------------------------------------------------
56
StatusCode
HelloWorld::finalize
() {
57
//------------------------------------------------------------------------------
58
info
() <<
"finalizing...."
<<
endmsg
;
59
60
m_initialized
=
false
;
61
return
StatusCode::SUCCESS
;
62
}
DataObject.h
HelloWorld.h
IDataProviderSvc.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
CommonMessagingBase::info
MsgStream & info() const
shortcut for the method msgStream(MSG::INFO)
Definition
CommonMessaging.h:115
Gaudi::Algorithm::Algorithm
Algorithm(std::string name, ISvcLocator *svcloc, std::string version=PACKAGE_VERSION)
Constructor.
Definition
Algorithm.h:98
Gaudi::Algorithm::declareInfo
void declareInfo(const std::string &name, const T &var, const std::string &desc) const
Declare monitoring information.
Definition
Algorithm.h:324
Gaudi::Algorithm::name
const std::string & name() const override
The identifying name of the algorithm object.
Definition
Algorithm.cpp:518
Gaudi::Property
Implementation of property with value of concrete type.
Definition
Property.h:35
HelloWorld
Trivial Algorithm for tutotial purposes.
Definition
HelloWorld.h:23
HelloWorld::t_int
int t_int
Definition
HelloWorld.h:40
HelloWorld::m_string
Gaudi::Property< std::string > m_string
Definition
HelloWorld.h:39
HelloWorld::initialize
StatusCode initialize() override
Three mandatory member functions of any algorithm.
Definition
HelloWorld.cpp:28
HelloWorld::m_int
Gaudi::Property< int > m_int
These data members are used in the execution of this algorithm They are set in the initialisation pha...
Definition
HelloWorld.h:37
HelloWorld::m_double
Gaudi::Property< double > m_double
Definition
HelloWorld.h:38
HelloWorld::m_initialized
bool m_initialized
Definition
HelloWorld.h:34
HelloWorld::HelloWorld
HelloWorld(const std::string &name, ISvcLocator *pSvcLocator)
Constructor of this form must be provided.
Definition
HelloWorld.cpp:22
HelloWorld::execute
StatusCode execute() override
Definition
HelloWorld.cpp:48
HelloWorld::finalize
StatusCode finalize() override
Definition
HelloWorld.cpp:56
HelloWorld::t_double
double t_double
Definition
HelloWorld.h:41
HelloWorld::t_string
std::string t_string
Definition
HelloWorld.h:42
ISvcLocator
The ISvcLocator is the interface implemented by the Service Factory in the Application Manager to loc...
Definition
ISvcLocator.h:42
StatusCode
This class is used for returning status codes from appropriate routines.
Definition
StatusCode.h:64
StatusCode::SUCCESS
constexpr static const auto SUCCESS
Definition
StatusCode.h:99
std
STL namespace.
GaudiTestSuite
src
AlgSequencer
HelloWorld.cpp
Generated on
for The Gaudi Framework by
1.17.0