From 5a1714087ff91d2087c3d74665fd56699d24da1f Mon Sep 17 00:00:00 2001 From: tmadlener Date: Tue, 30 Jan 2024 17:43:13 +0100 Subject: [PATCH] Bring documentation up-to-date --- doc/associations.md | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/doc/associations.md b/doc/associations.md index 68717a912..161342755 100644 --- a/doc/associations.md +++ b/doc/associations.md @@ -1,5 +1,5 @@ # Associationg unrelated objects with each other -Sometimes it is necessary to build relations between objects whose datatypes are +Sometimes it is necessary to build associations between objects whose datatypes are not related via a `OneToOneRelation` or a `OneToManyRelation`. These *external relations* are called *Associations* in podio, and they are implemented as a templated version of the code that would be generated by the following yaml @@ -188,28 +188,19 @@ template using MutableAssociation = AssociationT; ``` -All podio generated datatypes have the following three public typedefs -- `DefT` yields the default type -- `MutT` yields the mutable type -- `CollT` yields the collection type - -There are corresponding template helpers to retrieve these types in -`AssocationFwd.h`. Note that these are not -[*SFINAE*](https://en.cppreference.com/w/cpp/language/sfinae) friendly. However, -since they are only used in contexts internally in non-SFINAE contexts, this -doesn't really matter. - Throught the implementation it is assumed that `FromT` and `ToT` always are the -default types. This is ensured through `static_assert`s, resp. through usage of -the aforementioned template helpers at the possible entry points. With this in -mind, effectively all mutating operations on `Association`s are defined using -SFINAE using the following template structure (taking here `setFrom` as an -example) +default handle types. This is ensured through `static_assert`s in the +`AssociationCollection` to make sure it can only be instantiated with those. The +`GetDefaultHandleType` helper templates are used to retrieve the correct type +from any `FromT` regardless of whether it is a mutable or a default handle type +With this in mind, effectively all mutating operations on `Association`s are +defined using [*SFINAE*](https://en.cppreference.com/w/cpp/language/sfinae) +using the following template structure (taking here `setFrom` as an example) ```cpp template , FromT>>> + std::is_same_v, FromT>>> void setFrom(FromU value); ```