The Gaudi Framework  master (ad37f17d)
Loading...
Searching...
No Matches
DataHandle.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\***********************************************************************************/
13
14#include <sstream>
15
16std::string const Gaudi::DataHandle::default_type = "unknown_t";
17
18namespace Gaudi {
19 std::string DataHandle::pythonRepr() const {
20 std::ostringstream ost;
21 ost << "DataHandle(" << fullKey() << ", '";
22 switch ( mode() ) {
24 ost << "R";
25 break;
27 ost << "W";
28 break;
29 default:
30 ost << "UNKNOWN";
31 break;
32 }
33 ost << "', '" + default_type + "')";
34 return ost.str();
35 }
36
37 std::string DataHandleVectorBase::semantics() const {
38 switch ( mode() ) {
40 return "Gaudi::DataHandleVector<DataObjectReadHandle, " + type() + ">";
42 return "Gaudi::DataHandleVector<DataObjectWriteHandle, " + type() + ">";
43 default:
44 return "Gaudi::DataHandleVector<DataHandle, " + type() + ">";
45 }
46 }
47
49 std::ostringstream ost;
50 ost << pythonPropertyClassName() << "([";
51 const char* sep = "";
52 for ( const auto& key : keys() ) {
53 ost << sep << "'" << key.key() << "'";
54 sep = ",";
55 }
56 ost << "], '";
57 switch ( mode() ) {
59 ost << "R";
60 break;
62 ost << "W";
63 break;
64 default:
65 ost << "UNKNOWN";
66 break;
67 }
68 ost << "', '" << type() << "')";
69 return ost.str();
70 }
71
72 std::ostream& operator<<( std::ostream& str, const DataHandle& d ) {
73 str << d.fullKey() << " m: " << d.mode();
74 if ( d.owner() ) str << " o: " << d.owner()->name();
75 return str;
76 }
77} // namespace Gaudi
static const std::string default_type
Definition DataHandle.h:88
virtual std::string pythonRepr() const
virtual IDataHandleHolder * owner() const
Definition DataHandle.h:58
virtual Mode mode() const
Definition DataHandle.h:60
virtual const DataObjID & fullKey() const
Definition DataHandle.h:66
DataHandle(DataObjID k, Mode a=Reader, IDataHandleHolder *owner=nullptr)
Definition DataHandle.h:47
virtual std::string type() const =0
Demangled C++ type of the data accessed by each handle.
std::string semantics() const
GaudiConfig2 semantics name including handle mode and value type.
virtual const std::vector< DataObjID > & keys() const =0
Configured TES keys, in property order.
virtual DataHandle::Mode mode() const =0
Access mode shared by all handles in the vector.
std::string pythonPropertyClassName() const
Python class used to represent the property value.
Definition DataHandle.h:116
std::string pythonRepr() const
Python expression reproducing the configured value.
virtual const std::string & name() const =0
Retrieve the name of the instance.
This file provides a Grammar for the type Gaudi::Accumulators::Axis It allows to use that type from p...
Definition __init__.py:1
std::ostream & operator<<(std::ostream &o, const Gaudi::StringKey &key)
printout of the object reply on the native printout for the string
Definition StringKey.h:182