2 #ifndef GAUDIKERNEL_IINSPECTOR_H
3 #define GAUDIKERNEL_IINSPECTOR_H
10 #include "GaudiKernel/IInterface.h"
21 enum { MUTABLE = 1<<1, CONST = 1<<2};
33 virtual void release() {
delete this; }
34 void* ptr() {
return m_P; }
35 const void* ptr()
const {
return m_P; }
36 virtual long size()
const = 0;
37 virtual void construct(
void* buffer)
const = 0;
45 const std::type_info&
second;
46 Tag(
long f,
const std::type_info&
s) : first(f), second(s) { }
47 Tag(
const Tag& t) : first(t.first), second(t.second) { }
53 template <
class T>
class _V :
public IValue {
56 _V(
const T& v) : m_O(v) { m_P = &m_O; }
58 virtual long size()
const {
return sizeof(T); }
59 void construct(
void* b)
const { ::new(b) T(); }
65 public: _TT() : Tag(sizeof(T), typeid(T)) { }
71 virtual StatusCode inspectByRef(
const void* pObj,
const Tag& typ,
void* pOwner,
const Tag& otag,
const std::string& comment,
long flag) = 0;
73 virtual StatusCode inspectByValue(IValue* pObj,
const Tag& typ,
void* pOwner,
const Tag& oTag,
const std::string& comment) = 0;
75 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;
77 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;
82 template <
class T,
class O >
83 StatusCode inspectByRef(
const T* pObj,
const O* pOwner,
const std::string& comment,
long flag=MUTABLE) {
84 return inspectByRef(pObj, _TT<T>(), (
void*)pOwner, _TT<O>(), comment, flag);
87 template <
class T,
class O >
88 StatusCode inspectByValue(
const T& obj,
const O* pOwner,
const std::string& comment) {
89 return inspectByValue(
new _V<T>(obj), _TT<T>(), (
void*)pOwner, _TT<O>(), comment);
92 template <
class T,
class O >
93 StatusCode inspectContByRef(
const T* pObj,
const O* pOwner,
const std::string& comment,
long flag=MUTABLE) {
94 typedef typename T::value_type _VVV;
95 typedef typename T::value_type _TTT;
98 return inspectContByRef((
void*)pObj, _TT<T>(), _TT<_VVV>(), _TT<_TTT>(), (
void*)pOwner, _TT<O>(), comment, flag);
101 template <
class T,
class O >
102 StatusCode inspectContByValue(
const T& obj,
const O* pOwner,
const std::string& comment) {
103 typedef typename T::value_type _VVV;
104 typedef typename T::value_type _TTT;
107 return inspectContByValue(
new _V<T>(obj), _TT<T>(), _TT<_VVV>(), _TT<_TTT>(), (
void*)pOwner, _TT<O>(), comment);
110 #endif // GAUDIKERNEL_IINSPECTOR_H
This class is used for returning status codes from appropriate routines.
Definition of the basic interface.
#define DeclareInterfaceID(name, major, minor)
Macro to declare the interface ID when using the new mechanism of extending and implementing interfac...