aboutsummaryrefslogtreecommitdiffstats
path: root/library/cpp/yt/global/mock_modules/module2_defs/test_variable.cpp
blob: 3db411bcb5aabd1fcdefaad2754f039582d9dfe7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "direct_access.h"

#include <library/cpp/yt/global/mock_modules/module2_public/test_tag.h>

#include <library/cpp/yt/global/variable.h>

namespace NYT {

////////////////////////////////////////////////////////////////////////////////

NGlobal::TErasedStorage GetGlobal2() noexcept;

NGlobal::TErasedStorage GetGlobal3() noexcept;

////////////////////////////////////////////////////////////////////////////////

static NGlobal::TVariable<TGuid> TestVariable2{TestTag2, &GetGlobal2, TGuid{42, 77}};

static NGlobal::TVariable<std::array<int, 4>> TestVariable3{
    TestTag3,
    &GetGlobal3,
    std::array{0, 0, 42, 77}};

////////////////////////////////////////////////////////////////////////////////

NGlobal::TErasedStorage GetGlobal2() noexcept
{
    return NGlobal::TErasedStorage{TestVariable2.Get()};
}

NGlobal::TErasedStorage GetGlobal3() noexcept
{
    return NGlobal::TErasedStorage{TestVariable3.Get()};
}

////////////////////////////////////////////////////////////////////////////////

TGuid GetTestVariable2()
{
    return TestVariable2.Get();
}

void SetTestVariable2(TGuid val)
{
    TestVariable2.Set(val);
}

std::array<int, 4> GetTestVariable3()
{
    return TestVariable3.Get();
}

void SetTestVariable3(std::array<int, 4> val)
{
    TestVariable3.Set(val);
}

////////////////////////////////////////////////////////////////////////////////

} // namespace NYT