-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOwnership.h
53 lines (43 loc) · 1.12 KB
/
Ownership.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
#pragma once
#include"BaseLib/Duration.h"
#include"BaseLib/Templates/BaseTypes.h"
#include"BaseLib/Export.h"
namespace BaseLib { namespace Policy {
enum class DLL_STATE OwnershipKind
{
EXCLUSIVE,
SHARED
};
/**
* @abstract
*
* This policy controls whether the Service allows multiple DataWriter objects to update the same instance (identified by
* Topic + key) of a data-object.
*
* There are two kinds of OWNERSHIP selected by the setting of the kind: SHARED and EXCLUSIVE.
*/
class DLL_STATE Ownership
: public Templates::ComparableImmutableType<OwnershipKind>
{
public:
Ownership(Policy::OwnershipKind kind = Policy::OwnershipKind::SHARED)
: Templates::ComparableImmutableType<OwnershipKind>(kind)
{ }
virtual ~Ownership()
{ }
Policy::OwnershipKind GetKind() const
{
return this->Clone();
}
static Ownership Exclusive()
{
static Ownership ownership(Policy::OwnershipKind::EXCLUSIVE);
return ownership;
}
static Ownership Shared()
{
static Ownership ownership(Policy::OwnershipKind::SHARED);
return ownership;
}
};
}}