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

A handle of scheduled event. More...

#include <scheduler.hpp>

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

Public Member Functions

 EventId () noexcept=default
 Constructs an empty EventId. More...
 
 EventId (std::nullptr_t) noexcept
 Allow implicit conversion from nullptr. More...
 
 operator bool () const noexcept
 Determine whether the event is valid. More...
 
bool operator== (const EventId &other) const noexcept
 Determine whether this and other refer to the same event, or are both empty/expired/cancelled. More...
 
bool operator!= (const EventId &other) const noexcept
 
void reset () noexcept
 Clear this EventId without canceling. More...
 
- Public Member Functions inherited from ndn::detail::CancelHandle
 CancelHandle () noexcept=default
 
 CancelHandle (function< void()> cancel)
 
void cancel () const
 Cancel the operation. More...
 

Friends

class Scheduler
 
std::ostream & operator<< (std::ostream &os, const EventId &eventId)
 

Detailed Description

A handle of scheduled event.

EventId eid = scheduler.scheduleEvent(10_ms, [] { doSomething(); });
eid.cancel(); // cancel 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 55 of file scheduler.hpp.

Constructor & Destructor Documentation

◆ EventId() [1/2]

ndn::util::scheduler::EventId::EventId ( )
defaultnoexcept

Constructs an empty EventId.

◆ EventId() [2/2]

ndn::util::scheduler::EventId::EventId ( std::nullptr_t  )
inlinenoexcept

Allow implicit conversion from nullptr.

Definition at line 65 of file scheduler.hpp.

Member Function Documentation

◆ operator bool()

ndn::util::scheduler::EventId::operator bool ( ) const
explicitnoexcept

Determine whether the event is valid.

Return values
trueThe event is valid.
falseThis EventId is empty, or the event is expired or cancelled.

Definition at line 61 of file scheduler.cpp.

◆ operator==()

bool ndn::util::scheduler::EventId::operator== ( const EventId other) const
noexcept

Determine whether this and other refer to the same event, or are both empty/expired/cancelled.

Definition at line 68 of file scheduler.cpp.

Referenced by operator!=().

◆ operator!=()

bool ndn::util::scheduler::EventId::operator!= ( const EventId other) const
inlinenoexcept

Definition at line 83 of file scheduler.hpp.

References operator==().

◆ reset()

void ndn::util::scheduler::EventId::reset ( )
noexcept

Clear this EventId without canceling.

Postcondition
!(*this)

Definition at line 75 of file scheduler.cpp.

Friends And Related Function Documentation

◆ Scheduler

friend class Scheduler
friend

Definition at line 100 of file scheduler.hpp.

◆ operator<<

std::ostream& operator<< ( std::ostream &  os,
const EventId eventId 
)
friend

Definition at line 81 of file scheduler.cpp.


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