Platform.Data.Doublets C++
Toggle main menu visibility
Loading...
Searching...
No Matches
LinksUniquenessResolver.h
Go to the documentation of this file.
1
namespace
Platform::Data::Doublets::Decorators
2
{
3
template
<
typename
TFacade,
typename
TDecorated>
4
struct
LinksUniquenessResolver
: DecoratorBase<TFacade, TDecorated>
5
{
6
public
:
7
using
base
= DecoratorBase<TFacade, TDecorated>;
8
using
base::Constants;
9
using
typename base::LinkAddressType;
10
using
typename base::LinkType;
11
using
typename base::ReadHandlerType;
12
using
typename base::WriteHandlerType;
13
14
public
:
15
USE_ALL_BASE_CONSTRUCTORS
(
LinksUniquenessResolver
,
base
);
16
17
public
:
18
LinkAddressType
Update
(
const
LinkType& restriction,
const
LinkType& substitution,
19
const
WriteHandlerType& handler)
20
{
21
auto
newLinkAddress =
SearchOrDefault
(this->decorated(), substitution[Constants.SourcePart],
22
substitution[Constants.TargetPart]);
23
if
(newLinkAddress == LinkAddressType{})
24
{
25
return
this->decorated().TDecorated::Update(restriction, substitution, handler);
26
}
27
return
this->
ResolveAddressChangeConflict
(restriction[Constants.IndexPart], newLinkAddress, handler);
28
}
29
30
public
:
31
LinkAddressType
ResolveAddressChangeConflict
(LinkAddressType oldLinkAddress, LinkAddressType newLinkAddress,
32
const
WriteHandlerType& handler)
33
{
34
if
(oldLinkAddress != newLinkAddress && Exists(this->decorated(), oldLinkAddress))
35
{
36
this->facade().Delete(LinkType{oldLinkAddress}, handler);
37
}
38
return
Constants.Continue;
39
}
40
};
41
}
// namespace Platform::Data::Doublets::Decorators
Platform::Data::Doublets::Decorators
Definition
Decorators.h:4
Platform::Data::Doublets::SearchOrDefault
TStorage::LinkAddressType SearchOrDefault(TStorage &storage, typename TStorage::LinkAddressType source, typename TStorage::LinkAddressType target)
Definition
ILinksExtensions.h:471
Platform::Data::Doublets::Decorators::LinksUniquenessResolver
Definition
LinksUniquenessResolver.h:5
Platform::Data::Doublets::Decorators::LinksUniquenessResolver::base
DecoratorBase< TFacade, TDecorated > base
Definition
LinksUniquenessResolver.h:7
Platform::Data::Doublets::Decorators::LinksUniquenessResolver::Update
LinkAddressType Update(const LinkType &restriction, const LinkType &substitution, const WriteHandlerType &handler)
Definition
LinksUniquenessResolver.h:18
Platform::Data::Doublets::Decorators::LinksUniquenessResolver::ResolveAddressChangeConflict
LinkAddressType ResolveAddressChangeConflict(LinkAddressType oldLinkAddress, LinkAddressType newLinkAddress, const WriteHandlerType &handler)
Definition
LinksUniquenessResolver.h:31
Platform::Data::Doublets::Decorators::LinksUniquenessResolver::USE_ALL_BASE_CONSTRUCTORS
USE_ALL_BASE_CONSTRUCTORS(LinksUniquenessResolver, base)
cpp
Platform.Data.Doublets
Decorators
LinksUniquenessResolver.h
Generated by
1.18.0