src/simulator/timer-impl.h
author Gustavo J. A. M. Carneiro <gjc@inescporto.pt>
Fri, 11 Jul 2008 18:39:19 +0100
changeset 3416 926ccb845111
parent 1943 f7f0279465d7
permissions -rw-r--r--
Rescan APIs
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     1
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     2
/*
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     3
 * Copyright (c) 2007 INRIA
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     4
 *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     5
 * This program is free software; you can redistribute it and/or modify
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     6
 * it under the terms of the GNU General Public License version 2 as
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     7
 * published by the Free Software Foundation;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     8
 *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
     9
 * This program is distributed in the hope that it will be useful,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    12
 * GNU General Public License for more details.
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    13
 *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    14
 * You should have received a copy of the GNU General Public License
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    15
 * along with this program; if not, write to the Free Software
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    16
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    17
 *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    18
 * Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    19
 */
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    20
#ifndef TIMER_IMPL_H
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    21
#define TIMER_IMPL_H
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    22
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    23
#include "simulator.h"
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    24
#include "ns3/type-traits.h"
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
    25
#include "ns3/fatal-error.h"
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
    26
#include "ns3/int-to-type.h"
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    27
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    28
namespace ns3 {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    29
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    30
class TimerImpl
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    31
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    32
public:  
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    33
  virtual ~TimerImpl () {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    34
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    35
  template <typename T1>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    36
  void SetArgs (T1 a1);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    37
  template <typename T1, typename T2>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    38
  void SetArgs (T1 a1, T2 a2);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    39
  template <typename T1, typename T2, typename T3>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    40
  void SetArgs (T1 a1, T2 a2, T3 a3);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    41
  template <typename T1, typename T2, typename T3, 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    42
            typename T4>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    43
  void SetArgs (T1 a1, T2 a2, T3 a3, T4 a4);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    44
  template <typename T1, typename T2, typename T3, 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    45
            typename T4, typename T5>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    46
  void SetArgs (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    47
  template <typename T1, typename T2, typename T3, 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    48
            typename T4, typename T5, typename T6>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    49
  void SetArgs (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    50
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    51
  virtual EventId Schedule (const Time &delay) = 0;
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
    52
  virtual void Invoke (void) = 0;
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    53
};
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    54
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    55
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    56
template <typename T1>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    57
struct TimerImplOne : public TimerImpl
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    58
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    59
  virtual void SetArguments (T1 a1) = 0;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    60
};
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    61
template <typename T1, typename T2>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    62
struct TimerImplTwo : public TimerImpl
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    63
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    64
  virtual void SetArguments (T1 a1,T2 a2) = 0;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    65
};
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    66
template <typename T1, typename T2, typename T3>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    67
struct TimerImplThree : public TimerImpl
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    68
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    69
  virtual void SetArguments (T1 a1,T2 a2,T3 a3) = 0;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    70
};
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    71
template <typename T1, typename T2, typename  T3, typename T4>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    72
struct TimerImplFour : public TimerImpl
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    73
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    74
  virtual void SetArguments (T1 a1,T2 a2,T3 a3, T4 a4) = 0;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    75
};
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    76
template <typename T1, typename T2, typename  T3, typename T4, typename T5>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    77
struct TimerImplFive : public TimerImpl
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    78
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    79
  virtual void SetArguments (T1 a1,T2 a2,T3 a3, T4 a4, T5 a5) = 0;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    80
};
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    81
template <typename T1, typename T2, typename  T3, typename T4, typename T5, typename T6>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    82
struct TimerImplSix : public TimerImpl
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    83
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    84
  virtual void SetArguments (T1 a1,T2 a2,T3 a3, T4 a4, T5 a5, T6 a6) = 0;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    85
};
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    86
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    87
1942
b2c1a41d591f move traits definition down
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1941
diff changeset
    88
b2c1a41d591f move traits definition down
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1941
diff changeset
    89
template <typename T>
b2c1a41d591f move traits definition down
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1941
diff changeset
    90
