Skip to content

Commit 4aace31

Browse files
committed
Add overloads for Mutable handle calls to the navigator
Attempt for checking whether this is enough to get some parts of the LinkNavigator work more easily from the python side
1 parent 2a69481 commit 4aace31

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

include/podio/LinkNavigator.h

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ class LinkNavigator {
9595
return result;
9696
}
9797

98+
std::vector<WeightedObject<FromT>> getLinked(const ToT::mutable_type& object,
99+
podio::detail::links::ReturnFromTag) const {
100+
return getLinked(ToT(object), podio::ReturnFrom);
101+
}
102+
98103
/// Get all the *From* objects and weights that have links with the passed
99104
/// object
100105
///
@@ -111,6 +116,13 @@ class LinkNavigator {
111116
return getLinked(object, podio::ReturnFrom);
112117
}
113118

119+
/// Overload for cppyy that makes things work with mutable handles
120+
template <typename ToU = ToT>
121+
std::enable_if_t<!std::is_same_v<FromT, ToU>, std::vector<WeightedObject<FromT>>>
122+
getLinked(const ToT::mutable_type& object) const {
123+
return getLinked(ToT(object), podio::ReturnFrom);
124+
}
125+
114126
/// Get all the *To* objects and weights that have links with the passed
115127
/// object
116128
///
@@ -137,6 +149,11 @@ class LinkNavigator {
137149
return result;
138150
}
139151

152+
std::vector<WeightedObject<ToT>> getLinked(const FromT::mutable_type& object,
153+
podio::detail::links::ReturnToTag) const {
154+
return getLinked(FromT(object), podio::ReturnTo);
155+
}
156+
140157
/// Get all the *To* objects and weights that have links with the passed
141158
/// object
142159
///
@@ -153,6 +170,13 @@ class LinkNavigator {
153170
return getLinked(object, podio::ReturnTo);
154171
}
155172

173+
/// Overload for cppyy that makes things work with mutable handles
174+
template <typename FromU = FromT>
175+
std::enable_if_t<!std::is_same_v<FromU, ToT>, std::vector<WeightedObject<ToT>>>
176+
getLinked(const FromT::mutable_type& object) const {
177+
return getLinked(FromT(object), podio::ReturnTo);
178+
}
179+
156180
private:
157181
std::multimap<FromT, WeightedObject<ToT>> m_from2to{}; ///< Map the from to the to objects
158182
std::multimap<ToT, WeightedObject<FromT>> m_to2from{}; ///< Map the to to the from objects

0 commit comments

Comments
 (0)