Platform.Data.Doublets C++
Loading...
Searching...
No Matches
LinksInnerReferenceExistenceValidator.h
Go to the documentation of this file.
2{
3 template <typename...>
5 template <std::integral TLinkAddress>
6 class LinksInnerReferenceExistenceValidator<TLinkAddress> : public DecoratorBase<TFacade, TDecorated>
7 {
8 public:
9 LinksInnerReferenceExistenceValidator(ILinks<TLinkAddress>& storage) : DecoratorBase(storage) {}
10
11 public:
12 TLinkAddress Each(Func<IList<TLinkAddress>, TLinkAddress> handler, const LinkType& restriction)
13 {
14 storage.EnsureInnerReferenceExists(restriction, "restriction");
15 return storage.Each(restriction, handler);
16 }
17
18 public:
19 TLinkAddress Update(const LinkType& restriction, const LinkType& substitution)
20 {
21 storage.EnsureInnerReferenceExists(restriction, "restriction");
22 storage.EnsureInnerReferenceExists(substitution, "substitution");
23 return storage.Update(restriction, substitution);
24 }
25
26 public:
27 void Delete(const LinkType& restriction)
28 {
29 auto link = restriction[_constants.IndexPart];
30 storage.EnsureLinkExists(link, "link");
31 storage.Delete(link);
32 }
33 };
34} // namespace Platform::Data::Doublets::Decorators
void Delete(const LinkType &restriction)
Definition LinksInnerReferenceExistenceValidator.h:27
TLinkAddress Each(Func< IList< TLinkAddress >, TLinkAddress > handler, const LinkType &restriction)
Definition LinksInnerReferenceExistenceValidator.h:12
LinksInnerReferenceExistenceValidator(ILinks< TLinkAddress > &storage)
Definition LinksInnerReferenceExistenceValidator.h:9
TLinkAddress Update(const LinkType &restriction, const LinkType &substitution)
Definition LinksInnerReferenceExistenceValidator.h:19
Definition LinksInnerReferenceExistenceValidator.h:4
Definition Decorators.h:4