Platform.Data.Doublets C++
Toggle main menu visibility
Loading...
Searching...
No Matches
PropertiesOperator.h
Go to the documentation of this file.
1
namespace
Platform::Data::Doublets::PropertyOperators
2
{
3
template
<
typename
...>
4
class
PropertiesOperator
;
5
template
<std::
int
egral TLinkAddress>
6
class
PropertiesOperator<TLinkAddress>
:
public
LinksOperatorBase<TLinkAddress>,
7
IProperties<TLinkAddress, TLinkAddress, TLinkAddress>
8
{
9
public
:
10
PropertiesOperator
(ILinks<TLinkAddress>& storage) : base(storage) {}
11
12
public
:
13
TLinkAddress
GetValue
(
TLinkAddress
object
,
TLinkAddress
property)
14
{
15
auto
storage = _links;
16
auto
objectProperty = storage.SearchOrDefault(
object
, property);
17
if
(objectProperty == 0)
18
{
19
return
0;
20
}
21
constexpr
auto
constants = std::remove_cvref_t<
decltype
(storage)>::Constants;
22
auto
any = constants.Any;
23
auto
query =
Link<TLinkAddress>
(any, objectProperty, any);
24
auto
valueLink = storage.SingleOrDefault(query);
25
if
(valueLink ==
nullptr
)
26
{
27
return
0;
28
}
29
return
storage.GetTarget(valueLink[constants.IndexPart]);
30
}
31
32
public
:
33
void
SetValue
(
TLinkAddress
object
,
TLinkAddress
property,
TLinkAddress
value)
34
{
35
auto
storage = _links;
36
auto
objectProperty = storage.GetOrCreate(
object
, property);
37
storage.DeleteMany(storage.AllIndices(storage.Constants.Any, objectProperty));
38
storage.GetOrCreate(objectProperty, value);
39
}
40
};
41
}
// namespace Platform::Data::Doublets::PropertyOperators
TLinkAddress
std::uint32_t TLinkAddress
Definition
UInt32Links.h:3
Platform::Data::Doublets::PropertyOperators::PropertiesOperator< TLinkAddress >::SetValue
void SetValue(TLinkAddress object, TLinkAddress property, TLinkAddress value)
Definition
PropertiesOperator.h:33
Platform::Data::Doublets::PropertyOperators::PropertiesOperator< TLinkAddress >::GetValue
TLinkAddress GetValue(TLinkAddress object, TLinkAddress property)
Definition
PropertiesOperator.h:13
Platform::Data::Doublets::PropertyOperators::PropertiesOperator< TLinkAddress >::PropertiesOperator
PropertiesOperator(ILinks< TLinkAddress > &storage)
Definition
PropertiesOperator.h:10
Platform::Data::Doublets::PropertyOperators::PropertiesOperator
Definition
PropertiesOperator.h:4
Platform::Data::Doublets::PropertyOperators
Definition
PropertiesOperator.h:2
Platform::Data::Doublets::Link::Link
Link() noexcept=default
cpp
Platform.Data.Doublets
PropertyOperators
PropertiesOperator.h
Generated by
1.18.0