| author | Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| Thu Nov 12 13:01:01 2009 +0100 (2009-11-12) | |
| changeset 5505 | c0ac392289c3 |
| parent 3812 | 6cca59a0fca6 |
| permissions | -rw-r--r-- |
| mathieu@150 | 1 |
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */ |
| mathieu@9 | 2 |
/* |
| mathieu@9 | 3 |
* Copyright (c) 2005,2006 INRIA |
| mathieu@9 | 4 |
* |
| mathieu@9 | 5 |
* This program is free software; you can redistribute it and/or modify |
| mathieu@9 | 6 |
* it under the terms of the GNU General Public License version 2 as |
| mathieu@9 | 7 |
* published by the Free Software Foundation; |
| mathieu@9 | 8 |
* |
| mathieu@9 | 9 |
* This program is distributed in the hope that it will be useful, |
| mathieu@9 | 10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| mathieu@9 | 11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| mathieu@9 | 12 |
* GNU General Public License for more details. |
| mathieu@9 | 13 |
* |
| mathieu@9 | 14 |
* You should have received a copy of the GNU General Public License |
| mathieu@9 | 15 |
* along with this program; if not, write to the Free Software |
| mathieu@9 | 16 |
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
| mathieu@9 | 17 |
* |
| mathieu@9 | 18 |
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr> |
| mathieu@9 | 19 |
*/ |
| mathieu@9 | 20 |
#ifndef EVENT_IMPL_H |
| mathieu@9 | 21 |
#define EVENT_IMPL_H |
| mathieu@9 | 22 |
|
| mathieu@9 | 23 |
#include <stdint.h> |
| mathieu@5505 | 24 |
#include "ns3/simple-ref-count.h" |
| mathieu@9 | 25 |
|
| mathieu@16 | 26 |
namespace ns3 {
|
| mathieu@9 | 27 |
|
| tomh@3182 | 28 |
/** |
| tomh@3182 | 29 |
* \ingroup simulator |
| mathieu@3187 | 30 |
* \brief a simulation event |
| mathieu@3187 | 31 |
* |
| mathieu@3187 | 32 |
* Each subclass of this base class represents a simulation event. The |
| mathieu@3187 | 33 |
* EventImpl::Invoke method will be invoked by the simulation engine |
| mathieu@3187 | 34 |
* when the time associated to this event expires. This class is |
| mathieu@3187 | 35 |
* obviously (there are Ref and Unref methods) reference-counted and |
| mathieu@3187 | 36 |
* most subclasses are usually created by one of the many Simulator::Schedule |
| mathieu@3187 | 37 |
* methods. |
| tomh@3182 | 38 |
*/ |
| mathieu@5505 | 39 |
class EventImpl : public SimpleRefCount<EventImpl> |
| mathieu@2370 | 40 |
{
|
| mathieu@9 | 41 |
public: |
| mathieu@150 | 42 |
EventImpl (); |
| mathieu@150 | 43 |
virtual ~EventImpl () = 0; |
| mathieu@3187 | 44 |
/** |
| mathieu@3187 | 45 |
* Called by the simulation engine to notify the event that it has expired. |
| mathieu@3187 | 46 |
*/ |
| mathieu@150 | 47 |
void Invoke (void); |
| mathieu@3187 | 48 |
/** |
| mathieu@3187 | 49 |
* Marks the event as 'canceled'. The event will not be removed from |
| mathieu@3187 | 50 |
* the event list but the simulation engine will check its canceled status |
| mathieu@3187 | 51 |
* before calling Invoke. |
| mathieu@3187 | 52 |
*/ |
| mathieu@150 | 53 |
void Cancel (void); |
| mathieu@3187 | 54 |
/** |
| mathieu@3187 | 55 |
* \returns true if the event has been canceled. |
| mathieu@3187 | 56 |
* |
| mathieu@3187 | 57 |
* Invoked by the simulation engine before calling Invoke. |
| mathieu@3187 | 58 |
*/ |
| mathieu@209 | 59 |
bool IsCancelled (void); |
| craigdo@3560 | 60 |
|
| mathieu@9 | 61 |
protected: |
| mathieu@150 | 62 |
virtual void Notify (void) = 0; |
| craigdo@3560 | 63 |
|
| mathieu@9 | 64 |
private: |
| mathieu@150 | 65 |
bool m_cancel; |
| mathieu@9 | 66 |
}; |
| mathieu@9 | 67 |
|
| mathieu@1009 | 68 |
} // namespace ns3 |
| mathieu@1009 | 69 |
|
| mathieu@9 | 70 |
#endif /* EVENT_IMPL_H */ |