1 #ifndef GAUDIKERNEL_IINSPECTOR_H
2 #define GAUDIKERNEL_IINSPECTOR_H
9 #include "GaudiKernel/IInterface.h"
20 enum { MUTABLE = 1<<1, CONST = 1<<2};
31 virtual ~IValue() =
default;
32 virtual void release() {
delete this; }
33 void* ptr() {
return m_P; }
34 const void* ptr()
const {
return m_P; }
35 virtual long size()
const = 0;
36 virtual void construct(
void* buffer)
const = 0;
43 const std::type_info&
second;
44 Tag(
long f,
const std::type_info&
s) : first(f), second(s) { }
50 template <
class T>
class _V :
public IValue {
53 _V(
const T& v) : m_O(v) { m_P = &m_O; }
54 virtual ~_V() =
default;
55 virtual long size()
const {
return sizeof(T); }
56 virtual void construct(
void* b)
const { ::new(b) T(); }
62 public: _TT() : Tag(sizeof(T), typeid(T)) { }
68 virtual StatusCode inspectByRef(
const void* pObj,
const Tag& typ,
void* pOwner,
const Tag& otag,
const std::string& comment,
long flag) = 0;
70 virtual StatusCode inspectByValue(IValue* pObj,
const Tag& typ,
void* pOwner,
const Tag& oTag,
const std::string& comment) = 0;
72 virtual StatusCode inspectContByRef(
const void* pObj,
const Tag& tag,
const Tag& rtag,
const Tag& vtag,
const void* pOwner,
const Tag& otag,
const std::string& comment,
long flags) = 0;
74 virtual StatusCode inspectContByValue(IValue* pObj,
const Tag& tag,
const Tag& rtag,
const Tag& vtag,
const void* pOwner,
const Tag& otag,
const std::string& comment) = 0;
79 template <
class T,
class O >
80 StatusCode inspectByRef(
const T* pObj,
const O* pOwner,
const std::string& comment,
long flag=MUTABLE) {
81 return inspectByRef(pObj, _TT<T>(), (
void*)pOwner, _TT<O>(), comment, flag);
84 template <
class T,
class O >
85 StatusCode inspectByValue(
const T& obj,
const O* pOwner,
const std::string& comment) {
86 return inspectByValue(
new _V<T>(obj), _TT<T>(), (
void*)pOwner, _TT<O>(), comment);
89 template <
class T,
class O >
90 StatusCode inspectContByRef(
const T* pObj,
const O* pOwner,
const std::string& comment,
long flag=MUTABLE) {
91 typedef typename T::value_type _VVV;
92 typedef typename T::value_type _TTT;
95 return inspectContByRef((
void*)pObj, _TT<T>(), _TT<_VVV>(), _TT<_TTT>(), (
void*)pOwner, _TT<O>(), comment, flag);
98 template <
class T,
class O >
99 StatusCode inspectContByValue(
const T& obj,
const O* pOwner,
const std::string& comment) {
100 typedef typename T::value_type _VVV;
101 typedef typename T::value_type _TTT;
104 return inspectContByValue(
new _V<T>(obj), _TT<T>(), _TT<_VVV>(), _TT<_TTT>(), (
void*)pOwner, _TT<O>(), comment);
107 #endif // GAUDIKERNEL_IINSPECTOR_H
#define DeclareInterfaceID(iface, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.