diff --git a/GaudiKernel/GaudiKernel/DataObjectHandle.h b/GaudiKernel/GaudiKernel/DataObjectHandle.h index 7720dd3c254e6ef09b2dc30c7bc3bd39e9cdeab2..07adfe848d737cfc0445c54e52188b758851c9be 100644 --- a/GaudiKernel/GaudiKernel/DataObjectHandle.h +++ b/GaudiKernel/GaudiKernel/DataObjectHandle.h @@ -8,6 +8,7 @@ #include "GaudiKernel/IProperty.h" #include "GaudiKernel/IRegistry.h" #include "GaudiKernel/NamedRange.h" +#include "GaudiKernel/System.h" #include <type_traits> @@ -91,6 +92,14 @@ class DataObjectHandle : public DataObjectHandleBase { public: using DataObjectHandleBase::DataObjectHandleBase; + DataObjectHandle( const DataObjID& k, Gaudi::DataHandle::Mode a, IDataHandleHolder* owner ) + : DataObjectHandleBase( k, a, owner ) { + m_typeID = System::typeinfoName( typeid( T ) ); + } + DataObjectHandle( const std::string& k, Gaudi::DataHandle::Mode a, IDataHandleHolder* owner ) + : DataObjectHandle( DataObjID( k ), a, owner ) {} + + /** * Retrieve object from transient data store */ diff --git a/GaudiKernel/GaudiKernel/DataObjectHandleBase.h b/GaudiKernel/GaudiKernel/DataObjectHandleBase.h index bfe55adeef5d06f91137657b363137ed9194ca1f..0ed04055069c5bc9d5686b9caf2fbe841bc0c200 100644 --- a/GaudiKernel/GaudiKernel/DataObjectHandleBase.h +++ b/GaudiKernel/GaudiKernel/DataObjectHandleBase.h @@ -78,6 +78,7 @@ protected: bool m_optional = false; bool m_wasRead = false; bool m_wasWritten = false; + std::string m_typeID = "UNKNOWN"; /** * Whether the search part of the fetch method (so dealing with alt names diff --git a/GaudiKernel/python/GaudiKernel/DataObjectHandleBase.py b/GaudiKernel/python/GaudiKernel/DataObjectHandleBase.py index d5055ca4039b51a01fcda487133ae2f569aa0b03..73cd0f1dc20230acca2d828e9bcd10545e1eba59 100644 --- a/GaudiKernel/python/GaudiKernel/DataObjectHandleBase.py +++ b/GaudiKernel/python/GaudiKernel/DataObjectHandleBase.py @@ -5,14 +5,15 @@ __doc__ = """The python module holding python bindings to DataObjectHandle""" class DataObjectHandleBase(object): - __slots__ = ('Path', 'Mode') + __slots__ = ('Path', 'Mode', 'TypeID') # define accessTypes - def __init__(self, path, mode): + def __init__(self, path, mode, typeID): object.__init__(self) self.Path = path self.Mode = mode + self.TypeID = typeID def __eq__(self, other): """ @@ -44,11 +45,11 @@ class DataObjectHandleBase(object): def __add__(self, other): path = ':'.join(i + other for i in self.Path.split(':')) - return DataObjectHandleBase(path, self.Mode) + return DataObjectHandleBase(path, self.Mode, self.TypeID) def __radd__(self, other): path = ':'.join(other + i for i in self.Path.split(':')) - return DataObjectHandleBase(path, self.Mode) + return DataObjectHandleBase(path, self.Mode, self.TypeID) def __iadd__(self, other): self.Path = ':'.join(i + other for i in self.Path.split(':')) @@ -56,3 +57,6 @@ class DataObjectHandleBase(object): def mode(self): return self.Mode + + def typeID(self): + return self.TypeID diff --git a/GaudiKernel/python/GaudiKernel/PropertyProxy.py b/GaudiKernel/python/GaudiKernel/PropertyProxy.py index 73fa811b83fb902330098c20bbf7569dce1d84fd..9b10ec08c693f4f8fad711f95156dbee007ff51b 100644 --- a/GaudiKernel/python/GaudiKernel/PropertyProxy.py +++ b/GaudiKernel/python/GaudiKernel/PropertyProxy.py @@ -408,10 +408,11 @@ class DataObjectHandleBasePropertyProxy(PropertyProxy): value = '' mode = obj.__class__.getDefaultProperty(self.descr.__name__).mode() + typeid = obj.__class__.getDefaultProperty(self.descr.__name__).typeID() if type(value) == str: - return DataObjectHandleBase(value, mode) + return DataObjectHandleBase(value, mode, typeid) elif isinstance(value, DataObjectHandleBase): - return DataObjectHandleBase(value.__str__(), mode) + return DataObjectHandleBase(value.__str__(), mode, typeid) else: raise ValueError("received an instance of %s, but %s expected" % (type(value), 'str or DataObjectHandleBase')) diff --git a/GaudiKernel/src/Lib/DataObjectHandleBase.cpp b/GaudiKernel/src/Lib/DataObjectHandleBase.cpp index a05e6b7ab57cb9ba95fb8d2a558e1d455a1f9bfe..c8c1c34b74cb36574e71a5067247ff0b0b2b06ef 100644 --- a/GaudiKernel/src/Lib/DataObjectHandleBase.cpp +++ b/GaudiKernel/src/Lib/DataObjectHandleBase.cpp @@ -21,6 +21,7 @@ DataObjectHandleBase::DataObjectHandleBase( DataObjectHandleBase&& other ) , m_optional( other.m_optional ) , m_wasRead( other.m_wasRead ) , m_wasWritten( other.m_wasWritten ) + , m_typeID( other.m_typeID ) , m_searchDone( other.m_searchDone ) { m_owner->declare( *this ); } @@ -37,6 +38,7 @@ DataObjectHandleBase& DataObjectHandleBase::operator=( const DataObjectHandleBas m_optional = other.m_optional; m_wasRead = other.m_wasRead; m_wasWritten = other.m_wasWritten; + m_typeID = other.m_typeID; m_searchDone = other.m_searchDone; return *this; } @@ -122,7 +124,7 @@ std::string DataObjectHandleBase::pythonRepr() const { m = "RW"; break; } - return "DataObjectHandleBase(\"" + toString() + "\", \"" + m + "\")"; + return "DataObjectHandleBase(\"" + toString() + "\", \"" + m + "\", \"" + m_typeID + "\" )"; } //---------------------------------------------------------------------------