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; -*- */
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 
34  : m_scheduler(&scheduler)
35 {
36 }
37 
39  : m_scheduler(other.m_scheduler)
40  , m_event(other.m_event)
41 {
42  other.release();
43 }
44 
47 {
48  if (m_event != event) {
49  m_scheduler->cancelEvent(m_event);
50  m_event = event;
51  }
52  return *this;
53 }
54 
56 {
57  m_scheduler->cancelEvent(m_event);
58 }
59 
60 void
62 {
63  m_scheduler->cancelEvent(m_event);
64 }
65 
66 void
68 {
69  m_event.reset();
70 }
71 
72 } // namespace scheduler
73 } // namespace util
74 } // namespace ndn
Copyright (c) 2011-2015 Regents of the University of California.
ScopedEventId(Scheduler &scheduler)
Construct ScopedEventId tied to the specified scheduler.
void cancelEvent(const EventId &eventId)
Cancel scheduled event.
Definition: scheduler.cpp:128
Private storage of information about the event.
Definition: scheduler.hpp:36
Event that is automatically cancelled upon destruction.
void cancel()
cancels the event manually
ScopedEventId & operator=(const EventId &event)
assigns an event
void release()
releases the event so that it won&#39;t be canceled when this ScopedEventId is destructed ...