00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066 #ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_5_H
00067 #define LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_5_H
00068
00069
00070
00071
00072
00073 #include "util_common.h"
00074 #include "shared_ptr.h"
00075 #include "impl/dispatcher_5.h"
00076 #include "callback_common.h"
00077
00078
00079
00080
00081
00082
00083 namespace lass
00084 {
00085 namespace util
00086 {
00087
00088
00089
00090
00091
00092 template
00093 <
00094 typename P1, typename P2, typename P3, typename P4, typename P5
00095 >
00096 class Callback5
00097 {
00098 public:
00099
00100 typedef Callback5<P1, P2, P3, P4, P5> TSelf;
00101 typedef SharedPtr< impl::Dispatcher5<P1, P2, P3, P4, P5> > TDispatcherPtr;
00102
00103
00104
00105
00106
00107 Callback5()
00108 {
00109 }
00110
00111
00112
00113 template <typename FunctionType>
00114 Callback5(FunctionType iFunction):
00115 dispatcher_(new impl::Dispatcher5Function<P1, P2, P3, P4, P5, FunctionType>(iFunction))
00116 {
00117 }
00118
00119
00120
00121 template <typename ObjectPtr, typename Method>
00122 Callback5(ObjectPtr iObject, Method iMethod):
00123 dispatcher_(new impl::Dispatcher5Method<P1, P2, P3, P4, P5, ObjectPtr, Method>(iObject, iMethod))
00124 {
00125 }
00126
00127
00128
00129 Callback5(const TSelf& iOther):
00130 dispatcher_(iOther.dispatcher_)
00131 {
00132 }
00133
00134
00135
00136
00137
00138
00139
00140 template <typename Other>
00141 TSelf& operator=(const Other& iOther)
00142 {
00143 TSelf temp(iOther);
00144 swap(temp);
00145 return *this;
00146 }
00147
00148
00149
00150 void operator()(typename util::CallTraits<P1>::TParam iP1, typename util::CallTraits<P2>::TParam iP2, typename util::CallTraits<P3>::TParam iP3, typename util::CallTraits<P4>::TParam iP4, typename util::CallTraits<P5>::TParam iP5) const
00151 {
00152 if (!isEmpty())
00153 {
00154 dispatcher_->call(iP1, iP2, iP3, iP4, iP5);
00155 }
00156 }
00157
00158
00159
00160
00161
00162
00163 void reset()
00164 {
00165 dispatcher_.reset();
00166 }
00167
00168
00169
00170 bool isEmpty() const
00171 {
00172 return dispatcher_.isEmpty();
00173 }
00174
00175
00176
00177 bool operator!() const
00178 {
00179 return dispatcher_.isEmpty();
00180 }
00181
00182
00183
00184 operator num::SafeBool() const
00185 {
00186 return dispatcher_.isEmpty() ? num::safeFalse : num::safeTrue;
00187 }
00188
00189
00190
00191 void swap(TSelf& iOther)
00192 {
00193 dispatcher_.swap(iOther.dispatcher_);
00194 }
00195
00196 private:
00197
00198 TDispatcherPtr dispatcher_;
00199 };
00200
00201
00202
00203
00204
00205
00206 template <typename P1, typename P2, typename P3, typename P4, typename P5> inline
00207 Callback5<P1, P2, P3, P4, P5> makeCallback(void (*iFunction)(P1, P2, P3, P4, P5))
00208 {
00209 return Callback5<P1, P2, P3, P4, P5>(iFunction);
00210 }
00211
00212
00213
00214
00215
00216
00217 template <typename P1, typename P2, typename P3, typename P4, typename P5> inline
00218 const Callback5<P1, P2, P3, P4, P5>& makeCallback(const Callback5<P1, P2, P3, P4, P5>& iCallback)
00219 {
00220 return iCallback;
00221 }
00222
00223
00224
00225
00226
00227
00228 template <typename ObjectPtr, typename Object, typename P1, typename P2, typename P3, typename P4, typename P5> inline
00229 Callback5<P1, P2, P3, P4, P5> makeCallback(ObjectPtr iObject, void (Object::*iMethod)(P1, P2, P3, P4, P5))
00230 {
00231 return Callback5<P1, P2, P3, P4, P5>(iObject, iMethod);
00232 }
00233
00234
00235
00236
00237
00238
00239 template <typename ObjectPtr, typename Object, typename P1, typename P2, typename P3, typename P4, typename P5> inline
00240 Callback5<P1, P2, P3, P4, P5> makeCallback(ObjectPtr iObject, void (Object::*iMethod)(P1, P2, P3, P4, P5) const)
00241 {
00242 return Callback5<P1, P2, P3, P4, P5>(iObject, iMethod);
00243 }
00244
00245
00246
00247 }
00248
00249 }
00250
00251 #define LASS_PRIM_HAVE_PY_EXPORT_TRAITS_CALLBACK_5
00252 #ifdef LASS_GUARDIAN_OF_INCLUSION_UTIL_CALLBACK_PYTHON_H
00253 # include "callback_python.h"
00254 #endif
00255
00256 #endif // Guardian of Inclusion
00257
00258