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

A handle for a scheduled event. More...

#include <scheduler.hpp>

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

Public Member Functions

 EventId () noexcept=default
 Constructs an empty EventId. More...
 
 operator bool () const noexcept
 Determine whether the event is valid. More...
 
void reset () noexcept
 Clear this EventId without canceling. More...
 
- Public Member Functions inherited from ndn::detail::CancelHandle
 CancelHandle () noexcept
 
 CancelHandle (std::function< void()> cancel) noexcept
 
void cancel () const
 Cancel the operation. More...
 

Friends

class Scheduler
 
bool operator== (const EventId &lhs, const EventId &rhs) noexcept
 Determine whether this and other refer to the same event, or are both empty/expired/cancelled. More...
 
bool operator!= (const EventId &lhs, const EventId &rhs) noexcept
 
std::ostream & operator<< (std::ostream &os, const EventId &eventId)
 

Detailed Description

A handle for a scheduled event.

EventId eid = scheduler.schedule(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 58 of file scheduler.hpp.

Constructor & Destructor Documentation

◆ EventId()

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

Constructs an empty EventId.

Member Function Documentation

◆ operator bool()

ndn::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.

◆ reset()

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

Clear this EventId without canceling.

Postcondition
!(*this)

Definition at line 68 of file scheduler.cpp.

Friends And Related Function Documentation

◆ Scheduler

friend class Scheduler
friend

Definition at line 105 of file scheduler.hpp.

◆ operator==

bool operator== ( const EventId lhs,
const EventId rhs 
)
friend

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

Definition at line 86 of file scheduler.hpp.

◆ operator!=

bool operator!= ( const EventId lhs,
const EventId rhs 
)
friend

Definition at line 94 of file scheduler.hpp.

◆ operator<<

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

Definition at line 73 of file scheduler.cpp.


The documentation for this class was generated from the following files:
ndn::scheduler::EventId::EventId
EventId() noexcept=default
Constructs an empty EventId.
ndn::scheduler
Definition: scheduler.cpp:27