blob: 6ba4f80d5dc49d3acf63517eb2e4cc1b6775aada [file] [log] [blame]
Alexander Afanasyev920af2f2014-01-25 22:56:11 -08001/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/**
3 * Copyright (C) 2014 Named Data Networking Project
4 * See COPYING for copyright and distribution information.
5 */
6
7#ifndef NFD_CORE_SCHEDULER_HPP
8#define NFD_CORE_SCHEDULER_HPP
9
Junxiao Shic041ca32014-02-25 20:01:15 -070010#include "global-io.hpp"
11#include "time.hpp"
12#include <ndn-cpp-dev/util/scheduler.hpp>
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080013
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080014namespace nfd {
Junxiao Shic041ca32014-02-25 20:01:15 -070015namespace scheduler {
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080016
Junxiao Shic041ca32014-02-25 20:01:15 -070017using ndn::Scheduler;
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080018
Junxiao Shic041ca32014-02-25 20:01:15 -070019/** \class EventId
20 * \brief Opaque type (shared_ptr) representing ID of a scheduled event
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080021 */
Junxiao Shic041ca32014-02-25 20:01:15 -070022using ndn::EventId;
23
24} // namespace scheduler
25
26// TODO delete this after transition
27using scheduler::Scheduler;
28
29using scheduler::EventId;
30
31namespace scheduler {
32
33// TODO delete this after transition
34Scheduler&
35getGlobalScheduler();
36
37inline EventId
38schedule(const time::Duration& after, const Scheduler::Event& event)
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080039{
Junxiao Shic041ca32014-02-25 20:01:15 -070040 return getGlobalScheduler().scheduleEvent(after, event);
41}
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080042
Junxiao Shic041ca32014-02-25 20:01:15 -070043inline void
44cancel(const EventId& eventId)
45{
46 getGlobalScheduler().cancelEvent(eventId);
47}
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080048
Junxiao Shic041ca32014-02-25 20:01:15 -070049} // namespace scheduler
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080050} // namespace nfd
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080051
52#endif // NFD_CORE_SCHEDULER_HPP