-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOwnershipStrength.h
61 lines (49 loc) · 1.44 KB
/
OwnershipStrength.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
56
57
58
59
60
61
/*
* OwnershipStrength.h
*
* Created on: Sep 9, 2012
* Author: knuthelv
*/
#ifndef DDS_Policy_OwnershipStrength_h_Included
#define DDS_Policy_OwnershipStrength_h_Included
#include"DDS/CommonDefines.h"
#include"DDS/Policy/QosPolicyBase.h"
#include"DDS/Policy/PolicyKind.h"
#include"DDS/Export.h"
namespace DDS { namespace Policy
{
/**
* @abstract
*
* This QoS policy should be used in combination with the OWNERSHIP policy. It only applies to the situation case where
* OWNERSHIP kind is set to EXCLUSIVE.
*
* The value of the OWNERSHIP_STRENGTH is used to determine the ownership of a data-instance (identified by the
* key). The arbitration is performed by the DataReader. The rules used to perform the arbitration are described in
* Section 7.1.3.9.2, "EXCLUSIVE kind", on page 112.
*/
class DLL_STATE OwnershipStrength : public QosPolicyBase
{
public:
OwnershipStrength(int32_t s)
: s_(s)
{ }
public:
virtual void Write(NetworkLib::SerializeWriter *writer) const
{
writer->WriteInt32(s_);
}
virtual void Read(NetworkLib::SerializeReader *reader)
{
s_ = reader->ReadInt32();
}
DEFINE_POLICY_TRAITS(OwnershipStrength, 7, DDS::Policy::RequestedOfferedKind::NOT_APPLICABLE, true)
public:
int32_t GetStrength() const { return s_; }
int32_t& GetStrength() { return s_; }
void SetStrength(int32_t s) { s_ = s; }
private:
int32_t s_;
};
}} // DDS::Policy
#endif // DDS_Policy_OwnershipStrength_h_Included