library of assembled shared sources |
http://lass.cocamware.com |
00001 /* 00002 * *** ATTENTION! DO NOT MODIFY THIS FILE DIRECTLY! *** 00003 * 00004 * It has automatically been generated from dispatcher_x.tmpl.h 00005 * by param_expander.py on Sun Nov 09 16:55:48 2008. 00006 */ 00007 00008 /** @file 00009 * @author Bram de Greve (bramz@users.sourceforge.net) 00010 * @author Tom De Muer (tomdemuer@users.sourceforge.net) 00011 * 00012 * *** BEGIN LICENSE INFORMATION *** 00013 * 00014 * The contents of this file are subject to the Common Public Attribution License 00015 * Version 1.0 (the "License"); you may not use this file except in compliance with 00016 * the License. You may obtain a copy of the License at 00017 * http://lass.sourceforge.net/cpal-license. The License is based on the 00018 * Mozilla Public License Version 1.1 but Sections 14 and 15 have been added to cover 00019 * use of software over a computer network and provide for limited attribution for 00020 * the Original Developer. In addition, Exhibit A has been modified to be consistent 00021 * with Exhibit B. 00022 * 00023 * Software distributed under the License is distributed on an "AS IS" basis, WITHOUT 00024 * WARRANTY OF ANY KIND, either express or implied. See the License for the specific 00025 * language governing rights and limitations under the License. 00026 * 00027 * The Original Code is LASS - Library of Assembled Shared Sources. 00028 * 00029 * The Initial Developer of the Original Code is Bram de Greve and Tom De Muer. 00030 * The Original Developer is the Initial Developer. 00031 * 00032 * All portions of the code written by the Initial Developer are: 00033 * Copyright (C) 2004-2007 the Initial Developer. 00034 * All Rights Reserved. 00035 * 00036 * Contributor(s): 00037 * 00038 * Alternatively, the contents of this file may be used under the terms of the 00039 * GNU General Public License Version 2 or later (the GPL), in which case the 00040 * provisions of GPL are applicable instead of those above. If you wish to allow use 00041 * of your version of this file only under the terms of the GPL and not to allow 00042 * others to use your version of this file under the CPAL, indicate your decision by 00043 * deleting the provisions above and replace them with the notice and other 00044 * provisions required by the GPL License. If you do not delete the provisions above, 00045 * a recipient may use your version of this file under either the CPAL or the GPL. 00046 * 00047 * *** END LICENSE INFORMATION *** 00048 */ 00049 00050 00051 00052 #ifndef LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_2_H 00053 #define LASS_GUARDIAN_OF_INCLUSION_UTIL_IMPL_DISPATCHER_2_H 00054 00055 #include "dispatcher_allocator.h" 00056 00057 // --- NEW INTERFACES ---------------------------------------------------------- 00058 00059 namespace lass 00060 { 00061 namespace util 00062 { 00063 namespace impl 00064 { 00065 00066 /** abstract base class of all dispatchers for lass::util::Callback2. 00067 * @internal 00068 * @sa Callback0 00069 * @author Bram de Greve [Bramz] 00070 */ 00071 template 00072 < 00073 typename P1, typename P2 00074 > 00075 class Dispatcher2: public TDispatcherAllocatorBase 00076 { 00077 public: 00078 00079 Dispatcher2() {} 00080 virtual ~Dispatcher2() {} 00081 00082 void call(typename util::CallTraits<P1>::TParam iP1, typename util::CallTraits<P2>::TParam iP2) const 00083 { 00084 doCall(iP1, iP2); 00085 } 00086 00087 private: 00088 00089 virtual void doCall(typename util::CallTraits<P1>::TParam iP1, typename util::CallTraits<P2>::TParam iP2) const = 0; 00090 00091 Dispatcher2(const Dispatcher2<P1, P2>& iOther); 00092 Dispatcher2& operator=(const Dispatcher2<P1, P2>& iOther); 00093 }; 00094 00095 00096 00097 /** Dispatcher for lass::util::Callback2 to a free function: 00098 * @internal 00099 * @sa Callback0 00100 * @author Bram de Greve [Bramz] 00101 */ 00102 template 00103 < 00104 typename P1, typename P2, 00105 typename FunctionType 00106 > 00107 class Dispatcher2Function: public Dispatcher2<P1, P2> 00108 { 00109 public: 00110 00111 typedef FunctionType TFunction; 00112 00113 Dispatcher2Function(typename CallTraits<TFunction>::TParam iFunction): 00114 function_(iFunction) 00115 { 00116 } 00117 00118 private: 00119 00120 void doCall(typename util::CallTraits<P1>::TParam iP1, typename util::CallTraits<P2>::TParam iP2) const 00121 { 00122 function_(iP1, iP2); 00123 } 00124 00125 TFunction function_; 00126 }; 00127 00128 00129 00130 /** Dispatcher for lass::util::Callback2 to an object/method pair. 00131 * @internal 00132 * @sa Callback0 00133 * @author Bram de Greve [Bramz] 00134 */ 00135 template 00136 < 00137 typename P1, typename P2, 00138 typename ObjectPtr, typename Method 00139 > 00140 class Dispatcher2Method: public Dispatcher2<P1, P2> 00141 { 00142 public: 00143 00144 Dispatcher2Method(typename CallTraits<ObjectPtr>::TParam iObject, 00145 typename CallTraits<Method>::TParam iMethod): 00146 object_(iObject), 00147 method_(iMethod) 00148 { 00149 } 00150 00151 private: 00152 00153 void doCall(typename util::CallTraits<P1>::TParam iP1, typename util::CallTraits<P2>::TParam iP2) const 00154 { 00155 ((*object_).*method_)(iP1, iP2); 00156 } 00157 00158 ObjectPtr object_; 00159 Method method_; 00160 }; 00161 00162 00163 00164 } 00165 00166 } 00167 00168 } 00169 00170 #endif // Guardian of Inclusion 00171 00172 00173 // EOF
Generated on Mon Nov 10 14:20:03 2008 for Library of Assembled Shared Sources by 1.5.7.1 |