Allow types from different data models in interfaces #714
+108
−9
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
BEGINRELEASENOTES
ENDRELEASENOTES
The data types had to be aware of interfaces in which they were used in order to make them
friend
. For instance the types from base model couldn't be made aware of types in model extension so it was impossible to define a model extension with an interface that uses types from base model. #611It seems the
friend
internal access was only used to get pointers to internal object in order to defineoperator<
(for usage with maps) by comparing addresses.In this PR I propose to remove the
friend
coupling of interfaces and data types. Instead apodio::detail::getRank
free function is added as a friend to each data type. The functions returns unsigned numeric type that can be used for comparisons. According to the standard the most appropriate type here -uintptr_t
- is optional, if it's not present thenuintmax_t
will be used as it's the biggest unsigned type so a pointer will also fit in it.I had hard time choosing a name for numeric value, that can be used for comparisons and I'm not entirely happy with calling it
rank
.Another extension model is used as the extension we had had different
getSyntax
than the base model which the interfaces can't handle.