NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::util::scheduler::ScopedEventId Class Reference

A scoped handle of scheduled event. More...

#include <scheduler.hpp>

Inheritance diagram for ndn::util::scheduler::ScopedEventId:
Collaboration diagram for ndn::util::scheduler::ScopedEventId:

Public Member Functions

 ScopedEventId () noexcept=default
 
 ScopedEventId (Scheduler &scheduler) noexcept
 
- Public Member Functions inherited from ndn::detail::ScopedCancelHandle
 ScopedCancelHandle () noexcept=default
 
 ScopedCancelHandle (CancelHandle hdl)
 Implicit constructor from CancelHandle. More...
 
 ScopedCancelHandle (const ScopedCancelHandle &)=delete
 Copy construction is disallowed. More...
 
 ScopedCancelHandle (ScopedCancelHandle &&other)
 Move constructor. More...
 
ScopedCancelHandleoperator= (const ScopedCancelHandle &)=delete
 Copy assignment is disallowed. More...
 
ScopedCancelHandleoperator= (ScopedCancelHandle &&other)
 Move assignment operator. More...
 
 ~ScopedCancelHandle ()
 Cancel the operation. More...
 
void cancel ()
 Cancel the operation. More...
 
CancelHandle release ()
 Release the operation so that it won't be cancelled when this ScopedCancelHandle is destructed. More...
 

Detailed Description

A scoped handle of scheduled event.

Upon destruction of this handle, the event is canceled automatically. Most commonly, the application keeps a ScopedEventId as a class member field, so that it can cleanup its event when the class instance is destructed.

{
ScopedEventId eid = scheduler.scheduleEvent(10_ms, [] { doSomething(); });
} // eid goes out of scope, canceling the event
Note
Canceling an expired (executed) or canceled event has no effect.
Warning
Canceling an event after the scheduler has been destructed may trigger undefined behavior.

Definition at line 123 of file scheduler.hpp.

Constructor & Destructor Documentation

◆ ScopedEventId() [1/2]

ndn::util::scheduler::ScopedEventId::ScopedEventId ( )
defaultnoexcept

◆ ScopedEventId() [2/2]

ndn::util::scheduler::ScopedEventId::ScopedEventId ( Scheduler scheduler)
inlineexplicitnoexcept
Deprecated:
Scheduler argument is no longer necessary.

Use default construction instead.

Definition at line 134 of file scheduler.hpp.


The documentation for this class was generated from the following file: