The Gaudi Framework
master (53dee381)
Toggle main menu visibility
Loading...
Searching...
No Matches
ServiceHistory.cpp
Go to the documentation of this file.
1
/***********************************************************************************\
2
* (c) Copyright 1998-2025 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 <
GaudiKernel/IService.h
>
12
#include <
GaudiKernel/JobHistory.h
>
13
#include <
GaudiKernel/Service.h
>
14
#include <
GaudiKernel/ServiceHistory.h
>
15
#include <iostream>
16
17
using namespace
std
;
18
using
Gaudi::Details::PropertyBase
;
19
20
ServiceHistory::ServiceHistory
() :
m_pService
( nullptr ),
m_name
(
"none"
),
m_type
(
"none"
),
m_version
(
"none"
) {}
21
22
ServiceHistory::ServiceHistory
(
const
IService
* isv,
const
JobHistory
* job )
23
:
m_pService
( isv ),
m_jobHistory
( job ),
m_name
( isv->
name
() ),
m_version
(
"none"
) {
24
25
const
Service
* svc =
dynamic_cast<
const
Service
*
>
( isv );
26
if
( !svc )
throw
GaudiException
(
"Cannot dynamic cast to Service class"
,
name
(),
StatusCode::FAILURE
);
27
m_type
=
System::typeinfoName
(
typeid
( *svc ) );
28
m_properties
= svc->
getProperties
();
29
}
30
31
ServiceHistory::ServiceHistory
(
const
IService
& isv,
const
JobHistory
* job )
32
:
m_pService
( &isv ),
m_jobHistory
( job ),
m_name
( isv.
name
() ),
m_version
(
"none"
) {
33
34
const
Service
* svc =
dynamic_cast<
const
Service
*
>
( &isv );
35
if
( svc ) {
36
m_type
=
System::typeinfoName
(
typeid
( *svc ) );
37
m_properties
= svc->
getProperties
();
38
}
else
{
39
throw
GaudiException
(
"Cannot dynamic cast to Service class"
,
name
(),
StatusCode::FAILURE
);
40
}
41
}
42
43
const
CLID
&
ServiceHistory::classID
() {
44
static
const
CLID
CLID_ServiceHistory = 187225489;
// from `clid ServiceHistory`
45
return
CLID_ServiceHistory;
46
}
47
48
std::ostream&
ServiceHistory::dump
( std::ostream& ost,
const
bool
isXML,
int
ind )
const
{
49
50
if
( !isXML ) {
51
52
ost <<
"Name: "
<<
name
() << endl;
53
ost <<
"Type: "
<<
type
() << endl;
54
ost <<
"Version: "
<<
version
() << endl;
55
56
// Properties
57
ost <<
"Properties: ["
<< endl;
58
59
for
(
const
auto
& ipprop :
properties
() ) {
60
const
PropertyBase
& prop = *ipprop;
61
prop.
fillStream
( ost );
62
ost << endl;
63
}
64
ost <<
"]"
<< endl;
65
66
}
else
{
67
68
ind += 2;
69
indent
( ost, ind );
70
ost <<
"<COMPONENT name=\""
<<
name
() <<
"\" class=\""
<<
convert_string
(
type
() ) <<
"\" version=\""
71
<<
convert_string
(
version
() ) <<
"\">"
<< endl;
72
73
for
(
const
auto
& ipprop :
properties
() ) {
74
const
PropertyBase
& prop = *ipprop;
75
76
indent
( ost, ind + 2 );
77
ost <<
"<PROPERTY name=\""
<< prop.
name
() <<
"\" value=\""
<<
convert_string
( prop.
toString
() )
78
<<
"\" documentation=\""
<<
convert_string
( prop.
documentation
() ) <<
"\">"
<< endl;
79
}
80
81
indent
( ost, ind );
82
ost <<
"</COMPONENT>"
<< endl;
83
}
84
return
ost;
85
}
CLID
unsigned int CLID
Class ID definition.
Definition
ClassID.h:16
IService.h
JobHistory.h
Service.h
ServiceHistory.h
Gaudi::Details::PropertyBase
PropertyBase base class allowing PropertyBase* collections to be "homogeneous".
Definition
PropertyBase.h:34
Gaudi::Details::PropertyBase::documentation
std::string documentation() const
property documentation
Definition
PropertyBase.h:40
Gaudi::Details::PropertyBase::toString
virtual std::string toString() const =0
value -> string
Gaudi::Details::PropertyBase::fillStream
virtual std::ostream & fillStream(std::ostream &) const
the printout of the property value
Definition
Property.cpp:45
Gaudi::Details::PropertyBase::name
const std::string name() const
property name
Definition
PropertyBase.h:38
GaudiException
Define general base for Gaudi exception.
Definition
GaudiException.h:29
HistoryObj::indent
virtual void indent(std::ostream &, int) const
Definition
HistoryObj.cpp:37
HistoryObj::convert_string
static std::string convert_string(const std::string &)
Definition
HistoryObj.cpp:14
IService
General service interface definition.
Definition
IService.h:26
JobHistory
JobHistory class definition.
Definition
JobHistory.h:32
PropertyHolder::getProperties
const std::vector< Gaudi::Details::PropertyBase * > & getProperties() const override
get all properties
Definition
PropertyHolder.h:210
ServiceHistory::m_type
std::string m_type
Definition
ServiceHistory.h:60
ServiceHistory::type
const std::string & type() const override
Definition
ServiceHistory.h:51
ServiceHistory::m_properties
PropertyList m_properties
Definition
ServiceHistory.h:61
ServiceHistory::properties
const PropertyList & properties() const override
Definition
ServiceHistory.h:42
ServiceHistory::m_jobHistory
const JobHistory * m_jobHistory
Definition
ServiceHistory.h:59
ServiceHistory::m_name
std::string m_name
Definition
ServiceHistory.h:60
ServiceHistory::name
const std::string & name() const override
Definition
ServiceHistory.h:50
ServiceHistory::m_version
std::string m_version
Definition
ServiceHistory.h:60
ServiceHistory::classID
static const CLID & classID()
Definition
ServiceHistory.cpp:43
ServiceHistory::dump
std::ostream & dump(std::ostream &, const bool isXML, int indent) const override
Definition
ServiceHistory.cpp:48
ServiceHistory::m_pService
const IService * m_pService
Definition
ServiceHistory.h:58
ServiceHistory::version
const std::string & version() const override
Definition
ServiceHistory.h:52
ServiceHistory::ServiceHistory
ServiceHistory()
Definition
ServiceHistory.cpp:20
Service
Base class for all services.
Definition
Service.h:39
StatusCode::FAILURE
constexpr static const auto FAILURE
Definition
StatusCode.h:100
System::typeinfoName
GAUDI_API const std::string typeinfoName(const std::type_info &)
Get platform independent information about the class type.
Definition
System.cpp:254
std
STL namespace.
GaudiKernel
src
Lib
ServiceHistory.cpp
Generated on
for The Gaudi Framework by
1.17.0