From d2ce2c5f707dc0a19eac1d1dba2977027f23eef2 Mon Sep 17 00:00:00 2001 From: Mathieu Lacage Date: Thu, 15 Jan 2009 11:23:59 +0100 Subject: [PATCH] empty skeleton for ns2 calendar scheduler --HG-- rename : src/simulator/calendar-scheduler.cc => src/simulator/ns2-calendar-scheduler.cc rename : src/simulator/calendar-scheduler.h => src/simulator/ns2-calendar-scheduler.h --- src/simulator/ns2-calendar-scheduler.cc | 70 +++++++++++++++++++++++++ src/simulator/ns2-calendar-scheduler.h | 60 +++++++++++++++++++++ src/simulator/wscript | 2 + 3 files changed, 132 insertions(+) create mode 100644 src/simulator/ns2-calendar-scheduler.cc create mode 100644 src/simulator/ns2-calendar-scheduler.h diff --git a/src/simulator/ns2-calendar-scheduler.cc b/src/simulator/ns2-calendar-scheduler.cc new file mode 100644 index 000000000..a765ea64c --- /dev/null +++ b/src/simulator/ns2-calendar-scheduler.cc @@ -0,0 +1,70 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * XXXX + */ + +#include "ns2-calendar-scheduler.h" +#include "event-impl.h" +#include +#include +#include +#include "ns3/assert.h" +#include "ns3/log.h" + +namespace ns3 { + +NS_LOG_COMPONENT_DEFINE ("Ns2CalendarScheduler"); + +NS_OBJECT_ENSURE_REGISTERED (Ns2CalendarScheduler); + +TypeId +Ns2CalendarScheduler::GetTypeId (void) +{ + static TypeId tid = TypeId ("ns3::Ns2CalendarScheduler") + .SetParent () + .AddConstructor () + ; + return tid; +} + +Ns2CalendarScheduler::Ns2CalendarScheduler () +{ + NS_LOG_FUNCTION (this); +} +Ns2CalendarScheduler::~Ns2CalendarScheduler () +{ + NS_LOG_FUNCTION (this); +} +void +Ns2CalendarScheduler::Insert (const Event &ev) +{ + NS_LOG_FUNCTION (this); +} +bool +Ns2CalendarScheduler::IsEmpty (void) const +{ + return false; +} +Scheduler::Event +Ns2CalendarScheduler::PeekNext (void) const +{ + NS_LOG_FUNCTION (this); + return Scheduler::Event (); +} + + +Scheduler::Event +Ns2CalendarScheduler::RemoveNext (void) +{ + NS_LOG_FUNCTION (this); + return Scheduler::Event (); +} + +void +Ns2CalendarScheduler::Remove (const Event &ev) +{ + NS_ASSERT (!IsEmpty ()); + NS_ASSERT (false); +} + +} // namespace ns3 diff --git a/src/simulator/ns2-calendar-scheduler.h b/src/simulator/ns2-calendar-scheduler.h new file mode 100644 index 000000000..88fbeae6a --- /dev/null +++ b/src/simulator/ns2-calendar-scheduler.h @@ -0,0 +1,60 @@ +/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 1994 Regents of the University of California. + * Copyright (c) 2009 INRIA + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Authors: + * David Wetherall : originally, in ns-2, back in 1997, + * Mathieu Lacage : port to ns-3 + */ + +#ifndef NS2_CALENDAR_SCHEDULER_H +#define NS2_CALENDAR_SCHEDULER_H + +#include "scheduler.h" +#include +#include + +namespace ns3 { + +class EventImpl; + +/** + * \ingroup scheduler + * \brief a calendar queue event scheduler + * + * This event scheduler is a copy/paste of the ns2.29 calendar scheduler. + */ +class Ns2CalendarScheduler : public Scheduler +{ +public: + static TypeId GetTypeId (void); + + Ns2CalendarScheduler (); + virtual ~Ns2CalendarScheduler (); + + virtual void Insert (const Event &ev); + virtual bool IsEmpty (void) const; + virtual Event PeekNext (void) const; + virtual Event RemoveNext (void); + virtual void Remove (const Event &ev); + +private: +}; + +} // namespace ns3 + +#endif /* NS2_CALENDAR_SCHEDULER_H */ diff --git a/src/simulator/wscript b/src/simulator/wscript index f4bd1145a..1824bd486 100644 --- a/src/simulator/wscript +++ b/src/simulator/wscript @@ -49,6 +49,7 @@ def build(bld): 'map-scheduler.cc', 'heap-scheduler.cc', 'calendar-scheduler.cc', + 'ns2-calendar-scheduler.cc', 'event-impl.cc', 'simulator.cc', 'default-simulator-impl.cc', @@ -73,6 +74,7 @@ def build(bld): 'map-scheduler.h', 'heap-scheduler.h', 'calendar-scheduler.h', + 'ns2-calendar-scheduler.h', 'simulation-singleton.h', 'timer.h', 'timer-impl.h',