Platform.Data.Doublets C++
Loading...
Searching...
No Matches
SynchronizedLinks.h
Go to the documentation of this file.
2{
3 template <typename...>
5 template <std::integral TLinkAddress>
7 {
8 public:
9 const LinksConstants<TLinkAddress> Constants;
10
11 public:
12 const ISynchronization* SyncRoot;
13
14 public:
15 const ILinks<TLinkAddress>* Sync;
16
17 public:
18 const ILinks<TLinkAddress>* Unsync;
19
20 public:
21 SynchronizedLinks(ILinks<TLinkAddress>& storage) : this(ReaderWriterLockSynchronization(), storage) {}
22
23 public:
24 SynchronizedLinks(ISynchronization& synchronization, ILinks<TLinkAddress>& storage)
25 {
26 SyncRoot = synchronization;
27 Sync = this;
28 Unsync = storage;
29 Constants = storage.Constants;
30 }
31
32 public:
33 TLinkAddress Count(IList<TLinkAddress>& restriction)
34 {
35 return SyncRoot.ExecuteReadOperation(restriction, Unsync.Count());
36 }
37
38 public:
39 TLinkAddress Each(Func<IList<TLinkAddress>, TLinkAddress> handler, IList<TLinkAddress>& restriction)
40 { return SyncRoot.ExecuteReadOperation(handler, restriction, (handler1, restriction1) { return Unsync.Each(restriction1, handler1)); }
41 }
42
43 public:
44 TLinkAddress Create(IList<TLinkAddress>& restriction)
45 {
46 return SyncRoot.ExecuteWriteOperation(restriction, Unsync.Create);
47 }
48
49 public:
50 TLinkAddress Update(IList<TLinkAddress>& restriction, IList<TLinkAddress>& substitution)
51 {
52 return SyncRoot.ExecuteWriteOperation(restriction, substitution, Unsync.Update);
53 }
54
55 public:
56 void Delete(IList<TLinkAddress>& restriction)
57 {
58 SyncRoot.ExecuteWriteOperation(restriction, Unsync.Delete);
59 }
60 };
61} // namespace Platform::Data::Doublets
Definition TargetMatcher.h:2