-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDataAccessStrategyPolicy.h
executable file
·55 lines (42 loc) · 1.1 KB
/
DataAccessStrategyPolicy.h
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
#pragma once
#include"RxStreamer/IncludeExtLibs.h"
#include"RxStreamer/DataAccessControllerPolicy.h"
namespace Reactor
{
template <typename T>
class DataAccessStrategyPolicyBase
{
public:
virtual ~DataAccessStrategyPolicyBase() {}
virtual T Strategy() const = 0;
virtual DataAccessControllerPolicy Policy() const = 0;
virtual RxData::CacheDescription CacheId() const = 0;
};
template <typename T>
class DataAccessStrategyPolicy : public DataAccessStrategyPolicyBase<T>
{
public:
DataAccessStrategyPolicy(RxData::CacheDescription cacheId, DataAccessControllerPolicy policy, T strategy)
: cacheId_(cacheId)
, policy_(policy)
, strategy_(strategy)
{ }
CLASS_TRAITS(DataAccessStrategyPolicy)
virtual T Strategy() const
{
return strategy_;
}
virtual DataAccessControllerPolicy Policy() const
{
return policy_;
}
RxData::CacheDescription CacheId() const
{
return cacheId_;
}
private:
const RxData::CacheDescription cacheId_;
const DataAccessControllerPolicy policy_;
const T strategy_;
};
}