NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.0: NDN, CCN, CCNx, content centric networks
API Documentation
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
scheduler.hpp
Go to the documentation of this file.
1 /* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
26 #ifndef NFD_CORE_SCHEDULER_HPP
27 #define NFD_CORE_SCHEDULER_HPP
28 
29 #include "common.hpp"
30 
31 #include "ns3/simulator.h"
32 
33 namespace nfd {
34 namespace scheduler {
35 
39 typedef std::shared_ptr<ns3::EventId> EventId;
40 
43 EventId
44 schedule(const time::nanoseconds& after, const std::function<void()>& event);
45 
48 void
49 cancel(const EventId& eventId);
50 
53 class ScopedEventId : noncopyable
54 {
55 public:
56  ScopedEventId();
57 
61  ScopedEventId(const EventId& event);
62 
66 
73  operator=(const EventId& event);
74 
78 
81  void
82  cancel();
83 
87  void
88  release();
89 
90 private:
91  EventId m_event;
92 };
93 
94 } // namespace scheduler
95 
96 using scheduler::EventId;
97 
98 } // namespace nfd
99 
100 #endif // NFD_CORE_SCHEDULER_HPP
void cancel()
cancels the event manually
Definition: scheduler.cpp:97
ScopedEventId & operator=(const EventId &event)
assigns an event
Definition: scheduler.cpp:82
void cancel(const EventId &eventId)
cancel a scheduled event
Definition: scheduler.cpp:58
~ScopedEventId()
cancels the event
Definition: scheduler.cpp:91
std::shared_ptr< ns3::EventId > EventId
Definition: scheduler.hpp:39
Opaque type (shared_ptr) representing ID of a scheduled event.
void release()
releases the event so that it won't be disconnected when this ScopedEventId is destructed ...
Definition: scheduler.cpp:103
cancels an event automatically upon destruction
Definition: scheduler.hpp:53
EventId schedule(const time::nanoseconds &after, const std::function< void()> &event)
schedule an event
Definition: scheduler.cpp:50