File Link.h
-
namespace podio
Functions
-
template<typename FromT, typename ToT, bool Mutable>
class LinkT - #include <podio/detail/Link.h>
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.
-
LinkT(const LinkT &other) = default
Copy constructor.
- 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<bool Mut = Mutable>
inline void setWeight(float value) Set the weight of the link.
-
inline const FromT getFrom() const
Access the related-from object.
-
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.
-
inline const ToT getTo() const
Access the related-to object.
-
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
-
inline bool operator==(const LinkT &other) const
-
inline bool operator!=(const LinkT &other) const
-
template<typename FromU, typename ToU>
inline bool operator==(const LinkT<FromU, ToU, !Mutable> &other) const
-
template<typename FromU, typename ToU>
inline bool operator!=(const LinkT<FromU, ToU, !Mutable> &other) const
-
inline bool operator<(const LinkT &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>
Private Functions
Constructor from existing LinkObj.
Private Members
- friend LinkCollection< FromT, ToT >
- friend LinkCollectionIteratorT< FromT, ToT, Mutable >
- friend LinkT< FromT, ToT, !Mutable >
-
podio::utils::MaybeSharedPtr<LinkObjT> m_obj = {nullptr}
Private Static Attributes
-
template<typename FromU, typename ToU>
static bool sameTypes = std::is_same_v<FromU, FromT> && std::is_same_v<ToU, ToT> Helper member variable to check whether FromU and ToU can be used for this Link.
We need this to make SFINAE trigger in some cases below
-
using mutable_type = podio::MutableLink<FromT, ToT>
-
template<typename FromT, typename ToT, bool Mutable>