Platform.Data.Doublets C++
Loading...
Searching...
No Matches
LinksItselfConstantToSelfReferenceResolver.h
Go to the documentation of this file.
2{
3 template <typename...>
5 template <std::integral TLinkAddress>
6 class LinksItselfConstantToSelfReferenceResolver<TLinkAddress> : public DecoratorBase<TFacade, TDecorated>
7 {
8 public:
9 LinksItselfConstantToSelfReferenceResolver(ILinks<TLinkAddress>& storage) : DecoratorBase(storage) {}
10
11 public:
12 TLinkAddress Each(Func<IList<TLinkAddress>, TLinkAddress> handler, const LinkType& restriction)
13 {
14 auto constants = _constants;
15 auto itselfConstant = constants.Itself;
16 if (!constants.Any == itselfConstant && restriction.Contains(itselfConstant))
17 {
18 return constants.Continue;
19 }
20 return this->decorated().TDecorated::Each(restriction, handler);
21 }
22
23 public:
24 TLinkAddress Update(const LinkType& restriction, const LinkType& substitution)
25 {
26 return this->decorated().TDecorated::Update(
27 restriction, this->decorated().TDecorated::ResolveConstantAsSelfReference(_constants.Itself,
28 restriction, substitution));
29 }
30 };
31} // namespace Platform::Data::Doublets::Decorators
TLinkAddress Update(const LinkType &restriction, const LinkType &substitution)
Definition LinksItselfConstantToSelfReferenceResolver.h:24
LinksItselfConstantToSelfReferenceResolver(ILinks< TLinkAddress > &storage)
Definition LinksItselfConstantToSelfReferenceResolver.h:9
TLinkAddress Each(Func< IList< TLinkAddress >, TLinkAddress > handler, const LinkType &restriction)
Definition LinksItselfConstantToSelfReferenceResolver.h:12
Definition LinksItselfConstantToSelfReferenceResolver.h:4
Definition Decorators.h:4