-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathpendingcall.cpp
97 lines (67 loc) · 1.25 KB
/
pendingcall.cpp
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#include "simppl/pendingcall.h"
#include "simppl/detail/constants.h"
namespace simppl
{
namespace dbus
{
PendingCall::PendingCall(uint32_t serial, DBusPendingCall* p)
: serial_(serial)
{
if (p)
pending_ = make_pending_call(p);
}
PendingCall::PendingCall()
: serial_(SIMPPL_INVALID_SERIAL)
{
// NOOP
}
PendingCall::PendingCall(PendingCall&& rhs)
{
serial_ = rhs.serial_;
pending_ = rhs.pending_;
rhs.reset();
}
PendingCall& PendingCall::operator=(PendingCall&& rhs)
{
serial_ = rhs.serial_;
pending_ = rhs.pending_;
rhs.reset();
return *this;
}
PendingCall::PendingCall(const PendingCall& rhs)
: serial_(rhs.serial_)
, pending_(rhs.pending_)
{
// NOOP
}
PendingCall& PendingCall::operator=(const PendingCall& rhs)
{
if (&rhs != this)
{
serial_ = rhs.serial_;
pending_ = rhs.pending_;
}
return *this;
}
uint32_t PendingCall::serial() const
{
return serial_;
}
DBusPendingCall* PendingCall::pending()
{
DBusPendingCall* rc = pending_.get();
return rc;
}
void PendingCall::cancel()
{
if (pending_)
dbus_pending_call_cancel(pending_.get());
reset();
}
void PendingCall::reset()
{
serial_ = SIMPPL_INVALID_SERIAL;
pending_.reset();
}
} // namespace dbus
} // namespace simppl