Class podio::LinkT
-
template<typename FromT, typename ToT, bool Mutable>
class LinkT Generalized Link type for both Mutable and immutable (default) versions.
User facing classes with the expected naming scheme are defined via template aliases in LinkFwd.h
Public Types
-
using mutable_type = podio::MutableLink<FromT, ToT>
-
using collection_type = podio::LinkCollection<FromT, ToT>
Public Functions
-
inline LinkT()
Constructor.
-
inline LinkT(float weight)
Constructor with weight.
- template<typename FromU, typename ToU> inline &&sameTypes< FromU, ToU > operator LinkT< FromU, ToU, false > () const
Implicit conversion of mutable to immutable links.
-
template<typename FromU = FromT, typename ToU = ToT>
inline MutableLink<FromU, ToU> clone(bool cloneRelations = true) const Create a mutable deep-copy.
- Parameters:
cloneRelations – if set to false only the weight will be cloned but not the relations to the objects this link points to. Defaults to true
- Returns:
A mutable deep-copy of this link which is independent of the original one
-
~LinkT() = default
Destructor.
-
inline float getWeight() const
Get the weight of the link.
-
template<typename FromU>
inline void setFrom(FromU value) Set the related-from object.
Note
All setFrom overloads are equivalent and the correct one is selected at compile time. We need to differentiate between the handles, only to make the python bindings work
-
template<typename FromU>
inline void setFrom(FromU value) Set the related-from object.
Note
All setFrom overloads are equivalent and the correct one is selected at compile time. We need to differentiate between the handles, only to make the python bindings work
-
template<typename FromU>
inline void setFrom(FromU value) Set the related-from object.
Note
All setFrom overloads are equivalent and the correct one is selected at compile time. We need this overload to allow for an implicit conversion to interface types in case the relation contains an interface type.
-
template<typename ToU>
inline void setTo(ToU value) Set the related-to object.
Note
All setTo overloads are equivalent and the correct one is selected at compile time. We need to differentiate between the handles, only to make the python bindings work
-
template<typename ToU>
inline void setTo(ToU value) Set the related-to object.
Note
All setTo overloads are equivalent and the correct one is selected at compile time. We need to differentiate between the handles, only to make the python bindings work
-
template<typename ToU>
inline void setTo(ToU value) Set the related-to object.
Note
All setTo overloads are equivalent and the correct one is selected at compile time. We need this overload to allow for an implicit conversion to interface types in case the relation contains an interface type.
-
template<typename T>
inline T get() const Templated version for getting an element of the link by type.
Only available for Links where FromT and ToT are not the same type, and if the requested type is actually part of the Link. It is only possible to get the immutable types from this. Will result in a compilation error if any of these conditions is not met.
- Template Parameters:
T – the desired type
- Returns:
T the element of the Link
-
template<size_t Index>
inline auto get() const Tuple like index based access to the elements of the Link.
Returns only immutable types of the links. This method enables structured bindings for Links.
- Template Parameters:
Index – an index (smaller than 3) to access an element of the Link
- Returns:
Depending on the value of Index:
0: The From element of the Link
1: The To element of the Link
2: The weight of the Link
-
template<typename T>
inline void set(T value) Templated version for setting an element of the link by type.
Only available for Links where FromT and ToT are not the same type, and if the requested type is actually part of the Link. Will result in a compilation error if any of these conditions is not met.
- Template Parameters:
T – type of value (inferred!)
- Parameters:
value – the element to set for this link.
-
inline bool isAvailable() const
check whether the object is actually available
-
inline void unlink()
disconnect from Link instance
-
template<typename FromU, typename ToU>
inline bool operator==(const LinkT<FromU, ToU, !Mutable> &other) const
Public Static Functions
Public Static Attributes
-
static std::string_view typeName = utils::static_concatenate_v<detail::link_name_prefix, FromT::typeName, detail::link_name_infix, ToT::typeName, detail::link_name_suffix>
-
using mutable_type = podio::MutableLink<FromT, ToT>