blob: a7f452b358b703f769d9305c45b9d440ed6d8b97 [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"
Junxiao Shic041ca32014-02-25 20:01:15 -070011#include <ndn-cpp-dev/util/scheduler.hpp>
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080012
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080013namespace nfd {
Junxiao Shic041ca32014-02-25 20:01:15 -070014namespace scheduler {
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080015
Junxiao Shic041ca32014-02-25 20:01:15 -070016using ndn::Scheduler;
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080017
Junxiao Shic041ca32014-02-25 20:01:15 -070018/** \class EventId
19 * \brief Opaque type (shared_ptr) representing ID of a scheduled event
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080020 */
Junxiao Shic041ca32014-02-25 20:01:15 -070021using ndn::EventId;
22
23} // namespace scheduler
24
25// TODO delete this after transition
26using scheduler::Scheduler;
27
28using scheduler::EventId;
29
30namespace scheduler {
31
32// TODO delete this after transition
33Scheduler&
34getGlobalScheduler();
35
36inline EventId
Alexander Afanasyeveb3197f2014-03-17 19:28:18 -070037schedule(const time::nanoseconds& after, const Scheduler::Event& event)
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080038{
Junxiao Shic041ca32014-02-25 20:01:15 -070039 return getGlobalScheduler().scheduleEvent(after, event);
40}
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080041
Junxiao Shic041ca32014-02-25 20:01:15 -070042inline void
43cancel(const EventId& eventId)
44{
45 getGlobalScheduler().cancelEvent(eventId);
46}
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080047
Junxiao Shic041ca32014-02-25 20:01:15 -070048} // namespace scheduler
Alexander Afanasyev18bbf812014-01-29 01:40:23 -080049} // namespace nfd
Alexander Afanasyev920af2f2014-01-25 22:56:11 -080050
51#endif // NFD_CORE_SCHEDULER_HPP