NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
scheduler-scoped-event-id.cpp
Go to the documentation of this file.
1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22
#include "
scheduler-scoped-event-id.hpp
"
23
24
namespace
ndn
{
25
namespace
util {
26
namespace
scheduler {
27
28
#if NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE
29
static_assert(std::is_nothrow_move_constructible<ScopedEventId>::value,
30
"ScopedEventId must be MoveConstructible with noexcept"
);
31
#endif // NDN_CXX_HAVE_IS_NOTHROW_MOVE_CONSTRUCTIBLE
32
33
ScopedEventId::ScopedEventId
(
Scheduler
& scheduler)
34
: m_scheduler(&scheduler)
35
{
36
}
37
38
ScopedEventId::ScopedEventId
(
ScopedEventId
&& other) noexcept
39
: m_scheduler(other.m_scheduler)
40
, m_event(other.m_event)
41
{
42
other.release();
43
}
44
45
ScopedEventId
&
46
ScopedEventId::operator=
(
const
EventId
& event)
47
{
48
if
(m_event != event) {
49
m_scheduler->
cancelEvent
(m_event);
50
m_event = event;
51
}
52
return
*
this
;
53
}
54
55
ScopedEventId::~ScopedEventId
() noexcept
56
{
57
m_scheduler->
cancelEvent
(m_event);
58
}
59
60
void
61
ScopedEventId::cancel
()
62
{
63
m_scheduler->
cancelEvent
(m_event);
64
}
65
66
void
67
ScopedEventId::release
() noexcept
68
{
69
m_event.reset();
70
}
71
72
}
// namespace scheduler
73
}
// namespace util
74
}
// namespace ndn
ndn
Copyright (c) 2011-2015 Regents of the University of California.
Definition:
ndn-strategy-choice-helper.hpp:34
ndn::util::scheduler::Scheduler
Generic scheduler.
Definition:
scheduler.hpp:44
ndn::util::scheduler::ScopedEventId::ScopedEventId
ScopedEventId(Scheduler &scheduler)
Construct ScopedEventId tied to the specified scheduler.
Definition:
scheduler-scoped-event-id.cpp:33
scheduler-scoped-event-id.hpp
ndn::util::scheduler::Scheduler::cancelEvent
void cancelEvent(const EventId &eventId)
Cancel scheduled event.
Definition:
scheduler.cpp:106
EventId
Opaque type (shared_ptr) representing ID of a scheduled event.
ndn::util::scheduler::ScopedEventId::release
void release() noexcept
releases the event so that it won't be canceled when this ScopedEventId is destructed ...
Definition:
scheduler-scoped-event-id.cpp:67
ndn::util::scheduler::ScopedEventId::~ScopedEventId
~ScopedEventId() noexcept
cancels the event
Definition:
scheduler-scoped-event-id.cpp:55
ndn::util::scheduler::ScopedEventId
Event that is automatically cancelled upon destruction.
Definition:
scheduler-scoped-event-id.hpp:33
ndn::util::scheduler::ScopedEventId::cancel
void cancel()
cancels the event manually
Definition:
scheduler-scoped-event-id.cpp:61
ndn::util::scheduler::ScopedEventId::operator=
ScopedEventId & operator=(const EventId &event)
assigns an event
Definition:
scheduler-scoped-event-id.cpp:46
ndnSIM
ndn-cxx
src
util
scheduler-scoped-event-id.cpp
Generated on Sat Nov 12 2016 16:02:53 for ndnSIM by
1.8.12