Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Gaudi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gaudi
Gaudi
Commits
f6a15627
Commit
f6a15627
authored
1 year ago
by
Marco Clemencic
Browse files
Options
Downloads
Plain Diff
cleanup of SmartRef
See merge request
!1512
parents
b9abf6ff
5cd82f49
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1512
cleanup of SmartRef
Pipeline
#6445200
passed
1 year ago
Stage: test
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
GaudiKernel/dict/dictionary.h
+62
-62
62 additions, 62 deletions
GaudiKernel/dict/dictionary.h
GaudiKernel/include/GaudiKernel/SmartRef.h
+20
-38
20 additions, 38 deletions
GaudiKernel/include/GaudiKernel/SmartRef.h
with
82 additions
and
100 deletions
GaudiKernel/dict/dictionary.h
+
62
−
62
View file @
f6a15627
...
...
@@ -106,69 +106,69 @@
#include
"GaudiKernel/Incident.h"
namespace
GaudiKernelDict
{
struct
__Instantiations
:
public
KeyedObject
<
int
>
,
public
KeyedObject
<
unsigned
int
>
,
public
KeyedObject
<
long
>
,
public
KeyedObject
<
unsigned
long
>
,
public
SmartRef
<
DataObject
>
,
public
SmartRef
<
ContainedObject
>
,
public
SmartRef
<
ObjectContainerBase
>
,
public
SmartRef
<
KeyedObject
<
int
>>
,
public
SmartRef
<
KeyedObject
<
unsigned
int
>>
,
public
SmartRef
<
KeyedObject
<
long
>>
,
public
SmartRef
<
KeyedObject
<
unsigned
long
>>
,
public
SmartRefVector
<
DataObject
>
,
public
SmartRefVector
<
ContainedObject
>
,
public
SmartRefVector
<
ObjectContainerBase
>
,
public
SmartRefVector
<
KeyedObject
<
int
>>
,
public
SmartRefVector
<
KeyedObject
<
unsigned
int
>>
,
public
SmartRefVector
<
KeyedObject
<
long
>>
,
public
SmartRefVector
<
KeyedObject
<
unsigned
long
>>
,
// public std::vector<SmartRef<ContainedObject> >,
// public std::vector<SmartRef<DataObject> >,
// public std::vector<SmartRef<ObjectContainerBase> >,
public
std
::
vector
<
LinkManager
::
Link
*>
,
public
std
::
vector
<
const
ContainedObject
*>
,
public
std
::
vector
<
ContainedObject
*>
{
NTuple
::
Item
<
bool
>
BoolItem
;
NTuple
::
Item
<
char
>
CharItem
;
NTuple
::
Item
<
unsigned
char
>
UCharItem
;
NTuple
::
Item
<
short
>
ShortItem
;
NTuple
::
Item
<
unsigned
short
>
UShortItem
;
NTuple
::
Item
<
long
>
LongItem
;
NTuple
::
Item
<
long
long
>
LongLongItem
;
NTuple
::
Item
<
unsigned
long
>
ULongItem
;
NTuple
::
Item
<
unsigned
long
long
>
ULongLongItem
;
NTuple
::
Item
<
int
>
IntItem
;
NTuple
::
Item
<
unsigned
int
>
UIntItem
;
NTuple
::
Item
<
float
>
FloatItem
;
NTuple
::
Item
<
double
>
DoubleItem
;
NTuple
::
Array
<
bool
>
BoolArray
;
NTuple
::
Array
<
char
>
CharArray
;
NTuple
::
Array
<
unsigned
char
>
UCharArray
;
NTuple
::
Array
<
short
>
ShortArray
;
NTuple
::
Array
<
unsigned
short
>
UShortArray
;
NTuple
::
Array
<
long
>
LongArray
;
NTuple
::
Array
<
unsigned
long
>
ULongArray
;
NTuple
::
Array
<
int
>
IntArray
;
NTuple
::
Array
<
unsigned
int
>
UIntArray
;
NTuple
::
Array
<
float
>
FloatArray
;
NTuple
::
Array
<
double
>
DoubleArray
;
NTuple
::
Matrix
<
bool
>
BoolMatrix
;
NTuple
::
Matrix
<
char
>
CharMatrix
;
NTuple
::
Matrix
<
unsigned
char
>
UCharMatrix
;
NTuple
::
Matrix
<
short
>
ShortMatrix
;
NTuple
::
Matrix
<
unsigned
short
>
UShortMatrix
;
NTuple
::
Matrix
<
long
>
LongMatrix
;
NTuple
::
Matrix
<
unsigned
long
>
ULongMatrix
;
NTuple
::
Matrix
<
int
>
IntMatrix
;
NTuple
::
Matrix
<
unsigned
int
>
UIntMatrix
;
NTuple
::
Matrix
<
float
>
FloatMatrix
;
NTuple
::
Matrix
<
double
>
DoubleMatrix
;
struct
__Instantiations
{
KeyedObject
<
int
>
m_1
;
KeyedObject
<
unsigned
int
>
m_2
;
KeyedObject
<
long
>
m_3
;
KeyedObject
<
unsigned
long
>
m_4
;
SmartRef
<
DataObject
>
m_5
;
SmartRef
<
ContainedObject
>
m_6
;
SmartRef
<
ObjectContainerBase
>
m_7
;
SmartRef
<
KeyedObject
<
int
>>
m_8
;
SmartRef
<
KeyedObject
<
unsigned
int
>>
m_9
;
SmartRef
<
KeyedObject
<
long
>>
m_10
;
SmartRef
<
KeyedObject
<
unsigned
long
>>
m_11
;
SmartRefVector
<
DataObject
>
m_12
;
SmartRefVector
<
ContainedObject
>
m_13
;
SmartRefVector
<
ObjectContainerBase
>
m_14
;
SmartRefVector
<
KeyedObject
<
int
>>
m_15
;
SmartRefVector
<
KeyedObject
<
unsigned
int
>>
m_16
;
SmartRefVector
<
KeyedObject
<
long
>>
m_17
;
SmartRefVector
<
KeyedObject
<
unsigned
long
>>
m_18
;
// std::vector<SmartRef<ContainedObject> > m_19;
// std::vector<SmartRef<DataObject> > m_20;
// std::vector<SmartRef<ObjectContainerBase> > m_21;
std
::
vector
<
LinkManager
::
Link
*>
m_22
;
std
::
vector
<
const
ContainedObject
*>
m_23
;
std
::
vector
<
ContainedObject
*>
m_24
;
NTuple
::
Item
<
bool
>
BoolItem
;
NTuple
::
Item
<
char
>
CharItem
;
NTuple
::
Item
<
unsigned
char
>
UCharItem
;
NTuple
::
Item
<
short
>
ShortItem
;
NTuple
::
Item
<
unsigned
short
>
UShortItem
;
NTuple
::
Item
<
long
>
LongItem
;
NTuple
::
Item
<
long
long
>
LongLongItem
;
NTuple
::
Item
<
unsigned
long
>
ULongItem
;
NTuple
::
Item
<
unsigned
long
long
>
ULongLongItem
;
NTuple
::
Item
<
int
>
IntItem
;
NTuple
::
Item
<
unsigned
int
>
UIntItem
;
NTuple
::
Item
<
float
>
FloatItem
;
NTuple
::
Item
<
double
>
DoubleItem
;
NTuple
::
Array
<
bool
>
BoolArray
;
NTuple
::
Array
<
char
>
CharArray
;
NTuple
::
Array
<
unsigned
char
>
UCharArray
;
NTuple
::
Array
<
short
>
ShortArray
;
NTuple
::
Array
<
unsigned
short
>
UShortArray
;
NTuple
::
Array
<
long
>
LongArray
;
NTuple
::
Array
<
unsigned
long
>
ULongArray
;
NTuple
::
Array
<
int
>
IntArray
;
NTuple
::
Array
<
unsigned
int
>
UIntArray
;
NTuple
::
Array
<
float
>
FloatArray
;
NTuple
::
Array
<
double
>
DoubleArray
;
NTuple
::
Matrix
<
bool
>
BoolMatrix
;
NTuple
::
Matrix
<
char
>
CharMatrix
;
NTuple
::
Matrix
<
unsigned
char
>
UCharMatrix
;
NTuple
::
Matrix
<
short
>
ShortMatrix
;
NTuple
::
Matrix
<
unsigned
short
>
UShortMatrix
;
NTuple
::
Matrix
<
long
>
LongMatrix
;
NTuple
::
Matrix
<
unsigned
long
>
ULongMatrix
;
NTuple
::
Matrix
<
int
>
IntMatrix
;
NTuple
::
Matrix
<
unsigned
int
>
UIntMatrix
;
NTuple
::
Matrix
<
float
>
FloatMatrix
;
NTuple
::
Matrix
<
double
>
DoubleMatrix
;
SmartDataPtr
<
DataObject
>
p1
;
SmartDataPtr
<
ObjectContainerBase
>
p2
;
__Instantiations
()
:
p1
(
0
,
""
),
p2
(
0
,
""
)
{}
SmartDataPtr
<
DataObject
>
p1
{
0
,
""
};
SmartDataPtr
<
ObjectContainerBase
>
p2
{
0
,
""
};
};
}
// namespace GaudiKernelDict
...
...
This diff is collapsed.
Click to expand it.
GaudiKernel/include/GaudiKernel/SmartRef.h
+
20
−
38
View file @
f6a15627
...
...
@@ -73,42 +73,27 @@ class SmartRefMap;
Version: 1.0
*/
template
<
class
TYPE
>
class
SmartRef
{
class
SmartRef
final
{
/// The container must be a friend
friend
class
SmartRefArray
<
TYPE
>
;
friend
class
SmartRefList
<
TYPE
>
;
friend
class
SmartRefMap
<
TYPE
>
;
public:
enum
{
VALID
=
StreamBuffer
::
VALID
,
INVALID
=
StreamBuffer
::
INVALID
};
/// Entry type definition
typedef
TYPE
entry_type
;
protected
:
SmartRefBase
m_base
;
/// Pointer to target data object
mutable
const
TYPE
*
m_target
=
nullptr
;
public:
enum
{
VALID
=
StreamBuffer
::
VALID
,
INVALID
=
StreamBuffer
::
INVALID
};
/// Entry type definition
typedef
TYPE
entry_type
;
/// Standard Constructor
SmartRef
()
{
m_base
.
m_hintID
=
INVALID
;
m_base
.
m_linkID
=
INVALID
;
_setEnvironment
(
0
,
0
);
}
/// Standard Constructor with initialisation
SmartRef
(
TYPE
*
pObject
)
{
SmartRef
(
const
TYPE
*
pObject
=
nullptr
)
{
m_base
.
m_hintID
=
INVALID
;
m_base
.
m_linkID
=
INVALID
;
m_target
=
pObject
;
_setEnvironment
(
0
,
0
);
}
/// Standard Constructor with initialisation from const object
SmartRef
(
const
TYPE
*
pObject
)
{
m_base
.
m_hintID
=
INVALID
;
m_base
.
m_linkID
=
INVALID
;
m_target
=
const_cast
<
TYPE
*>
(
pObject
);
_setEnvironment
(
0
,
0
);
_setEnvironment
(
nullptr
,
nullptr
);
}
/// Copy Constructor
SmartRef
(
const
SmartRef
&
copy
)
{
...
...
@@ -118,42 +103,39 @@ public:
_setEnvironment
(
copy
.
m_base
.
m_data
,
copy
.
m_base
.
m_contd
);
}
/// Constructor
SmartRef
(
long
hint
,
long
link
,
TYPE
*
obj
=
nullptr
)
{
SmartRef
(
long
hint
,
long
link
,
const
TYPE
*
obj
=
nullptr
)
{
m_base
.
m_hintID
=
hint
;
m_base
.
m_linkID
=
link
;
m_target
=
obj
;
_setEnvironment
(
0
,
0
);
_setEnvironment
(
nullptr
,
nullptr
);
}
/// Constructor for references to contained objects passing environment
SmartRef
(
const
ContainedObject
*
pObj
,
long
hint
,
long
link
,
TYPE
*
obj
=
nullptr
)
{
SmartRef
(
const
ContainedObject
*
pObj
,
long
hint
,
long
link
,
const
TYPE
*
obj
=
nullptr
)
{
m_base
.
m_hintID
=
hint
;
m_base
.
m_linkID
=
link
;
m_target
=
obj
;
const
DataObject
*
src
=
(
0
==
pObj
)
?
0
:
pObj
->
parent
();
const
DataObject
*
src
=
(
pObj
?
pObj
->
parent
()
:
nullptr
)
;
_setEnvironment
(
src
,
pObj
);
}
/// Constructor for references to contained objects passing environment
SmartRef
(
const
DataObject
*
pObj
,
long
hint
,
long
link
,
TYPE
*
obj
=
nullptr
)
{
SmartRef
(
const
DataObject
*
pObj
,
long
hint
,
long
link
,
const
TYPE
*
obj
=
nullptr
)
{
m_base
.
m_hintID
=
hint
;
m_base
.
m_linkID
=
link
;
m_target
=
obj
;
_setEnvironment
(
pObj
,
0
);
_setEnvironment
(
pObj
,
nullptr
);
}
/// Constructor for references to DataObjects passing environment
SmartRef
(
const
DataObject
*
pObj
,
long
hint
,
TYPE
*
obj
=
nullptr
)
{
SmartRef
(
const
DataObject
*
pObj
,
long
hint
,
const
TYPE
*
obj
=
nullptr
)
{
m_base
.
m_hintID
=
hint
;
m_base
.
m_linkID
=
INVALID
;
m_target
=
obj
;
_setEnvironment
(
pObj
,
0
);
_setEnvironment
(
pObj
,
nullptr
);
}
/// Standard destructor
// virtual ~SmartRef() {
//}
/// Check if link should be followed: link must be valid and object not yet loaded
bool
shouldFollowLink
(
const
DataObject
*
/* typ */
)
const
{
return
(
!
m_target
&&
m_base
.
m_hintID
!=
INVALID
)
;
}
bool
shouldFollowLink
(
const
DataObject
*
)
const
{
return
!
m_target
&&
m_base
.
m_hintID
!=
INVALID
;
}
/// Check if link should be followed: link must be valid and object not yet loaded
bool
shouldFollowLink
(
const
ContainedObject
*
/* typ */
)
const
{
return
(
!
m_target
&&
m_base
.
m_hintID
!=
INVALID
&&
m_base
.
m_linkID
!=
INVALID
)
;
bool
shouldFollowLink
(
const
ContainedObject
*
)
const
{
return
!
m_target
&&
m_base
.
m_hintID
!=
INVALID
&&
m_base
.
m_linkID
!=
INVALID
;
}
/// Access hint id:
long
hintID
()
const
{
return
m_base
.
m_hintID
;
}
...
...
@@ -243,7 +225,7 @@ public:
return
_setEnvironment
(
c
.
m_base
.
m_data
,
c
.
m_base
.
m_contd
);
}
/// Assignment
SmartRef
<
TYPE
>&
operator
=
(
TYPE
*
pObject
)
{
SmartRef
<
TYPE
>&
operator
=
(
const
TYPE
*
pObject
)
{
m_target
=
pObject
;
m_base
.
m_hintID
=
INVALID
;
m_base
.
m_linkID
=
INVALID
;
...
...
@@ -268,7 +250,7 @@ public:
}
/// Read the reference from the stream buffer (needed due to stupid G++ compiler)
StreamBuffer
&
readRef
(
StreamBuffer
&
s
)
{
m_target
=
dynamic_cast
<
TYPE
*>
(
m_base
.
readObject
(
m_target
,
s
)
);
m_target
=
dynamic_cast
<
const
TYPE
*>
(
m_base
.
readObject
(
m_target
,
s
)
);
return
s
;
}
/// Output Streamer operator
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment