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

Classes

class  EventId
 A handle for a scheduled event. More...
 
class  EventInfo
 Stores internal information about a scheduled event. More...
 
class  Scheduler
 Generic time-based scheduler. More...
 

Typedefs

using EventCallback = std::function< void()>
 Function to be invoked when a scheduled event expires. More...
 
using ScopedEventId = detail::ScopedCancelHandle< EventId >
 A scoped handle for a scheduled event. More...
 

Functions

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

Typedef Documentation

◆ EventCallback

using ndn::scheduler::EventCallback = typedef std::function<void()>

Function to be invoked when a scheduled event expires.

Definition at line 45 of file scheduler.hpp.

◆ ScopedEventId

A scoped handle for a 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.schedule(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 128 of file scheduler.hpp.

Function Documentation

◆ operator<<()

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

Definition at line 73 of file scheduler.cpp.

ndn::scheduler::ScopedEventId
detail::ScopedCancelHandle< EventId > ScopedEventId
A scoped handle for a scheduled event.
Definition: scheduler.hpp:128
ndn::scheduler
Definition: scheduler.cpp:27