NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.3: NDN, CCN, CCNx, content centric networks
API Documentation
scheduler-scoped-event-id.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
22 #ifndef NDN_UTIL_SCHEDULER_SCOPED_EVENT_ID_HPP
23 #define NDN_UTIL_SCHEDULER_SCOPED_EVENT_ID_HPP
24 
25 #include "scheduler.hpp"
26 
27 namespace ndn {
28 namespace util {
29 namespace scheduler {
30 
33 class ScopedEventId : noncopyable
34 {
35 public:
40  explicit
41  ScopedEventId(Scheduler& scheduler);
42 
45  ScopedEventId(ScopedEventId&& other) noexcept;
46 
56  operator=(const EventId& event);
57 
60  ~ScopedEventId() noexcept;
61 
64  void
65  cancel();
66 
70  void
71  release() noexcept;
72 
73 private:
74  Scheduler* m_scheduler; // pointer to allow move semantics
75  EventId m_event;
76 };
77 
78 } // namespace scheduler
79 } // namespace util
80 } // namespace ndn
81 
82 #endif // NDN_UTIL_SCHEDULER_SCOPED_EVENT_ID_HPP
Copyright (c) 2011-2015 Regents of the University of California.
ScopedEventId(Scheduler &scheduler)
Construct ScopedEventId tied to the specified scheduler.
Opaque type (shared_ptr) representing ID of a scheduled event.
void release() noexcept
releases the event so that it won't be canceled when this ScopedEventId is destructed ...
Event that is automatically cancelled upon destruction.
void cancel()
cancels the event manually
ScopedEventId & operator=(const EventId &event)
assigns an event