Gaudi Framework, version v23r6
Home
Generated: Wed Jan 30 2013
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
GaudiKernel
src
Lib
SmartRefBase.cpp
Go to the documentation of this file.
1
// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/src/Lib/SmartRefBase.cpp,v 1.8 2005/05/10 12:24:16 hmd Exp $
2
// ====================================================================
3
// SmartRefBase.cpp
4
// --------------------------------------------------------------------
5
//
6
// Package : Root conversion example
7
//
8
// Author : Markus Frank
9
//
10
// ====================================================================
11
#define KERNEL_SMARTREFBASE_CPP 1
12
// $Header: /tmp/svngaudi/tmp.jEpFh25751/Gaudi/GaudiKernel/src/Lib/SmartRefBase.cpp,v 1.8 2005/05/10 12:24:16 hmd Exp $
13
14
// Framework include files
15
#include "
GaudiKernel/IDataProviderSvc.h
"
16
#include "
GaudiKernel/GaudiException.h
"
17
#include "
GaudiKernel/IRegistry.h
"
18
#include "
GaudiKernel/DataObject.h
"
19
#include "
GaudiKernel/LinkManager.h
"
20
#include "
GaudiKernel/StreamBuffer.h
"
21
#include "
GaudiKernel/SmartRefBase.h
"
22
#include "
GaudiKernel/ContainedObject.h
"
23
#include "
GaudiKernel/ObjectContainerBase.h
"
24
25
typedef
ObjectContainerBase
_Container
;
26
28
void
SmartRefBase::set
(
DataObject
* pObj,
long
hint_id,
long
link_id) {
29
m_data
= pObj;
30
m_hintID
= hint_id;
31
m_linkID
= link_id;
32
}
33
35
const
ContainedObject
*
SmartRefBase::accessData
(
const
ContainedObject
*)
const
{
36
if
(
m_hintID
!=
StreamBuffer::INVALID
&&
m_linkID
!=
StreamBuffer::INVALID
) {
37
const
_Container
* cnt =
dynamic_cast<
const
_Container
*
>
(
accessData
(
m_data
));
38
if
( 0 != cnt ) {
39
return
cnt->
containedObject
(
m_linkID
);
40
}
41
}
42
return
0;
43
}
44
46
const
DataObject
*
SmartRefBase::accessData
(
const
DataObject
*)
const
{
47
DataObject
* target = 0;
48
DataObject
* source =0;
49
if
( 0 ==
m_data
&& 0 !=
m_contd
) {
50
m_data
=
m_contd
->
parent
();
51
}
52
source =
const_cast<
DataObject
*
>
(
m_data
);
53
if
(
m_hintID
!=
StreamBuffer::INVALID
&& source != 0 ) {
54
LinkManager
* mgr = source->
linkMgr
();
55
if
( 0 != mgr ) {
56
LinkManager::Link
* link = mgr->
link
(
m_hintID
);
57
if
( 0 != link ) {
58
target = link->
object
();
59
if
( 0 == target ) {
60
IRegistry
* reg = source->
registry
();
61
if
( 0 != reg ) {
62
IDataProviderSvc
* datasvc = reg->
dataSvc
();
63
if
( 0 != datasvc ) {
64
if
( datasvc->
retrieveObject
(link->
path
(), target).isSuccess() ) {
65
link->
setObject
(target);
66
}
67
}
68
}
69
}
70
}
71
}
72
}
73
return
target;
74
}
75
76
// Extended equality check
77
bool
SmartRefBase::isEqualEx
(
const
DataObject
* pObj,
const
SmartRefBase
&
c
)
const
{
78
if
( c.
m_hintID
!=
StreamBuffer::INVALID
&& 0 != pObj ) {
79
DataObject
* source =
const_cast<
DataObject
*
>
(c.
m_data
);
80
if
( 0 != source ) {
81
LinkManager
* mgr = source->
linkMgr
();
82
if
( 0 != mgr ) {
83
LinkManager::Link
* link = mgr->
link
(c.
m_hintID
);
84
if
( 0 != link ) {
85
IRegistry
* pReg = pObj->
registry
();
86
if
( pReg != 0 ) {
87
return
link->
path
() == pReg->
identifier
();
88
}
89
}
90
}
91
}
92
}
93
return
false
;
94
}
95
96
// Extended equality check
97
bool
SmartRefBase::isEqualEx
(
const
ContainedObject
* pObj,
const
SmartRefBase
&
c
)
const
{
98
if
(
isEqualEx
(pObj->
parent
(),
c
) ) {
99
return
pObj->
index
() == c.
m_linkID
;
100
}
101
return
false
;
102
}
103
104
const
std::string
&
SmartRefBase::path
()
const
{
105
static
std::string
s_empty_string =
std::string
();
106
DataObject
*source = 0;
107
if
( 0 ==
m_data
&& 0 !=
m_contd
) {
108
m_data
=
m_contd
->
parent
();
109
}
110
source =
const_cast<
DataObject
*
>
(
m_data
);
111
if
(
m_hintID
!=
StreamBuffer::INVALID
&& source != 0 ) {
112
LinkManager
* mgr = source->
linkMgr
();
113
if
( 0 != mgr ) {
114
LinkManager::Link
* link = mgr->
link
(
m_hintID
);
115
if
( 0 != link )
116
return
link->
path
();
117
}
118
}
119
return
s_empty_string;
120
}
Generated at Wed Jan 30 2013 17:13:40 for Gaudi Framework, version v23r6 by
Doxygen
version 1.8.2 written by
Dimitri van Heesch
, © 1997-2004