-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCBar.h
More file actions
50 lines (45 loc) · 1.57 KB
/
Copy pathCBar.h
File metadata and controls
50 lines (45 loc) · 1.57 KB
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
#pragma once
#include <Meta.hpp>
#include <string>
class CBar
{
protected:
std::string anotherString; // CMeta::TAnotherString
public:
int someNumber; // CMeta::TSomeNumber
std::string someString = "Null"; // CMeta::TSomeString
struct CMeta
{
using TMode = Meta::EResourceAccessMode;
// Resource definitions
template <TMode Mode>
using TAnotherString = Meta::CResourceAccess<^^CBar::anotherString, Mode>;
template <TMode Mode>
using TSomeNumber = Meta::CResourceAccess<^^CBar::someNumber, Mode>;
template <TMode Mode>
using TSomeString = Meta::CResourceAccess<^^CBar::someString, Mode>;
// Member definitions
using TPublicReadSomeNumber = Meta::CMethodResources<TSomeNumber<TMode::READ>>;
using TPublicWriteSomeNumber = Meta::CMethodResources<TSomeNumber<TMode::WRITE>>;
using TPublicReadSomeString = Meta::CMethodResources<TSomeString<TMode::READ>>;
using TPublicWriteSomeString = Meta::CMethodResources<TSomeString<TMode::WRITE>>;
// Method definitions
using TMethod = Meta::CMethodResources<TSomeNumber<TMode::WRITE>,
TSomeString<TMode::WRITE>>;
using TSetAnotherString = Meta::CMethodResources<TAnotherString<TMode::WRITE>>;
};
CBar()
: someNumber(0)
{}
[[=CMeta::TMethod{}]] // Annotate resource usage
void Method()
{
someNumber = 1; // write access Bar::someNumber
someString = "Test"; // write access Bar::someString
}
[[=CMeta::TSetAnotherString{}]] // Annotate resource usage
void SetAnotherString(const std::string& value)
{
anotherString = value; // write access Bar::anotherString
}
};