Alex Bikfalvi
SimStream Documentation
Call.h
00001 #pragma once 00002 00003 #include "Caller.h" 00004 #include "Delegate.h" 00005 #include "IDelegate.h" 00006 00007 class Call 00008 { 00009 protected: 00010 Caller* caller; 00011 00012 public: 00013 Call(Caller* caller) { this->caller = caller; } 00014 virtual ~Call() { } 00015 }; 00016 00017 class Call0 : public Call 00018 { 00019 private: 00020 IDelegate0<void>* del; 00021 00022 public: 00023 Call0(Caller* caller, IDelegate0<void>* del) : Call(caller) { this->del = del; } 00024 virtual ~Call0() { } 00025 00026 void operator()(); 00027 }; 00028 00029 00030 template<typename P1> class Call1 : public Call 00031 { 00032 private: 00033 IDelegate1<void, P1>* del; 00034 00035 public: 00036 Call1(Caller* caller, IDelegate1<void, P1>* del) : Call(caller) { this->del = del; } 00037 virtual ~Call1() { } 00038 00039 void operator()(P1 p1); 00040 }; 00041 00042 template<typename P1, typename P2> class Call2 : public Call 00043 { 00044 private: 00045 IDelegate2<void, P1, P2>* del; 00046 00047 public: 00048 Call2(Caller* caller, IDelegate2<void, P1, P2>* del) : Call(caller) { this->del = del; } 00049 virtual ~Call2() { } 00050 00051 void operator()(P1 p1, P2 p2); 00052 }; 00053 00054 template<typename P1, typename P2, typename P3> class Call3 : public Call 00055 { 00056 private: 00057 IDelegate3<void, P1, P2, P3>* del; 00058 00059 public: 00060 Call3(Caller* caller, IDelegate3<void, P1, P2, P3>* del) : Call(caller) { this->del = del; } 00061 virtual ~Call3() { } 00062 00063 void operator()(P1 p1, P2 p2, P3 p3); 00064 }; 00065 00066 template<typename P1, typename P2, typename P3, typename P4> class Call4 : public Call 00067 { 00068 private: 00069 IDelegate4<void, P1, P2, P3, P4>* del; 00070 00071 public: 00072 Call4(Caller* caller, IDelegate4<void, P1, P2, P3, P4>* del) : Call(caller) { this->del = del; } 00073 virtual ~Call4() { } 00074 00075 void operator()(P1 p1, P2 p2, P3 p3, P4 p4); 00076 }; 00077 00078 template<typename P1, typename P2, typename P3, typename P4, typename P5> class Call5 : public Call 00079 { 00080 private: 00081 IDelegate5<void, P1, P2, P3, P4, P5>* del; 00082 00083 public: 00084 Call5(Caller* caller, IDelegate5<void, P1, P2, P3, P4, P5>* del) : Call(caller) { this->del = del; } 00085 virtual ~Call5() { } 00086 00087 void operator()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5); 00088 }; 00089 00090 template<typename P1> void Call1<P1>::operator ()(P1 p1) 00091 { 00092 (*this->caller)(new ICall1<P1>(this->del, p1)); 00093 } 00094 00095 template<typename P1, typename P2> void Call2<P1, P2>::operator ()(P1 p1, P2 p2) 00096 { 00097 (*this->caller)(new ICall2<P1, P2>(this->del, p1, p2)); 00098 } 00099 00100 template<typename P1, typename P2, typename P3> void Call3<P1, P2, P3>::operator ()(P1 p1, P2 p2, P3 p3) 00101 { 00102 (*this->caller)(new ICall3<P1, P2, P3>(this->del, p1, p2, p3)); 00103 } 00104 00105 template<typename P1, typename P2, typename P3, typename P4> void Call4<P1, P2, P3, P4>::operator ()(P1 p1, P2 p2, P3 p3, P4 p4) 00106 { 00107 (*this->caller)(new ICall4<P1, P2, P3, P4>(this->del, p1, p2, p3, p4)); 00108 } 00109 00110 template<typename P1, typename P2, typename P3, typename P4, typename P5> void Call5<P1, P2, P3, P4, P5>::operator ()(P1 p1, P2 p2, P3 p3, P4 p4, P5 p5) 00111 { 00112 (*this->caller)(new ICall5<P1, P2, P3, P4, P5>(this->del, p1, p2, p3, p4, p5)); 00113 }
Last updated: February 8, 2011