diff --git a/src/simulator/simulator.cc b/src/simulator/simulator.cc index ae8fe501a..a967ba271 100644 --- a/src/simulator/simulator.cc +++ b/src/simulator/simulator.cc @@ -471,6 +471,7 @@ static void foo4 (int, int, int, int) static void foo5 (int, int, int, int, int) {} +#if 1 static void ber1 (int &) {} static void ber2 (int &, int &) @@ -481,6 +482,18 @@ static void ber4 (int &, int &, int &, int &) {} static void ber5 (int &, int &, int &, int &, int &) {} +#endif + +static void cber1 (const int &) +{} +static void cber2 (const int &, const int &) +{} +static void cber3 (const int &, const int &, const int &) +{} +static void cber4 (const int &, const int &, const int &, const int &) +{} +static void cber5 (const int &, const int &, const int &, const int &, const int &) +{} class SimulatorTests : public Test { @@ -509,6 +522,11 @@ private: void baz3 (int &, int &, int &); void baz4 (int &, int &, int &, int &); void baz5 (int &, int &, int &, int &, int &); + void cbaz1 (const int &); + void cbaz2 (const int &, const int &); + void cbaz3 (const int &, const int &, const int &); + void cbaz4 (const int &, const int &, const int &, const int &); + void cbaz5 (const int &, const int &, const int &, const int &, const int &); bool m_b; bool m_a; @@ -605,6 +623,22 @@ void SimulatorTests::baz5 (int &, int &, int &, int &, int &) {} +void +SimulatorTests::cbaz1 (const int &) +{} +void +SimulatorTests::cbaz2 (const int &, const int &) +{} +void +SimulatorTests::cbaz3 (const int &, const int &, const int &) +{} +void +SimulatorTests::cbaz4 (const int &, const int &, const int &, const int &) +{} +void +SimulatorTests::cbaz5 (const int &, const int &, const int &, const int &, const int &) +{} + bool SimulatorTests::RunOneTest (void) { @@ -670,11 +704,11 @@ SimulatorTests::RunTests (void) Simulator::Schedule (Seconds (0.0), &foo3, 0, 0, 0); Simulator::Schedule (Seconds (0.0), &foo4, 0, 0, 0, 0); Simulator::Schedule (Seconds (0.0), &foo5, 0, 0, 0, 0, 0); - Simulator::Schedule (Seconds (0.0), &ber1, 0); - Simulator::Schedule (Seconds (0.0), &ber2, 0, 0); - Simulator::Schedule (Seconds (0.0), &ber3, 0, 0, 0); - Simulator::Schedule (Seconds (0.0), &ber4, 0, 0, 0, 0); - Simulator::Schedule (Seconds (0.0), &ber5, 0, 0, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &cber1, 0); + Simulator::Schedule (Seconds (0.0), &cber2, 0, 0); + Simulator::Schedule (Seconds (0.0), &cber3, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &cber4, 0, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &cber5, 0, 0, 0, 0, 0); Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar0, this); Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar1, this, 0); Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar2, this, 0, 0); @@ -687,18 +721,33 @@ SimulatorTests::RunTests (void) Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar3, Ptr (this), 0, 0, 0); Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar4, Ptr (this), 0, 0, 0, 0); Simulator::Schedule (Seconds (0.0), &SimulatorTests::bar5, Ptr (this), 0, 0, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz1, this, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz2, this, 0, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz3, this, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz4, this, 0, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::cbaz5, this, 0, 0, 0, 0, 0); Simulator::ScheduleNow (&foo0); Simulator::ScheduleNow (&foo1, 0); Simulator::ScheduleNow (&foo2, 0, 0); Simulator::ScheduleNow (&foo3, 0, 0, 0); Simulator::ScheduleNow (&foo4, 0, 0, 0, 0); Simulator::ScheduleNow (&foo5, 0, 0, 0, 0, 0); + Simulator::ScheduleNow (&cber1, 0); + Simulator::ScheduleNow (&cber2, 0, 0); + Simulator::ScheduleNow (&cber3, 0, 0, 0); + Simulator::ScheduleNow (&cber4, 0, 0, 0, 0); + Simulator::ScheduleNow (&cber5, 0, 0, 0, 0, 0); Simulator::ScheduleNow (&SimulatorTests::bar0, this); Simulator::ScheduleNow (&SimulatorTests::bar1, this, 0); Simulator::ScheduleNow (&SimulatorTests::bar2, this, 0, 0); Simulator::ScheduleNow (&SimulatorTests::bar3, this, 0, 0, 0); Simulator::ScheduleNow (&SimulatorTests::bar4, this, 0, 0, 0, 0); Simulator::ScheduleNow (&SimulatorTests::bar5, this, 0, 0, 0, 0, 0); + Simulator::ScheduleNow (&SimulatorTests::cbaz1, this, 0); + Simulator::ScheduleNow (&SimulatorTests::cbaz2, this, 0, 0); + Simulator::ScheduleNow (&SimulatorTests::cbaz3, this, 0, 0, 0); + Simulator::ScheduleNow (&SimulatorTests::cbaz4, this, 0, 0, 0, 0); + Simulator::ScheduleNow (&SimulatorTests::cbaz5, this, 0, 0, 0, 0, 0); Simulator::ScheduleNow (&SimulatorTests::bar0, Ptr (this)); Simulator::ScheduleNow (&SimulatorTests::bar1, Ptr (this), 0); Simulator::ScheduleNow (&SimulatorTests::bar2, Ptr (this), 0, 0); @@ -711,12 +760,22 @@ SimulatorTests::RunTests (void) Simulator::ScheduleDestroy (&foo3, 0, 0, 0); Simulator::ScheduleDestroy (&foo4, 0, 0, 0, 0); Simulator::ScheduleDestroy (&foo5, 0, 0, 0, 0, 0); + Simulator::ScheduleDestroy (&cber1, 0); + Simulator::ScheduleDestroy (&cber2, 0, 0); + Simulator::ScheduleDestroy (&cber3, 0, 0, 0); + Simulator::ScheduleDestroy (&cber4, 0, 0, 0, 0); + Simulator::ScheduleDestroy (&cber5, 0, 0, 0, 0, 0); Simulator::ScheduleDestroy (&SimulatorTests::bar0, this); Simulator::ScheduleDestroy (&SimulatorTests::bar1, this, 0); Simulator::ScheduleDestroy (&SimulatorTests::bar2, this, 0, 0); Simulator::ScheduleDestroy (&SimulatorTests::bar3, this, 0, 0, 0); Simulator::ScheduleDestroy (&SimulatorTests::bar4, this, 0, 0, 0, 0); Simulator::ScheduleDestroy (&SimulatorTests::bar5, this, 0, 0, 0, 0, 0); + Simulator::ScheduleDestroy (&SimulatorTests::cbaz1, this, 0); + Simulator::ScheduleDestroy (&SimulatorTests::cbaz2, this, 0, 0); + Simulator::ScheduleDestroy (&SimulatorTests::cbaz3, this, 0, 0, 0); + Simulator::ScheduleDestroy (&SimulatorTests::cbaz4, this, 0, 0, 0, 0); + Simulator::ScheduleDestroy (&SimulatorTests::cbaz5, this, 0, 0, 0, 0, 0); Simulator::ScheduleDestroy (&SimulatorTests::bar0, Ptr (this)); Simulator::ScheduleDestroy (&SimulatorTests::bar1, Ptr (this), 0); Simulator::ScheduleDestroy (&SimulatorTests::bar2, Ptr (this), 0, 0); @@ -724,6 +783,43 @@ SimulatorTests::RunTests (void) Simulator::ScheduleDestroy (&SimulatorTests::bar4, Ptr (this), 0, 0, 0, 0); Simulator::ScheduleDestroy (&SimulatorTests::bar5, Ptr (this), 0, 0, 0, 0, 0); + + // the code below does not compile, as expected. + //Simulator::Schedule (Seconds (0.0), &cber1, 0.0); + +#if 1 + Simulator::Schedule (Seconds (0.0), &ber1, 0); + Simulator::Schedule (Seconds (0.0), &ber2, 0, 0); + Simulator::Schedule (Seconds (0.0), &ber3, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &ber4, 0, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &ber5, 0, 0, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz1, this, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz2, this, 0, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz3, this, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz4, this, 0, 0, 0, 0); + Simulator::Schedule (Seconds (0.0), &SimulatorTests::baz5, this, 0, 0, 0, 0, 0); + Simulator::ScheduleNow (&ber1, 0); + Simulator::ScheduleNow (&ber2, 0, 0); + Simulator::ScheduleNow (&ber3, 0, 0, 0); + Simulator::ScheduleNow (&ber4, 0, 0, 0, 0); + Simulator::ScheduleNow (&ber5, 0, 0, 0, 0, 0); + Simulator::ScheduleNow (&SimulatorTests::baz1, this, 0); + Simulator::ScheduleNow (&SimulatorTests::baz2, this, 0, 0); + Simulator::ScheduleNow (&SimulatorTests::baz3, this, 0, 0, 0); + Simulator::ScheduleNow (&SimulatorTests::baz4, this, 0, 0, 0, 0); + Simulator::ScheduleNow (&SimulatorTests::baz5, this, 0, 0, 0, 0, 0); + Simulator::ScheduleDestroy (&ber1, 0); + Simulator::ScheduleDestroy (&ber2, 0, 0); + Simulator::ScheduleDestroy (&ber3, 0, 0, 0); + Simulator::ScheduleDestroy (&ber4, 0, 0, 0, 0); + Simulator::ScheduleDestroy (&ber5, 0, 0, 0, 0, 0); + Simulator::ScheduleDestroy (&SimulatorTests::baz1, this, 0); + Simulator::ScheduleDestroy (&SimulatorTests::baz2, this, 0, 0); + Simulator::ScheduleDestroy (&SimulatorTests::baz3, this, 0, 0, 0); + Simulator::ScheduleDestroy (&SimulatorTests::baz4, this, 0, 0, 0, 0); + Simulator::ScheduleDestroy (&SimulatorTests::baz5, this, 0, 0, 0, 0, 0); +#endif + Simulator::Run (); Simulator::Destroy (); diff --git a/src/simulator/simulator.h b/src/simulator/simulator.h index 59a888459..edda2f666 100644 --- a/src/simulator/simulator.h +++ b/src/simulator/simulator.h @@ -172,8 +172,8 @@ public: * @param a1 the first argument to pass to the invoked method * @returns an id for the scheduled event. */ - template - static EventId Schedule (Time const &time, void (T::*mem_ptr) (T1), OBJ obj, T1 a1); + template + static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1), OBJ obj, T1 a1); /** * @param time the relative expiration time of the event. * @param mem_ptr member method pointer to invoke @@ -182,8 +182,8 @@ public: * @param a2 the second argument to pass to the invoked method * @returns an id for the scheduled event. */ - template - static EventId Schedule (Time const &time, void (T::*mem_ptr) (T1,T2), OBJ obj, T1 a1, T2 a2); + template + static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2); /** * @param time the relative expiration time of the event. * @param mem_ptr member method pointer to invoke @@ -193,8 +193,10 @@ public: * @param a3 the third argument to pass to the invoked method * @returns an id for the scheduled event. */ - template - static EventId Schedule (Time const &time, void (T::*mem_ptr) (T1,T2,T3), OBJ obj, T1 a1, T2 a2, T3 a3); + template + static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3); /** * @param time the relative expiration time of the event. * @param mem_ptr member method pointer to invoke @@ -205,8 +207,10 @@ public: * @param a4 the fourth argument to pass to the invoked method * @returns an id for the scheduled event. */ - template - static EventId Schedule (Time const &time, void (T::*mem_ptr) (T1,T2,T3,T4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); + template + static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); /** * @param time the relative expiration time of the event. * @param mem_ptr member method pointer to invoke @@ -218,8 +222,10 @@ public: * @param a5 the fifth argument to pass to the invoked method * @returns an id for the scheduled event. */ - template - static EventId Schedule (Time const &time, void (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ obj, + template + static EventId Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** * @param time the relative expiration time of the event. @@ -296,16 +302,20 @@ public: * @param obj the object on which to invoke the member method * @param a1 the first argument to pass to the invoked method */ - template - static void ScheduleNow (void (T::*mem_ptr) (T1), OBJ obj, T1 a1); + template + static void ScheduleNow (void (T::*mem_ptr) (U1), OBJ obj, T1 a1); /** * @param mem_ptr member method pointer to invoke * @param obj the object on which to invoke the member method * @param a1 the first argument to pass to the invoked method * @param a2 the second argument to pass to the invoked method */ - template - static void ScheduleNow (void (T::*mem_ptr) (T1,T2), OBJ obj, T1 a1, T2 a2); + template + static void ScheduleNow (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2); /** * @param mem_ptr member method pointer to invoke * @param obj the object on which to invoke the member method @@ -313,8 +323,10 @@ public: * @param a2 the second argument to pass to the invoked method * @param a3 the third argument to pass to the invoked method */ - template - static void ScheduleNow (void (T::*mem_ptr) (T1,T2,T3), OBJ obj, T1 a1, T2 a2, T3 a3); + template + static void ScheduleNow (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3); /** * @param mem_ptr member method pointer to invoke * @param obj the object on which to invoke the member method @@ -323,8 +335,10 @@ public: * @param a3 the third argument to pass to the invoked method * @param a4 the fourth argument to pass to the invoked method */ - template - static void ScheduleNow (void (T::*mem_ptr) (T1,T2,T3,T4), OBJ obj, + template + static void ScheduleNow (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); /** * @param mem_ptr member method pointer to invoke @@ -335,8 +349,10 @@ public: * @param a4 the fourth argument to pass to the invoked method * @param a5 the fifth argument to pass to the invoked method */ - template - static void ScheduleNow (void (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ obj, + template + static void ScheduleNow (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** * @param f the function to invoke @@ -346,23 +362,26 @@ public: * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke */ - template - static void ScheduleNow (void (*f) (T1), T1 a1); + template + static void ScheduleNow (void (*f) (U1), T1 a1); /** * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke * @param a2 the second argument to pass to the function to invoke */ - template - static void ScheduleNow (void (*f) (T1,T2), T1 a1, T2 a2); + template + static void ScheduleNow (void (*f) (U1,U2), T1 a1, T2 a2); /** * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke * @param a2 the second argument to pass to the function to invoke * @param a3 the third argument to pass to the function to invoke */ - template - static void ScheduleNow (void (*f) (T1,T2,T3), T1 a1, T2 a2, T3 a3); + template + static void ScheduleNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3); /** * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke @@ -370,8 +389,9 @@ public: * @param a3 the third argument to pass to the function to invoke * @param a4 the fourth argument to pass to the function to invoke */ - template - static void ScheduleNow (void (*f) (T1,T2,T3,T4), T1 a1, T2 a2, T3 a3, T4 a4); + template + static void ScheduleNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); /** * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke @@ -380,8 +400,9 @@ public: * @param a4 the fourth argument to pass to the function to invoke * @param a5 the fifth argument to pass to the function to invoke */ - template - static void ScheduleNow (void (*f) (T1,T2,T3,T4,T5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + template + static void ScheduleNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** @@ -400,16 +421,20 @@ public: * @param obj the object on which to invoke the member method * @param a1 the first argument to pass to the invoked method */ - template - static void ScheduleDestroy (void (T::*mem_ptr) (T1), OBJ obj, T1 a1); + template + static void ScheduleDestroy (void (T::*mem_ptr) (U1), OBJ obj, T1 a1); /** * @param mem_ptr member method pointer to invoke * @param obj the object on which to invoke the member method * @param a1 the first argument to pass to the invoked method * @param a2 the second argument to pass to the invoked method */ - template - static void ScheduleDestroy (void (T::*mem_ptr) (T1,T2), OBJ obj, T1 a1, T2 a2); + template + static void ScheduleDestroy (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2); /** * @param mem_ptr member method pointer to invoke * @param obj the object on which to invoke the member method @@ -417,8 +442,10 @@ public: * @param a2 the second argument to pass to the invoked method * @param a3 the third argument to pass to the invoked method */ - template - static void ScheduleDestroy (void (T::*mem_ptr) (T1,T2,T3), OBJ obj, T1 a1, T2 a2, T3 a3); + template + static void ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3); /** * @param mem_ptr member method pointer to invoke * @param obj the object on which to invoke the member method @@ -427,8 +454,10 @@ public: * @param a3 the third argument to pass to the invoked method * @param a4 the fourth argument to pass to the invoked method */ - template - static void ScheduleDestroy (void (T::*mem_ptr) (T1,T2,T3,T4), OBJ obj, + template + static void ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); /** * @param mem_ptr member method pointer to invoke @@ -439,8 +468,10 @@ public: * @param a4 the fourth argument to pass to the invoked method * @param a5 the fifth argument to pass to the invoked method */ - template - static void ScheduleDestroy (void (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ obj, + template + static void ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** * @param f the function to invoke @@ -450,23 +481,26 @@ public: * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke */ - template - static void ScheduleDestroy (void (*f) (T1), T1 a1); + template + static void ScheduleDestroy (void (*f) (U1), T1 a1); /** * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke * @param a2 the second argument to pass to the function to invoke */ - template - static void ScheduleDestroy (void (*f) (T1,T2), T1 a1, T2 a2); + template + static void ScheduleDestroy (void (*f) (U1,U2), T1 a1, T2 a2); /** * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke * @param a2 the second argument to pass to the function to invoke * @param a3 the third argument to pass to the function to invoke */ - template - static void ScheduleDestroy (void (*f) (T1,T2,T3), T1 a1, T2 a2, T3 a3); + template + static void ScheduleDestroy (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3); /** * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke @@ -474,8 +508,9 @@ public: * @param a3 the third argument to pass to the function to invoke * @param a4 the fourth argument to pass to the function to invoke */ - template - static void ScheduleDestroy (void (*f) (T1,T2,T3,T4), T1 a1, T2 a2, T3 a3, T4 a4); + template + static void ScheduleDestroy (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4); /** * @param f the function to invoke * @param a1 the first argument to pass to the function to invoke @@ -484,8 +519,9 @@ public: * @param a4 the fourth argument to pass to the function to invoke * @param a5 the fifth argument to pass to the function to invoke */ - template - static void ScheduleDestroy (void (*f) (T1,T2,T3,T4,T5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); + template + static void ScheduleDestroy (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); /** * Remove an event from the event list. @@ -535,19 +571,30 @@ private: template static EventImpl *MakeEvent (void (T::*mem_ptr) (void), OBJ obj); - template - static EventImpl *MakeEvent (void (T::*mem_ptr) (T1), OBJ obj, T1 a1); - template - static EventImpl *MakeEvent (void (T::*mem_ptr) (T1,T2), OBJ obj, T1 a1, T2 a2); - template - static EventImpl *MakeEvent (void (T::*mem_ptr) (T1,T2,T3), OBJ obj, T1 a1, T2 a2, T3 a3); - template - static EventImpl *MakeEvent (void (T::*mem_ptr) (T1,T2,T3,T4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); - template - static EventImpl *MakeEvent (void (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ obj, + template + static EventImpl *MakeEvent (void (T::*mem_ptr) (U1), OBJ obj, T1 a1); + template + static EventImpl *MakeEvent (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2); + template + static EventImpl *MakeEvent (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3); + template + static EventImpl *MakeEvent (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4); + template + static EventImpl *MakeEvent (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5); static EventImpl *MakeEvent (void (*f) (void)); - template + template static EventImpl *MakeEvent (void (*f) (U1), T1 a1); template @@ -625,13 +672,15 @@ EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (void), OBJ obj) } -template -EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1), OBJ obj, T1 a1) +template +EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (U1), OBJ obj, T1 a1) { // one argument version class EventMemberImpl1 : public EventImpl { public: - typedef void (T::*F)(T1); + typedef void (T::*F)(U1); EventMemberImpl1 (OBJ obj, F function, T1 a1) : m_obj (obj), m_function (function), @@ -645,18 +694,20 @@ EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1), OBJ obj, T1 a1) } OBJ m_obj; F m_function; - T1 m_a1; + typename TypeTraits::ReferencedType m_a1; } *ev = new EventMemberImpl1 (obj, mem_ptr, a1); return ev; } -template -EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1,T2), OBJ obj, T1 a1, T2 a2) +template +EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2) { // two argument version class EventMemberImpl2 : public EventImpl { public: - typedef void (T::*F)(T1, T2); + typedef void (T::*F)(U1, U2); EventMemberImpl2 (OBJ obj, F function, T1 a1, T2 a2) : m_obj (obj), @@ -672,19 +723,21 @@ EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1,T2), OBJ obj, T1 a1, T2 } OBJ m_obj; F m_function; - T1 m_a1; - T2 m_a2; + typename TypeTraits::ReferencedType m_a1; + typename TypeTraits::ReferencedType m_a2; } *ev = new EventMemberImpl2 (obj, mem_ptr, a1, a2); return ev; } -template -EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1,T2,T3), OBJ obj, T1 a1, T2 a2, T3 a3) +template +EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3) { // three argument version class EventMemberImpl3 : public EventImpl { public: - typedef void (T::*F)(T1, T2, T3); + typedef void (T::*F)(U1,U2,U3); EventMemberImpl3 (OBJ obj, F function, T1 a1, T2 a2, T3 a3) : m_obj (obj), @@ -701,20 +754,22 @@ EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1,T2,T3), OBJ obj, T1 a1, } OBJ m_obj; F m_function; - T1 m_a1; - T2 m_a2; - T3 m_a3; + typename TypeTraits::ReferencedType m_a1; + typename TypeTraits::ReferencedType m_a2; + typename TypeTraits::ReferencedType m_a3; } *ev = new EventMemberImpl3 (obj, mem_ptr, a1, a2, a3); return ev; } -template -EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1,T2,T3,T4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) +template +EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) { // four argument version class EventMemberImpl4 : public EventImpl { public: - typedef void (T::*F)(T1, T2, T3, T4); + typedef void (T::*F)(U1, U2, U3, U4); EventMemberImpl4 (OBJ obj, F function, T1 a1, T2 a2, T3 a3, T4 a4) : m_obj (obj), @@ -732,22 +787,24 @@ EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1,T2,T3,T4), OBJ obj, T1 a } OBJ m_obj; F m_function; - T1 m_a1; - T2 m_a2; - T3 m_a3; - T4 m_a4; + typename TypeTraits::ReferencedType m_a1; + typename TypeTraits::ReferencedType m_a2; + typename TypeTraits::ReferencedType m_a3; + typename TypeTraits::ReferencedType m_a4; } *ev = new EventMemberImpl4 (obj, mem_ptr, a1, a2, a3, a4); return ev; } -template -EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ obj, +template +EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { // five argument version class EventMemberImpl5 : public EventImpl { public: - typedef void (T::*F)(T1, T2, T3, T4, T5); + typedef void (T::*F)(U1, U2, U3, U4, U5); EventMemberImpl5 (OBJ obj, F function, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) : m_obj (obj), @@ -766,11 +823,11 @@ EventImpl *Simulator::MakeEvent (void (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ obj, } OBJ m_obj; F m_function; - T1 m_a1; - T2 m_a2; - T3 m_a3; - T4 m_a4; - T5 m_a5; + typename TypeTraits::ReferencedType m_a1; + typename TypeTraits::ReferencedType m_a2; + typename TypeTraits::ReferencedType m_a3; + typename TypeTraits::ReferencedType m_a4; + typename TypeTraits::ReferencedType m_a5; } *ev = new EventMemberImpl5 (obj, mem_ptr, a1, a2, a3, a4, a5); return ev; } @@ -925,32 +982,42 @@ EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (void), OBJ ob } -template -EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (T1), OBJ obj, T1 a1) +template +EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1), OBJ obj, T1 a1) { return Schedule (time, MakeEvent (mem_ptr, obj, a1)); } -template -EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (T1,T2), OBJ obj, T1 a1, T2 a2) +template +EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2) { return Schedule (time, MakeEvent (mem_ptr, obj, a1, a2)); } -template -EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (T1,T2,T3), OBJ obj, T1 a1, T2 a2, T3 a3) +template +EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3) { return Schedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3)); } -template -EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (T1,T2,T3,T4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) +template +EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) { return Schedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4)); } -template -EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ obj, +template +EventId Simulator::Schedule (Time const &time, void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { return Schedule (time, MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5)); @@ -1001,73 +1068,88 @@ Simulator::ScheduleNow (void (T::*mem_ptr) (void), OBJ obj) } -template +template void -Simulator::ScheduleNow (void (T::*mem_ptr) (T1), OBJ obj, T1 a1) +Simulator::ScheduleNow (void (T::*mem_ptr) (U1), OBJ obj, T1 a1) { ScheduleNow (MakeEvent (mem_ptr, obj, a1)); } -template +template void -Simulator::ScheduleNow (void (T::*mem_ptr) (T1,T2), OBJ obj, T1 a1, T2 a2) +Simulator::ScheduleNow (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2) { ScheduleNow (MakeEvent (mem_ptr, obj, a1, a2)); } -template +template void -Simulator::ScheduleNow (void (T::*mem_ptr) (T1,T2,T3), OBJ obj, T1 a1, T2 a2, T3 a3) +Simulator::ScheduleNow (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3) { ScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3)); } -template +template void -Simulator::ScheduleNow (void (T::*mem_ptr) (T1,T2,T3,T4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) +Simulator::ScheduleNow (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) { ScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4)); } -template +template void -Simulator::ScheduleNow (void (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ obj, +Simulator::ScheduleNow (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { ScheduleNow (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5)); } -template +template void -Simulator::ScheduleNow (void (*f) (T1), T1 a1) +Simulator::ScheduleNow (void (*f) (U1), T1 a1) { ScheduleNow (MakeEvent (f, a1)); } -template +template void -Simulator::ScheduleNow (void (*f) (T1,T2), T1 a1, T2 a2) +Simulator::ScheduleNow (void (*f) (U1,U2), T1 a1, T2 a2) { ScheduleNow (MakeEvent (f, a1, a2)); } -template +template void -Simulator::ScheduleNow (void (*f) (T1,T2,T3), T1 a1, T2 a2, T3 a3) +Simulator::ScheduleNow (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3) { ScheduleNow (MakeEvent (f, a1, a2, a3)); } -template +template void -Simulator::ScheduleNow (void (*f) (T1,T2,T3,T4), T1 a1, T2 a2, T3 a3, T4 a4) +Simulator::ScheduleNow (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) { ScheduleNow (MakeEvent (f, a1, a2, a3, a4)); } -template +template void -Simulator::ScheduleNow (void (*f) (T1,T2,T3,T4,T5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +Simulator::ScheduleNow (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { ScheduleNow (MakeEvent (f, a1, a2, a3, a4, a5)); } @@ -1082,73 +1164,88 @@ Simulator::ScheduleDestroy (void (T::*mem_ptr) (void), OBJ obj) } -template +template void -Simulator::ScheduleDestroy (void (T::*mem_ptr) (T1), OBJ obj, T1 a1) +Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1), OBJ obj, T1 a1) { ScheduleDestroy (MakeEvent (mem_ptr, obj, a1)); } -template +template void -Simulator::ScheduleDestroy (void (T::*mem_ptr) (T1,T2), OBJ obj, T1 a1, T2 a2) +Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1,U2), OBJ obj, T1 a1, T2 a2) { ScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2)); } -template +template void -Simulator::ScheduleDestroy (void (T::*mem_ptr) (T1,T2,T3), OBJ obj, T1 a1, T2 a2, T3 a3) +Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3), OBJ obj, T1 a1, T2 a2, T3 a3) { ScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3)); } -template +template void -Simulator::ScheduleDestroy (void (T::*mem_ptr) (T1,T2,T3,T4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) +Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3,U4), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4) { ScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4)); } -template +template void -Simulator::ScheduleDestroy (void (T::*mem_ptr) (T1,T2,T3,T4,T5), OBJ obj, +Simulator::ScheduleDestroy (void (T::*mem_ptr) (U1,U2,U3,U4,U5), OBJ obj, T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { ScheduleDestroy (MakeEvent (mem_ptr, obj, a1, a2, a3, a4, a5)); } -template +template void -Simulator::ScheduleDestroy (void (*f) (T1), T1 a1) +Simulator::ScheduleDestroy (void (*f) (U1), T1 a1) { ScheduleDestroy (MakeEvent (f, a1)); } -template +template void -Simulator::ScheduleDestroy (void (*f) (T1,T2), T1 a1, T2 a2) +Simulator::ScheduleDestroy (void (*f) (U1,U2), T1 a1, T2 a2) { ScheduleDestroy (MakeEvent (f, a1, a2)); } -template +template void -Simulator::ScheduleDestroy (void (*f) (T1,T2,T3), T1 a1, T2 a2, T3 a3) +Simulator::ScheduleDestroy (void (*f) (U1,U2,U3), T1 a1, T2 a2, T3 a3) { ScheduleDestroy (MakeEvent (f, a1, a2, a3)); } -template +template void -Simulator::ScheduleDestroy (void (*f) (T1,T2,T3,T4), T1 a1, T2 a2, T3 a3, T4 a4) +Simulator::ScheduleDestroy (void (*f) (U1,U2,U3,U4), T1 a1, T2 a2, T3 a3, T4 a4) { ScheduleDestroy (MakeEvent (f, a1, a2, a3, a4)); } -template +template void -Simulator::ScheduleDestroy (void (*f) (T1,T2,T3,T4,T5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) +Simulator::ScheduleDestroy (void (*f) (U1,U2,U3,U4,U5), T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) { ScheduleDestroy (MakeEvent (f, a1, a2, a3, a4, a5)); }