struct TimerTraits
b2c1a41d591f move traits definition down
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1941
diff changeset
    91
{
b2c1a41d591f move traits definition down
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1941
diff changeset
    92
  typedef typename TypeTraits<typename TypeTraits<T>::ReferencedType>::NonConstType StoredType;
b2c1a41d591f move traits definition down
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1941
diff changeset
    93
  typedef const StoredType &ParameterType;
b2c1a41d591f move traits definition down
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1941
diff changeset
    94
};
b2c1a41d591f move traits definition down
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1941
diff changeset
    95
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    96
template <typename FN>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    97
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    98
MakeTimerImpl (FN fn)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
    99
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   100
  NS_ASSERT (TypeTraits<FN>::IsFunctionPointer);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   101
  return MakeTimerImpl (IntToType<TypeTraits<FN>::FunctionPointerTraits::nArgs> (), fn);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   102
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   103
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   104
template <typename FN>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   105
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   106
MakeTimerImpl (IntToType<0>, FN fn)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   107
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   108
  struct FnTimerImplZero : public TimerImpl
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   109
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   110
    FnTimerImplZero (FN fn) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   111
      : m_fn (fn) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   112
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   113
      return Simulator::Schedule (delay, m_fn);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   114
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   115
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   116
      m_fn ();
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   117
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   118
    FN m_fn;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   119
  } *function = new FnTimerImplZero (fn);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   120
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   121
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   122
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   123
template <typename FN>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   124
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   125
MakeTimerImpl (IntToType<1>, FN fn)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   126
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   127
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   128
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   129
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   130
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   131
  struct FnTimerImplOne : public TimerImplOne<T1Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   132
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   133
    FnTimerImplOne (FN fn) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   134
      : m_fn (fn) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   135
    virtual void SetArguments (T1Parameter a1) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   136
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   137
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   138
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   139
      return Simulator::Schedule (delay, m_fn, m_a1);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   140
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   141
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   142
      m_fn (m_a1);
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   143
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   144
    FN m_fn;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   145
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   146
  } *function = new FnTimerImplOne (fn);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   147
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   148
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   149
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   150
template <typename FN>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   151
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   152
MakeTimerImpl (IntToType<2>, FN fn)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   153
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   154
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   155
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   156
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   157
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   158
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   159
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   160
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   161
  struct FnTimerImplTwo : public TimerImplTwo<T1Parameter,T2Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   162
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   163
    FnTimerImplTwo (FN fn) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   164
      : m_fn (fn) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   165
    virtual void SetArguments (T1Parameter a1, T2Parameter a2) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   166
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   167
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   168
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   169
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   170
      return Simulator::Schedule (delay, m_fn, m_a1, m_a2);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   171
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   172
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   173
      m_fn (m_a1, m_a2);
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   174
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   175
    FN m_fn;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   176
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   177
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   178
  } *function = new FnTimerImplTwo (fn);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   179
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   180
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   181
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   182
template <typename FN>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   183
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   184
MakeTimerImpl (IntToType<3>, FN fn)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   185
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   186
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   187
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   188
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   189
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   190
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   191
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   192
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg3Type T3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   193
  typedef typename TimerTraits<T3>::ParameterType T3Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   194
  typedef typename TimerTraits<T3>::StoredType T3Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   195
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   196
  struct FnTimerImplThree : public TimerImplThree<T1Parameter,T2Parameter,T3Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   197
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   198
    FnTimerImplThree (FN fn) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   199
      : m_fn (fn) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   200
    virtual void SetArguments (T1Parameter a1, T2Parameter a2, T3Parameter a3) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   201
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   202
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   203
      m_a3 = a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   204
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   205
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   206
      return Simulator::Schedule (delay, m_fn, m_a1, m_a2, m_a3);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   207
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   208
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   209
      m_fn (m_a1, m_a2, m_a3);
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   210
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   211
    FN m_fn;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   212
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   213
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   214
    T3Stored m_a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   215
  } *function = new FnTimerImplThree (fn);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   216
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   217
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   218
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   219
template <typename FN>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   220
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   221
MakeTimerImpl (IntToType<4>, FN fn)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   222
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   223
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   224
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   225
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   226
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   227
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   228
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   229
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg3Type T3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   230
  typedef typename TimerTraits<T3>::ParameterType T3Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   231
  typedef typename TimerTraits<T3>::StoredType T3Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   232
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg4Type T4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   233
  typedef typename TimerTraits<T4>::ParameterType T4Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   234
  typedef typename TimerTraits<T4>::StoredType T4Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   235
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   236
  struct FnTimerImplFour : public TimerImplFour<T1Parameter,T2Parameter,T3Parameter,T4Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   237
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   238
    FnTimerImplFour (FN fn) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   239
      : m_fn (fn) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   240
    virtual void SetArguments (T1Parameter a1, T2Parameter a2, T3Parameter a3, T4Parameter a4) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   241
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   242
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   243
      m_a3 = a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   244
      m_a4 = a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   245
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   246
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   247
      return Simulator::Schedule (delay, m_fn, m_a1, m_a2, m_a3, m_a4);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   248
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   249
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   250
      m_fn (m_a1, m_a2, m_a3, m_a4);
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   251
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   252
    FN m_fn;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   253
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   254
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   255
    T3Stored m_a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   256
    T4Stored m_a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   257
  } *function = new FnTimerImplFour (fn);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   258
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   259
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   260
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   261
template <typename FN>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   262
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   263
MakeTimerImpl (IntToType<5>, FN fn)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   264
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   265
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   266
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   267
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   268
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   269
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   270
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   271
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg3Type T3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   272
  typedef typename TimerTraits<T3>::ParameterType T3Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   273
  typedef typename TimerTraits<T3>::StoredType T3Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   274
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg4Type T4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   275
  typedef typename TimerTraits<T4>::ParameterType T4Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   276
  typedef typename TimerTraits<T4>::StoredType T4Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   277
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg5Type T5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   278
  typedef typename TimerTraits<T5>::ParameterType T5Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   279
  typedef typename TimerTraits<T5>::StoredType T5Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   280
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   281
  struct FnTimerImplFive : public TimerImplFive<T1Parameter,T2Parameter,T3Parameter,T4Parameter,T5Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   282
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   283
    FnTimerImplFive (FN fn) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   284
      : m_fn (fn) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   285
    virtual void SetArguments (T1Parameter a1, T2Parameter a2, T3Parameter a3, T4Parameter a4, T5Parameter a5) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   286
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   287
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   288
      m_a3 = a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   289
      m_a4 = a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   290
      m_a5 = a5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   291
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   292
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   293
      return Simulator::Schedule (delay, m_fn, m_a1, m_a2, m_a3, m_a4, m_a5);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   294
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   295
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   296
      m_fn (m_a1, m_a2, m_a3, m_a4, m_a5);
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   297
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   298
    FN m_fn;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   299
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   300
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   301
    T3Stored m_a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   302
    T4Stored m_a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   303
    T5Stored m_a5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   304
  } *function = new FnTimerImplFive (fn);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   305
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   306
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   307
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   308
template <typename FN>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   309
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   310
MakeTimerImpl (IntToType<6>, FN fn)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   311
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   312
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   313
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   314
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   315
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   316
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   317
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   318
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg3Type T3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   319
  typedef typename TimerTraits<T3>::ParameterType T3Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   320
  typedef typename TimerTraits<T3>::StoredType T3Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   321
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg4Type T4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   322
  typedef typename TimerTraits<T4>::ParameterType T4Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   323
  typedef typename TimerTraits<T4>::StoredType T4Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   324
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg5Type T5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   325
  typedef typename TimerTraits<T5>::ParameterType T5Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   326
  typedef typename TimerTraits<T5>::StoredType T5Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   327
  typedef typename TypeTraits<FN>::FunctionPointerTraits::Arg6Type T6;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   328
  typedef typename TimerTraits<T6>::ParameterType T6Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   329
  typedef typename TimerTraits<T6>::StoredType T6Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   330
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   331
  struct FnTimerImplSix : public TimerImplSix<T1Parameter,T2Parameter,T3Parameter,T4Parameter,T5Parameter,T6Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   332
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   333
    FnTimerImplSix (FN fn) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   334
      : m_fn (fn) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   335
    virtual void SetArguments (T1Parameter a1, T2Parameter a2, T3Parameter a3, T4Parameter a4, T5Parameter a5, T6Parameter a6) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   336
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   337
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   338
      m_a3 = a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   339
      m_a4 = a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   340
      m_a5 = a5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   341
      m_a6 = a6;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   342
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   343
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   344
      return Simulator::Schedule (delay, m_fn, m_a1, m_a2, m_a3, m_a4, m_a5, m_a6);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   345
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   346
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   347
      m_fn (m_a1, m_a2, m_a3, m_a4, m_a5, m_a6);
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   348
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   349
    FN m_fn;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   350
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   351
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   352
    T3Stored m_a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   353
    T4Stored m_a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   354
    T5Stored m_a5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   355
    T6Stored m_a6;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   356
  } *function = new FnTimerImplSix (fn);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   357
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   358
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   359
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   360
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   361
template <typename T>
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   362
struct TimerImplMemberTraits;
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   363
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   364
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   365
template <typename T>
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   366
struct TimerImplMemberTraits<T *>
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   367
{
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   368
  static T &GetReference (T *p) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   369
    return *p;
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   370
  }
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   371
};
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   372
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   373
template <typename MEM_PTR, typename OBJ_PTR>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   374
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   375
MakeTimerImpl (MEM_PTR memPtr, OBJ_PTR objPtr)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   376
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   377
  NS_ASSERT (TypeTraits<MEM_PTR>::IsPointerToMember);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   378
  return MakeTimerImpl (IntToType<TypeTraits<MEM_PTR>::PointerToMemberTraits::nArgs> () , memPtr, objPtr);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   379
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   380
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   381
template <typename MEM_PTR, typename OBJ_PTR>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   382
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   383
MakeTimerImpl (IntToType<0>, MEM_PTR memPtr, OBJ_PTR objPtr)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   384
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   385
  struct MemFnTimerImplZero : public TimerImpl
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   386
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   387
    MemFnTimerImplZero (MEM_PTR memPtr, OBJ_PTR objPtr) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   388
      : m_memPtr (memPtr), m_objPtr (objPtr) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   389
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   390
      return Simulator::Schedule (delay, m_memPtr, m_objPtr);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   391
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   392
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   393
      (TimerImplMemberTraits<OBJ_PTR>::GetReference (m_objPtr).*m_memPtr) (); 
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   394
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   395
    MEM_PTR m_memPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   396
    OBJ_PTR m_objPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   397
  } *function = new MemFnTimerImplZero (memPtr, objPtr);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   398
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   399
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   400
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   401
template <typename MEM_PTR, typename OBJ_PTR>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   402
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   403
MakeTimerImpl (IntToType<1>, MEM_PTR memPtr, OBJ_PTR objPtr)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   404
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   405
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   406
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   407
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   408
  
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   409
  struct MemFnTimerImplOne : public TimerImplOne<T1Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   410
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   411
    MemFnTimerImplOne (MEM_PTR memPtr, OBJ_PTR objPtr) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   412
      : m_memPtr (memPtr), m_objPtr (objPtr) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   413
    virtual void SetArguments (T1Parameter a1) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   414
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   415
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   416
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   417
      return Simulator::Schedule (delay, m_memPtr, m_objPtr, m_a1);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   418
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   419
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   420
      (TimerImplMemberTraits<OBJ_PTR>::GetReference (m_objPtr).*m_memPtr) (m_a1); 
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   421
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   422
    MEM_PTR m_memPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   423
    OBJ_PTR m_objPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   424
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   425
  } *function = new MemFnTimerImplOne (memPtr, objPtr);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   426
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   427
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   428
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   429
template <typename MEM_PTR, typename OBJ_PTR>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   430
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   431
MakeTimerImpl (IntToType<2>, MEM_PTR memPtr, OBJ_PTR objPtr)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   432
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   433
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   434
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   435
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   436
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   437
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   438
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   439
  
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   440
  struct MemFnTimerImplTwo : public TimerImplTwo<T1Parameter,T2Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   441
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   442
    MemFnTimerImplTwo (MEM_PTR memPtr, OBJ_PTR objPtr) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   443
      : m_memPtr (memPtr), m_objPtr (objPtr) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   444
    virtual void SetArguments (T1Parameter a1, T2Parameter a2) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   445
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   446
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   447
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   448
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   449
      return Simulator::Schedule (delay, m_memPtr, m_objPtr, m_a1, m_a2);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   450
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   451
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   452
      (TimerImplMemberTraits<OBJ_PTR>::GetReference (m_objPtr).*m_memPtr) (m_a1, m_a2); 
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   453
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   454
    MEM_PTR m_memPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   455
    OBJ_PTR m_objPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   456
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   457
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   458
  } *function = new MemFnTimerImplTwo (memPtr, objPtr);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   459
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   460
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   461
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   462
template <typename MEM_PTR, typename OBJ_PTR>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   463
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   464
MakeTimerImpl (IntToType<3>, MEM_PTR memPtr, OBJ_PTR objPtr)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   465
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   466
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   467
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   468
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   469
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   470
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   471
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   472
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg3Type T3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   473
  typedef typename TimerTraits<T3>::ParameterType T3Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   474
  typedef typename TimerTraits<T3>::StoredType T3Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   475
  
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   476
  struct MemFnTimerImplThree : public TimerImplThree<T1Parameter,T2Parameter,T3Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   477
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   478
    MemFnTimerImplThree (MEM_PTR memPtr, OBJ_PTR objPtr) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   479
      : m_memPtr (memPtr), m_objPtr (objPtr) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   480
    virtual void SetArguments (T1Parameter a1, T2Parameter a2, T3Parameter a3) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   481
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   482
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   483
      m_a3 = a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   484
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   485
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   486
      return Simulator::Schedule (delay, m_memPtr, m_objPtr, m_a1, m_a2, m_a3);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   487
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   488
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   489
      (TimerImplMemberTraits<OBJ_PTR>::GetReference (m_objPtr).*m_memPtr) (m_a1, m_a2, m_a3); 
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   490
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   491
    MEM_PTR m_memPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   492
    OBJ_PTR m_objPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   493
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   494
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   495
    T3Stored m_a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   496
  } *function = new MemFnTimerImplThree (memPtr, objPtr);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   497
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   498
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   499
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   500
template <typename MEM_PTR, typename OBJ_PTR>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   501
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   502
MakeTimerImpl (IntToType<4>, MEM_PTR memPtr, OBJ_PTR objPtr)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   503
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   504
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   505
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   506
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   507
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   508
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   509
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   510
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg3Type T3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   511
  typedef typename TimerTraits<T3>::ParameterType T3Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   512
  typedef typename TimerTraits<T3>::StoredType T3Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   513
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg4Type T4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   514
  typedef typename TimerTraits<T4>::ParameterType T4Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   515
  typedef typename TimerTraits<T4>::StoredType T4Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   516
  
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   517
  struct MemFnTimerImplFour : public TimerImplFour<T1Parameter,T2Parameter,T3Parameter,T4Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   518
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   519
    MemFnTimerImplFour (MEM_PTR memPtr, OBJ_PTR objPtr) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   520
      : m_memPtr (memPtr), m_objPtr (objPtr) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   521
    virtual void SetArguments (T1Parameter a1, T2Parameter a2, T3Parameter a3, T4Parameter a4) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   522
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   523
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   524
      m_a3 = a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   525
      m_a4 = a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   526
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   527
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   528
      return Simulator::Schedule (delay, m_memPtr, m_objPtr, m_a1, m_a2, m_a3, m_a4);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   529
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   530
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   531
      (TimerImplMemberTraits<OBJ_PTR>::GetReference (m_objPtr).*m_memPtr) (m_a1, m_a2, m_a3, m_a4); 
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   532
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   533
    MEM_PTR m_memPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   534
    OBJ_PTR m_objPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   535
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   536
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   537
    T3Stored m_a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   538
    T4Stored m_a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   539
  } *function = new MemFnTimerImplFour (memPtr, objPtr);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   540
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   541
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   542
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   543
template <typename MEM_PTR, typename OBJ_PTR>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   544
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   545
MakeTimerImpl (IntToType<5>, MEM_PTR memPtr, OBJ_PTR objPtr)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   546
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   547
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   548
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   549
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   550
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   551
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   552
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   553
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg3Type T3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   554
  typedef typename TimerTraits<T3>::ParameterType T3Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   555
  typedef typename TimerTraits<T3>::StoredType T3Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   556
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg4Type T4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   557
  typedef typename TimerTraits<T4>::ParameterType T4Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   558
  typedef typename TimerTraits<T4>::StoredType T4Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   559
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg5Type T5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   560
  typedef typename TimerTraits<T5>::ParameterType T5Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   561
  typedef typename TimerTraits<T5>::StoredType T5Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   562
  
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   563
  struct MemFnTimerImplFive : public TimerImplFive<T1Parameter,T2Parameter,T3Parameter,T4Parameter,T5Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   564
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   565
    MemFnTimerImplFive (MEM_PTR memPtr, OBJ_PTR objPtr) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   566
      : m_memPtr (memPtr), m_objPtr (objPtr) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   567
    virtual void SetArguments (T1Parameter a1, T2Parameter a2, T3Parameter a3, T4Parameter a4,T5Parameter a5) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   568
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   569
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   570
      m_a3 = a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   571
      m_a4 = a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   572
      m_a5 = a5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   573
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   574
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   575
      return Simulator::Schedule (delay, m_memPtr, m_objPtr, m_a1, m_a2, m_a3, m_a4, m_a5);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   576
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   577
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   578
      (TimerImplMemberTraits<OBJ_PTR>::GetReference (m_objPtr).*m_memPtr) (m_a1, m_a2, m_a3, m_a4, m_a5); 
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   579
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   580
    MEM_PTR m_memPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   581
    OBJ_PTR m_objPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   582
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   583
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   584
    T3Stored m_a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   585
    T4Stored m_a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   586
    T5Stored m_a5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   587
  } *function = new MemFnTimerImplFive (memPtr, objPtr);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   588
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   589
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   590
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   591
template <typename MEM_PTR, typename OBJ_PTR>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   592
TimerImpl *
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   593
MakeTimerImpl (IntToType<6>, MEM_PTR memPtr, OBJ_PTR objPtr)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   594
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   595
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg1Type T1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   596
  typedef typename TimerTraits<T1>::ParameterType T1Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   597
  typedef typename TimerTraits<T1>::StoredType T1Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   598
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg2Type T2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   599
  typedef typename TimerTraits<T2>::ParameterType T2Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   600
  typedef typename TimerTraits<T2>::StoredType T2Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   601
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg3Type T3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   602
  typedef typename TimerTraits<T3>::ParameterType T3Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   603
  typedef typename TimerTraits<T3>::StoredType T3Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   604
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg4Type T4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   605
  typedef typename TimerTraits<T4>::ParameterType T4Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   606
  typedef typename TimerTraits<T4>::StoredType T4Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   607
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg5Type T5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   608
  typedef typename TimerTraits<T5>::ParameterType T5Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   609
  typedef typename TimerTraits<T5>::StoredType T5Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   610
  typedef typename TypeTraits<MEM_PTR>::PointerToMemberTraits::Arg6Type T6;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   611
  typedef typename TimerTraits<T6>::ParameterType T6Parameter;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   612
  typedef typename TimerTraits<T6>::StoredType T6Stored;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   613
  
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   614
  struct MemFnTimerImplSix : public TimerImplSix<T1Parameter,T2Parameter,T3Parameter,T4Parameter,T5Parameter,T6Parameter>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   615
  {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   616
    MemFnTimerImplSix (MEM_PTR memPtr, OBJ_PTR objPtr) 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   617
      : m_memPtr (memPtr), m_objPtr (objPtr) {}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   618
    virtual void SetArguments (T1Parameter a1, T2Parameter a2, T3Parameter a3, T4Parameter a4,T5Parameter a5,T6Parameter a6) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   619
      m_a1 = a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   620
      m_a2 = a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   621
      m_a3 = a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   622
      m_a4 = a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   623
      m_a5 = a5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   624
      m_a6 = a6;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   625
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   626
    virtual EventId Schedule (const Time &delay) {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   627
      return Simulator::Schedule (delay, m_memPtr, m_objPtr, m_a1, m_a2, m_a3, m_a4, m_a5, m_a6);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   628
    }
1943
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   629
    virtual void Invoke (void) {
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   630
      (TimerImplMemberTraits<OBJ_PTR>::GetReference (m_objPtr).*m_memPtr) (m_a1, m_a2, m_a3, m_a4, m_a5, m_a6); 
f7f0279465d7 implement TimerImpl::Invoke
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents: 1942
diff changeset
   631
    }
1941
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   632
    MEM_PTR m_memPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   633
    OBJ_PTR m_objPtr;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   634
    T1Stored m_a1;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   635
    T2Stored m_a2;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   636
    T3Stored m_a3;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   637
    T4Stored m_a4;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   638
    T5Stored m_a5;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   639
    T6Stored m_a6;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   640
  } *function = new MemFnTimerImplSix (memPtr, objPtr);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   641
  return function;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   642
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   643
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   644
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   645
template <typename T1>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   646
void
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   647
TimerImpl::SetArgs (T1 a1)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   648
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   649
  typedef struct TimerImplOne<
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   650
    typename TimerTraits<T1>::ParameterType
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   651
    > TimerImplBase;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   652
  TimerImplBase *impl = dynamic_cast<TimerImplBase *> (this);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   653
  if (impl == 0)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   654
    {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   655
      NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function.");
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   656
      return;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   657
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   658
  impl->SetArguments (a1);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   659
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   660
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   661
template <typename T1, typename T2>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   662
void
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   663
TimerImpl::SetArgs (T1 a1, T2 a2)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   664
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   665
  typedef struct TimerImplTwo<
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   666
    typename TimerTraits<T1>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   667
    typename TimerTraits<T2>::ParameterType
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   668
    > TimerImplBase;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   669
  TimerImplBase *impl = dynamic_cast<TimerImplBase *> (this);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   670
  if (impl == 0)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   671
    {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   672
      NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function.");
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   673
      return;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   674
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   675
  impl->SetArguments (a1, a2);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   676
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   677
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   678
template <typename T1, typename T2, typename T3>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   679
void 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   680
TimerImpl::SetArgs (T1 a1, T2 a2, T3 a3)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   681
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   682
  typedef struct TimerImplThree<
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   683
    typename TimerTraits<T1>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   684
    typename TimerTraits<T2>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   685
    typename TimerTraits<T3>::ParameterType
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   686
    > TimerImplBase;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   687
  TimerImplBase *impl = dynamic_cast<TimerImplBase *> (this);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   688
  if (impl == 0)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   689
    {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   690
      NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function.");
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   691
      return;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   692
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   693
  impl->SetArguments (a1, a2, a3);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   694
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   695
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   696
template <typename T1, typename T2, typename T3, typename T4>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   697
void 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   698
TimerImpl::SetArgs (T1 a1, T2 a2, T3 a3, T4 a4)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   699
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   700
  typedef struct TimerImplFour<
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   701
    typename TimerTraits<T1>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   702
    typename TimerTraits<T2>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   703
    typename TimerTraits<T3>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   704
    typename TimerTraits<T4>::ParameterType
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   705
    > TimerImplBase;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   706
  TimerImplBase *impl = dynamic_cast<TimerImplBase *> (this);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   707
  if (impl == 0)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   708
    {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   709
      NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function.");
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   710
      return;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   711
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   712
  impl->SetArguments (a1, a2, a3, a4);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   713
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   714
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   715
template <typename T1, typename T2, typename T3, typename T4, typename T5>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   716
void 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   717
TimerImpl::SetArgs (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   718
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   719
  typedef struct TimerImplFive<
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   720
    typename TimerTraits<T1>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   721
    typename TimerTraits<T2>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   722
    typename TimerTraits<T3>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   723
    typename TimerTraits<T4>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   724
    typename TimerTraits<T5>::ParameterType
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   725
    > TimerImplBase;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   726
  TimerImplBase *impl = dynamic_cast<TimerImplBase *> (this);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   727
  if (impl == 0)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   728
    {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   729
      NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function.");
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   730
      return;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   731
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   732
  impl->SetArguments (a1, a2, a3, a4, a5);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   733
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   734
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   735
template <typename T1, typename T2, typename T3, typename T4, typename T5, typename T6>
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   736
void 
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   737
TimerImpl::SetArgs (T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   738
{
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   739
  typedef struct TimerImplSix<
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   740
    typename TimerTraits<T1>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   741
    typename TimerTraits<T2>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   742
    typename TimerTraits<T3>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   743
    typename TimerTraits<T4>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   744
    typename TimerTraits<T5>::ParameterType,
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   745
    typename TimerTraits<T6>::ParameterType
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   746
    > TimerImplBase;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   747
  TimerImplBase *impl = dynamic_cast<TimerImplBase *> (this);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   748
  if (impl == 0)
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   749
    {
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   750
      NS_FATAL_ERROR ("You tried to set Timer arguments incompatible with its function.");
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   751
      return;
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   752
    }
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   753
  impl->SetArguments (a1, a2, a3, a4, a5, a6);
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   754
}
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   755
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   756
} // namespace ns3
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   757
c4eb28d51689 split timer implementation outside of Timer class
Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
parents:
diff changeset
   758
#endif /* TIMER_IMPL_H */