A Discrete-Event Network Simulator
API
make-event.cc
Go to the documentation of this file.
1/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
2/*
3 * Copyright (c) 2008 INRIA
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation;
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 *
18 */
19
20#include "make-event.h"
21#include "log.h"
22
29namespace ns3 {
30
31NS_LOG_COMPONENT_DEFINE ("MakeEvent");
32
33// This is the only non-templated version of MakeEvent.
34EventImpl * MakeEvent (void (*f)(void))
35{
37 // zero arg version
38 class EventFunctionImpl0 : public EventImpl
39 {
40 public:
41 typedef void (*F)(void);
42
43 EventFunctionImpl0 (F function)
44 : m_function (function)
45 {}
46 virtual ~EventFunctionImpl0 ()
47 {}
48
49 protected:
50 virtual void Notify (void)
51 {
52 (*m_function)();
53 }
54
55 private:
56 F m_function;
57 } *ev = new EventFunctionImpl0 (f);
58 return ev;
59}
60
61} // namespace ns3
double f(double x, void *params)
Definition: 80211b.c:70
A simulation event.
Definition: event-impl.h:45
#define NS_LOG_COMPONENT_DEFINE(name)
Define a Log component with a specific name.
Definition: log.h:205
#define NS_LOG_FUNCTION(parameters)
If log level LOG_FUNCTION is enabled, this macro will output all input parameters separated by ",...
EventImpl * MakeEvent(void(*f)(void))
Make an EventImpl from a function pointer taking varying numbers of arguments.
Definition: make-event.cc:34
Debug message logging.
ns3::MakeEvent function declarations and template implementation.
Every class exported by the ns3 library is enclosed in the ns3 namespace.